From edb6eccbe21fd26747dd2dcd198dcca14197e1ae Mon Sep 17 00:00:00 2001 From: sebmarkbage Date: Thu, 15 Feb 2024 01:20:40 +0000 Subject: [PATCH] [Fizz] Align recoverable error serialization in dev mode (#28340) Same as #28327 but for Fizz. One thing that's weird about this recoverable error is that we don't send the regular stack for it, just the component stack it seems. This is missing some potential information and if we move toward integrated since stacks it would be one thing. DiffTrain build for [2e470a788e359e34feeadb422daaff046baf66cc](https://github.com/facebook/react/commit/2e470a788e359e34feeadb422daaff046baf66cc) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/React-prod.modern.js | 2 +- .../facebook-www/React-profiling.modern.js | 2 +- .../ReactDOMServer-dev.classic.js | 381 +++++++++++++++--- .../facebook-www/ReactDOMServer-dev.modern.js | 381 +++++++++++++++--- .../ReactDOMServer-prod.classic.js | 52 +-- .../ReactDOMServer-prod.modern.js | 52 +-- .../ReactDOMServerStreaming-dev.modern.js | 379 ++++++++++++++--- .../ReactDOMServerStreaming-prod.modern.js | 50 +-- .../ReactDOMTesting-prod.modern.js | 6 +- .../ReactFlightDOMServer-dev.modern.js | 4 +- 11 files changed, 1053 insertions(+), 258 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 17f87624fe2ec..e09cbb097687c 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -a7144f297c1c6fe457ca30ce6a211ab59feac11e +2e470a788e359e34feeadb422daaff046baf66cc diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 2f14c7fad4c91..7fdad59084482 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -610,4 +610,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-modern-d2591625"; +exports.version = "18.3.0-www-modern-cbc861b3"; diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index a8801e093921b..cac8fcbf50022 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -614,7 +614,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-modern-20701ea1"; +exports.version = "18.3.0-www-modern-0840aeae"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 7ac3e4c24c928..a8bb0a0bf3d7a 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); - var ReactVersion = "18.3.0-www-classic-0fb6429b"; + var ReactVersion = "18.3.0-www-classic-dec32670"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -91,6 +91,320 @@ if (__DEV__) { enableRenderableContext = dynamicFeatureFlags.enableRenderableContext; // On WWW, false is used for a new modern build. var enableFloat = true; + // ATTENTION + // When adding new symbols to this file, + // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' + // The Symbol used to tag the ReactElement-like types. + var REACT_ELEMENT_TYPE = Symbol.for("react.element"); + var REACT_PORTAL_TYPE = Symbol.for("react.portal"); + var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); + var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); + var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); // TODO: Delete with enableRenderableContext + + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); + var REACT_CONTEXT_TYPE = Symbol.for("react.context"); + var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); + var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); + var REACT_MEMO_TYPE = Symbol.for("react.memo"); + var REACT_LAZY_TYPE = Symbol.for("react.lazy"); + var REACT_SCOPE_TYPE = Symbol.for("react.scope"); + var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"); + var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); + var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"); + var REACT_CACHE_TYPE = Symbol.for("react.cache"); + var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"); + var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); + var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = "@@iterator"; + function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== "object") { + return null; + } + + var maybeIterator = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === "function") { + return maybeIterator; + } + + return null; + } + + var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + + function isArray(a) { + return isArrayImpl(a); + } + + // in case they error. + + var jsxPropsParents = new WeakMap(); + var jsxChildrenParents = new WeakMap(); + function objectName(object) { + // $FlowFixMe[method-unbinding] + var name = Object.prototype.toString.call(object); + return name.replace(/^\[object (.*)\]$/, function (m, p0) { + return p0; + }); + } + + function describeKeyForErrorMessage(key) { + var encodedKey = JSON.stringify(key); + return '"' + key + '"' === encodedKey ? key : encodedKey; + } + + function describeValueForErrorMessage(value) { + switch (typeof value) { + case "string": { + return JSON.stringify( + value.length <= 10 ? value : value.slice(0, 10) + "..." + ); + } + + case "object": { + if (isArray(value)) { + return "[...]"; + } + + var name = objectName(value); + + if (name === "Object") { + return "{...}"; + } + + return name; + } + + case "function": + return "function"; + + default: + // eslint-disable-next-line react-internal/safe-string-coercion + return String(value); + } + } + + function describeElementType(type) { + if (typeof type === "string") { + return type; + } + + switch (type) { + case REACT_SUSPENSE_TYPE: + return "Suspense"; + + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + + if (typeof type === "object") { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + return describeElementType(type.render); + + case REACT_MEMO_TYPE: + return describeElementType(type.type); + + case REACT_LAZY_TYPE: { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeElementType(init(payload)); + } catch (x) {} + } + } + } + + return ""; + } + + function describeObjectForErrorMessage(objectOrArray, expandedName) { + var objKind = objectName(objectOrArray); + + if (objKind !== "Object" && objKind !== "Array") { + return objKind; + } + + var str = ""; + var start = -1; + var length = 0; + + if (isArray(objectOrArray)) { + if (jsxChildrenParents.has(objectOrArray)) { + // Print JSX Children + var type = jsxChildrenParents.get(objectOrArray); + str = "<" + describeElementType(type) + ">"; + var array = objectOrArray; + + for (var i = 0; i < array.length; i++) { + var value = array[i]; + var substr = void 0; + + if (typeof value === "string") { + substr = value; + } else if (typeof value === "object" && value !== null) { + substr = "{" + describeObjectForErrorMessage(value) + "}"; + } else { + substr = "{" + describeValueForErrorMessage(value) + "}"; + } + + if ("" + i === expandedName) { + start = str.length; + length = substr.length; + str += substr; + } else if (substr.length < 15 && str.length + substr.length < 40) { + str += substr; + } else { + str += "{...}"; + } + } + + str += ""; + } else { + // Print Array + str = "["; + var _array = objectOrArray; + + for (var _i = 0; _i < _array.length; _i++) { + if (_i > 0) { + str += ", "; + } + + var _value = _array[_i]; + + var _substr = void 0; + + if (typeof _value === "object" && _value !== null) { + _substr = describeObjectForErrorMessage(_value); + } else { + _substr = describeValueForErrorMessage(_value); + } + + if ("" + _i === expandedName) { + start = str.length; + length = _substr.length; + str += _substr; + } else if ( + _substr.length < 10 && + str.length + _substr.length < 40 + ) { + str += _substr; + } else { + str += "..."; + } + } + + str += "]"; + } + } else { + if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) { + str = "<" + describeElementType(objectOrArray.type) + "/>"; + } else if (jsxPropsParents.has(objectOrArray)) { + // Print JSX + var _type = jsxPropsParents.get(objectOrArray); + + str = "<" + (describeElementType(_type) || "..."); + var object = objectOrArray; + var names = Object.keys(object); + + for (var _i2 = 0; _i2 < names.length; _i2++) { + str += " "; + var name = names[_i2]; + str += describeKeyForErrorMessage(name) + "="; + var _value2 = object[name]; + + var _substr2 = void 0; + + if ( + name === expandedName && + typeof _value2 === "object" && + _value2 !== null + ) { + _substr2 = describeObjectForErrorMessage(_value2); + } else { + _substr2 = describeValueForErrorMessage(_value2); + } + + if (typeof _value2 !== "string") { + _substr2 = "{" + _substr2 + "}"; + } + + if (name === expandedName) { + start = str.length; + length = _substr2.length; + str += _substr2; + } else if ( + _substr2.length < 10 && + str.length + _substr2.length < 40 + ) { + str += _substr2; + } else { + str += "..."; + } + } + + str += ">"; + } else { + // Print Object + str = "{"; + var _object = objectOrArray; + + var _names = Object.keys(_object); + + for (var _i3 = 0; _i3 < _names.length; _i3++) { + if (_i3 > 0) { + str += ", "; + } + + var _name = _names[_i3]; + str += describeKeyForErrorMessage(_name) + ": "; + var _value3 = _object[_name]; + + var _substr3 = void 0; + + if (typeof _value3 === "object" && _value3 !== null) { + _substr3 = describeObjectForErrorMessage(_value3); + } else { + _substr3 = describeValueForErrorMessage(_value3); + } + + if (_name === expandedName) { + start = str.length; + length = _substr3.length; + str += _substr3; + } else if ( + _substr3.length < 10 && + str.length + _substr3.length < 40 + ) { + str += _substr3; + } else { + str += "..."; + } + } + + str += "}"; + } + } + + if (expandedName === undefined) { + return str; + } + + if (start > -1 && length > 0) { + var highlight = " ".repeat(start) + "^".repeat(length); + return "\n " + str + "\n " + highlight; + } + + return "\n " + str; + } + // A pure JS implementation of a string hashing function. We do not use it for // security or obfuscation purposes, only to create compact hashes. So we // prioritize speed over collision avoidance. For example, we use this to hash @@ -1995,12 +2309,6 @@ if (__DEV__) { return url; } - var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - - function isArray(a) { - return isArrayImpl(a); - } - // The build script is at scripts/rollup/generate-inline-fizz-runtime.js. // Run `yarn generate-inline-fizz-runtime` to generate. var clientRenderBoundary = @@ -8150,49 +8458,6 @@ if (__DEV__) { } var NotPendingTransition = NotPending; - // ATTENTION - // When adding new symbols to this file, - // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' - // The Symbol used to tag the ReactElement-like types. - var REACT_ELEMENT_TYPE = Symbol.for("react.element"); - var REACT_PORTAL_TYPE = Symbol.for("react.portal"); - var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); - var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); - var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); - var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); // TODO: Delete with enableRenderableContext - - var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); - var REACT_CONTEXT_TYPE = Symbol.for("react.context"); - var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); - var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); - var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); - var REACT_MEMO_TYPE = Symbol.for("react.memo"); - var REACT_LAZY_TYPE = Symbol.for("react.lazy"); - var REACT_SCOPE_TYPE = Symbol.for("react.scope"); - var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"); - var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); - var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"); - var REACT_CACHE_TYPE = Symbol.for("react.cache"); - var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"); - var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = "@@iterator"; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== "object") { - return null; - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === "function") { - return maybeIterator; - } - - return null; - } - function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; @@ -11313,19 +11578,19 @@ if (__DEV__) { boundary.errorDigest = digest; { - // In dev we additionally encode the error message and component stack on the boundary - var errorMessage; + var message; // In dev we additionally encode the error message and component stack on the boundary - if (typeof error === "string") { - errorMessage = error; - } else if (error && typeof error.message === "string") { - errorMessage = error.message; + if (error instanceof Error) { + // eslint-disable-next-line react-internal/safe-string-coercion + message = String(error.message); + } else if (typeof error === "object" && error !== null) { + message = describeObjectForErrorMessage(error); } else { // eslint-disable-next-line react-internal/safe-string-coercion - errorMessage = String(error); + message = String(error); } - boundary.errorMessage = errorMessage; + boundary.errorMessage = message; boundary.errorComponentStack = thrownInfo.componentStack; } } diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index f01c2e85cc6fe..a750cadb4e8ef 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); - var ReactVersion = "18.3.0-www-modern-47a5392e"; + var ReactVersion = "18.3.0-www-modern-40548e7e"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -91,6 +91,320 @@ if (__DEV__) { enableRenderableContext = dynamicFeatureFlags.enableRenderableContext; // On WWW, true is used for a new modern build. var enableFloat = true; + // ATTENTION + // When adding new symbols to this file, + // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' + // The Symbol used to tag the ReactElement-like types. + var REACT_ELEMENT_TYPE = Symbol.for("react.element"); + var REACT_PORTAL_TYPE = Symbol.for("react.portal"); + var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); + var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); + var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); // TODO: Delete with enableRenderableContext + + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); + var REACT_CONTEXT_TYPE = Symbol.for("react.context"); + var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); + var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); + var REACT_MEMO_TYPE = Symbol.for("react.memo"); + var REACT_LAZY_TYPE = Symbol.for("react.lazy"); + var REACT_SCOPE_TYPE = Symbol.for("react.scope"); + var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"); + var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); + var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"); + var REACT_CACHE_TYPE = Symbol.for("react.cache"); + var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"); + var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); + var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = "@@iterator"; + function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== "object") { + return null; + } + + var maybeIterator = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === "function") { + return maybeIterator; + } + + return null; + } + + var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + + function isArray(a) { + return isArrayImpl(a); + } + + // in case they error. + + var jsxPropsParents = new WeakMap(); + var jsxChildrenParents = new WeakMap(); + function objectName(object) { + // $FlowFixMe[method-unbinding] + var name = Object.prototype.toString.call(object); + return name.replace(/^\[object (.*)\]$/, function (m, p0) { + return p0; + }); + } + + function describeKeyForErrorMessage(key) { + var encodedKey = JSON.stringify(key); + return '"' + key + '"' === encodedKey ? key : encodedKey; + } + + function describeValueForErrorMessage(value) { + switch (typeof value) { + case "string": { + return JSON.stringify( + value.length <= 10 ? value : value.slice(0, 10) + "..." + ); + } + + case "object": { + if (isArray(value)) { + return "[...]"; + } + + var name = objectName(value); + + if (name === "Object") { + return "{...}"; + } + + return name; + } + + case "function": + return "function"; + + default: + // eslint-disable-next-line react-internal/safe-string-coercion + return String(value); + } + } + + function describeElementType(type) { + if (typeof type === "string") { + return type; + } + + switch (type) { + case REACT_SUSPENSE_TYPE: + return "Suspense"; + + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + + if (typeof type === "object") { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + return describeElementType(type.render); + + case REACT_MEMO_TYPE: + return describeElementType(type.type); + + case REACT_LAZY_TYPE: { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeElementType(init(payload)); + } catch (x) {} + } + } + } + + return ""; + } + + function describeObjectForErrorMessage(objectOrArray, expandedName) { + var objKind = objectName(objectOrArray); + + if (objKind !== "Object" && objKind !== "Array") { + return objKind; + } + + var str = ""; + var start = -1; + var length = 0; + + if (isArray(objectOrArray)) { + if (jsxChildrenParents.has(objectOrArray)) { + // Print JSX Children + var type = jsxChildrenParents.get(objectOrArray); + str = "<" + describeElementType(type) + ">"; + var array = objectOrArray; + + for (var i = 0; i < array.length; i++) { + var value = array[i]; + var substr = void 0; + + if (typeof value === "string") { + substr = value; + } else if (typeof value === "object" && value !== null) { + substr = "{" + describeObjectForErrorMessage(value) + "}"; + } else { + substr = "{" + describeValueForErrorMessage(value) + "}"; + } + + if ("" + i === expandedName) { + start = str.length; + length = substr.length; + str += substr; + } else if (substr.length < 15 && str.length + substr.length < 40) { + str += substr; + } else { + str += "{...}"; + } + } + + str += ""; + } else { + // Print Array + str = "["; + var _array = objectOrArray; + + for (var _i = 0; _i < _array.length; _i++) { + if (_i > 0) { + str += ", "; + } + + var _value = _array[_i]; + + var _substr = void 0; + + if (typeof _value === "object" && _value !== null) { + _substr = describeObjectForErrorMessage(_value); + } else { + _substr = describeValueForErrorMessage(_value); + } + + if ("" + _i === expandedName) { + start = str.length; + length = _substr.length; + str += _substr; + } else if ( + _substr.length < 10 && + str.length + _substr.length < 40 + ) { + str += _substr; + } else { + str += "..."; + } + } + + str += "]"; + } + } else { + if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) { + str = "<" + describeElementType(objectOrArray.type) + "/>"; + } else if (jsxPropsParents.has(objectOrArray)) { + // Print JSX + var _type = jsxPropsParents.get(objectOrArray); + + str = "<" + (describeElementType(_type) || "..."); + var object = objectOrArray; + var names = Object.keys(object); + + for (var _i2 = 0; _i2 < names.length; _i2++) { + str += " "; + var name = names[_i2]; + str += describeKeyForErrorMessage(name) + "="; + var _value2 = object[name]; + + var _substr2 = void 0; + + if ( + name === expandedName && + typeof _value2 === "object" && + _value2 !== null + ) { + _substr2 = describeObjectForErrorMessage(_value2); + } else { + _substr2 = describeValueForErrorMessage(_value2); + } + + if (typeof _value2 !== "string") { + _substr2 = "{" + _substr2 + "}"; + } + + if (name === expandedName) { + start = str.length; + length = _substr2.length; + str += _substr2; + } else if ( + _substr2.length < 10 && + str.length + _substr2.length < 40 + ) { + str += _substr2; + } else { + str += "..."; + } + } + + str += ">"; + } else { + // Print Object + str = "{"; + var _object = objectOrArray; + + var _names = Object.keys(_object); + + for (var _i3 = 0; _i3 < _names.length; _i3++) { + if (_i3 > 0) { + str += ", "; + } + + var _name = _names[_i3]; + str += describeKeyForErrorMessage(_name) + ": "; + var _value3 = _object[_name]; + + var _substr3 = void 0; + + if (typeof _value3 === "object" && _value3 !== null) { + _substr3 = describeObjectForErrorMessage(_value3); + } else { + _substr3 = describeValueForErrorMessage(_value3); + } + + if (_name === expandedName) { + start = str.length; + length = _substr3.length; + str += _substr3; + } else if ( + _substr3.length < 10 && + str.length + _substr3.length < 40 + ) { + str += _substr3; + } else { + str += "..."; + } + } + + str += "}"; + } + } + + if (expandedName === undefined) { + return str; + } + + if (start > -1 && length > 0) { + var highlight = " ".repeat(start) + "^".repeat(length); + return "\n " + str + "\n " + highlight; + } + + return "\n " + str; + } + // A pure JS implementation of a string hashing function. We do not use it for // security or obfuscation purposes, only to create compact hashes. So we // prioritize speed over collision avoidance. For example, we use this to hash @@ -1995,12 +2309,6 @@ if (__DEV__) { return url; } - var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - - function isArray(a) { - return isArrayImpl(a); - } - // The build script is at scripts/rollup/generate-inline-fizz-runtime.js. // Run `yarn generate-inline-fizz-runtime` to generate. var clientRenderBoundary = @@ -8150,49 +8458,6 @@ if (__DEV__) { } var NotPendingTransition = NotPending; - // ATTENTION - // When adding new symbols to this file, - // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' - // The Symbol used to tag the ReactElement-like types. - var REACT_ELEMENT_TYPE = Symbol.for("react.element"); - var REACT_PORTAL_TYPE = Symbol.for("react.portal"); - var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); - var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); - var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); - var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); // TODO: Delete with enableRenderableContext - - var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); - var REACT_CONTEXT_TYPE = Symbol.for("react.context"); - var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); - var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); - var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); - var REACT_MEMO_TYPE = Symbol.for("react.memo"); - var REACT_LAZY_TYPE = Symbol.for("react.lazy"); - var REACT_SCOPE_TYPE = Symbol.for("react.scope"); - var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"); - var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); - var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"); - var REACT_CACHE_TYPE = Symbol.for("react.cache"); - var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"); - var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = "@@iterator"; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== "object") { - return null; - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === "function") { - return maybeIterator; - } - - return null; - } - function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; @@ -11058,19 +11323,19 @@ if (__DEV__) { boundary.errorDigest = digest; { - // In dev we additionally encode the error message and component stack on the boundary - var errorMessage; + var message; // In dev we additionally encode the error message and component stack on the boundary - if (typeof error === "string") { - errorMessage = error; - } else if (error && typeof error.message === "string") { - errorMessage = error.message; + if (error instanceof Error) { + // eslint-disable-next-line react-internal/safe-string-coercion + message = String(error.message); + } else if (typeof error === "object" && error !== null) { + message = describeObjectForErrorMessage(error); } else { // eslint-disable-next-line react-internal/safe-string-coercion - errorMessage = String(error); + message = String(error); } - boundary.errorMessage = errorMessage; + boundary.errorMessage = message; boundary.errorComponentStack = thrownInfo.componentStack; } } diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 32ff2d09f2488..24616aeea19d1 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -56,7 +56,29 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, enableUseDeferredValueInitialArg = dynamicFeatureFlags.enableUseDeferredValueInitialArg, - enableRenderableContext = dynamicFeatureFlags.enableRenderableContext; + enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, + REACT_ELEMENT_TYPE = Symbol.for("react.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_PROVIDER_TYPE = Symbol.for("react.provider"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_SCOPE_TYPE = Symbol.for("react.scope"), + REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"), + REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), + REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), + REACT_CACHE_TYPE = Symbol.for("react.cache"), + REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"), + REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator, + isArrayImpl = Array.isArray; function murmurhash3_32_gc(key, seed) { var remainder = key.length & 3; var bytes = key.length - remainder; @@ -257,8 +279,7 @@ function sanitizeURL(url) { ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url; } -var isArrayImpl = Array.isArray, - ReactSharedInternals = +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, sharedNotPendingObject = { pending: !1, @@ -2711,28 +2732,7 @@ function pushTextInstance(target, text, renderState, textEmbedded) { (target = !0)); return target; } -var REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_PORTAL_TYPE = Symbol.for("react.portal"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), - REACT_PROFILER_TYPE = Symbol.for("react.profiler"), - REACT_PROVIDER_TYPE = Symbol.for("react.provider"), - REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), - REACT_CONTEXT_TYPE = Symbol.for("react.context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_SCOPE_TYPE = Symbol.for("react.scope"), - REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"), - REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), - REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), - REACT_CACHE_TYPE = Symbol.for("react.cache"), - REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"), - REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator, - REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); +var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) @@ -5675,4 +5675,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-classic-fdd22236"; +exports.version = "18.3.0-www-classic-14b4f2b8"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index 523829c7fb6bb..e4aada38fcc17 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -56,7 +56,29 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, enableUseDeferredValueInitialArg = dynamicFeatureFlags.enableUseDeferredValueInitialArg, - enableRenderableContext = dynamicFeatureFlags.enableRenderableContext; + enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, + REACT_ELEMENT_TYPE = Symbol.for("react.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_PROVIDER_TYPE = Symbol.for("react.provider"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_SCOPE_TYPE = Symbol.for("react.scope"), + REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"), + REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), + REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), + REACT_CACHE_TYPE = Symbol.for("react.cache"), + REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"), + REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator, + isArrayImpl = Array.isArray; function murmurhash3_32_gc(key, seed) { var remainder = key.length & 3; var bytes = key.length - remainder; @@ -257,8 +279,7 @@ function sanitizeURL(url) { ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url; } -var isArrayImpl = Array.isArray, - ReactSharedInternals = +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, sharedNotPendingObject = { pending: !1, @@ -2711,28 +2732,7 @@ function pushTextInstance(target, text, renderState, textEmbedded) { (target = !0)); return target; } -var REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_PORTAL_TYPE = Symbol.for("react.portal"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), - REACT_PROFILER_TYPE = Symbol.for("react.profiler"), - REACT_PROVIDER_TYPE = Symbol.for("react.provider"), - REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), - REACT_CONTEXT_TYPE = Symbol.for("react.context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_SCOPE_TYPE = Symbol.for("react.scope"), - REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"), - REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), - REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), - REACT_CACHE_TYPE = Symbol.for("react.cache"), - REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"), - REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator, - REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); +var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) @@ -5634,4 +5634,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-modern-09a944cd"; +exports.version = "18.3.0-www-modern-aad78460"; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js index 0899d41be050b..53089177a9bfd 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js @@ -89,6 +89,320 @@ if (__DEV__) { enableRenderableContext = dynamicFeatureFlags.enableRenderableContext; // On WWW, true is used for a new modern build. var enableFloat = true; + // ATTENTION + // When adding new symbols to this file, + // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' + // The Symbol used to tag the ReactElement-like types. + var REACT_ELEMENT_TYPE = Symbol.for("react.element"); + var REACT_PORTAL_TYPE = Symbol.for("react.portal"); + var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); + var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); + var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); // TODO: Delete with enableRenderableContext + + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); + var REACT_CONTEXT_TYPE = Symbol.for("react.context"); + var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); + var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); + var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); + var REACT_MEMO_TYPE = Symbol.for("react.memo"); + var REACT_LAZY_TYPE = Symbol.for("react.lazy"); + var REACT_SCOPE_TYPE = Symbol.for("react.scope"); + var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"); + var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); + var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"); + var REACT_CACHE_TYPE = Symbol.for("react.cache"); + var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"); + var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); + var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = "@@iterator"; + function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== "object") { + return null; + } + + var maybeIterator = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === "function") { + return maybeIterator; + } + + return null; + } + + var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + + function isArray(a) { + return isArrayImpl(a); + } + + // in case they error. + + var jsxPropsParents = new WeakMap(); + var jsxChildrenParents = new WeakMap(); + function objectName(object) { + // $FlowFixMe[method-unbinding] + var name = Object.prototype.toString.call(object); + return name.replace(/^\[object (.*)\]$/, function (m, p0) { + return p0; + }); + } + + function describeKeyForErrorMessage(key) { + var encodedKey = JSON.stringify(key); + return '"' + key + '"' === encodedKey ? key : encodedKey; + } + + function describeValueForErrorMessage(value) { + switch (typeof value) { + case "string": { + return JSON.stringify( + value.length <= 10 ? value : value.slice(0, 10) + "..." + ); + } + + case "object": { + if (isArray(value)) { + return "[...]"; + } + + var name = objectName(value); + + if (name === "Object") { + return "{...}"; + } + + return name; + } + + case "function": + return "function"; + + default: + // eslint-disable-next-line react-internal/safe-string-coercion + return String(value); + } + } + + function describeElementType(type) { + if (typeof type === "string") { + return type; + } + + switch (type) { + case REACT_SUSPENSE_TYPE: + return "Suspense"; + + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + + if (typeof type === "object") { + switch (type.$$typeof) { + case REACT_FORWARD_REF_TYPE: + return describeElementType(type.render); + + case REACT_MEMO_TYPE: + return describeElementType(type.type); + + case REACT_LAZY_TYPE: { + var lazyComponent = type; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeElementType(init(payload)); + } catch (x) {} + } + } + } + + return ""; + } + + function describeObjectForErrorMessage(objectOrArray, expandedName) { + var objKind = objectName(objectOrArray); + + if (objKind !== "Object" && objKind !== "Array") { + return objKind; + } + + var str = ""; + var start = -1; + var length = 0; + + if (isArray(objectOrArray)) { + if (jsxChildrenParents.has(objectOrArray)) { + // Print JSX Children + var type = jsxChildrenParents.get(objectOrArray); + str = "<" + describeElementType(type) + ">"; + var array = objectOrArray; + + for (var i = 0; i < array.length; i++) { + var value = array[i]; + var substr = void 0; + + if (typeof value === "string") { + substr = value; + } else if (typeof value === "object" && value !== null) { + substr = "{" + describeObjectForErrorMessage(value) + "}"; + } else { + substr = "{" + describeValueForErrorMessage(value) + "}"; + } + + if ("" + i === expandedName) { + start = str.length; + length = substr.length; + str += substr; + } else if (substr.length < 15 && str.length + substr.length < 40) { + str += substr; + } else { + str += "{...}"; + } + } + + str += ""; + } else { + // Print Array + str = "["; + var _array = objectOrArray; + + for (var _i = 0; _i < _array.length; _i++) { + if (_i > 0) { + str += ", "; + } + + var _value = _array[_i]; + + var _substr = void 0; + + if (typeof _value === "object" && _value !== null) { + _substr = describeObjectForErrorMessage(_value); + } else { + _substr = describeValueForErrorMessage(_value); + } + + if ("" + _i === expandedName) { + start = str.length; + length = _substr.length; + str += _substr; + } else if ( + _substr.length < 10 && + str.length + _substr.length < 40 + ) { + str += _substr; + } else { + str += "..."; + } + } + + str += "]"; + } + } else { + if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) { + str = "<" + describeElementType(objectOrArray.type) + "/>"; + } else if (jsxPropsParents.has(objectOrArray)) { + // Print JSX + var _type = jsxPropsParents.get(objectOrArray); + + str = "<" + (describeElementType(_type) || "..."); + var object = objectOrArray; + var names = Object.keys(object); + + for (var _i2 = 0; _i2 < names.length; _i2++) { + str += " "; + var name = names[_i2]; + str += describeKeyForErrorMessage(name) + "="; + var _value2 = object[name]; + + var _substr2 = void 0; + + if ( + name === expandedName && + typeof _value2 === "object" && + _value2 !== null + ) { + _substr2 = describeObjectForErrorMessage(_value2); + } else { + _substr2 = describeValueForErrorMessage(_value2); + } + + if (typeof _value2 !== "string") { + _substr2 = "{" + _substr2 + "}"; + } + + if (name === expandedName) { + start = str.length; + length = _substr2.length; + str += _substr2; + } else if ( + _substr2.length < 10 && + str.length + _substr2.length < 40 + ) { + str += _substr2; + } else { + str += "..."; + } + } + + str += ">"; + } else { + // Print Object + str = "{"; + var _object = objectOrArray; + + var _names = Object.keys(_object); + + for (var _i3 = 0; _i3 < _names.length; _i3++) { + if (_i3 > 0) { + str += ", "; + } + + var _name = _names[_i3]; + str += describeKeyForErrorMessage(_name) + ": "; + var _value3 = _object[_name]; + + var _substr3 = void 0; + + if (typeof _value3 === "object" && _value3 !== null) { + _substr3 = describeObjectForErrorMessage(_value3); + } else { + _substr3 = describeValueForErrorMessage(_value3); + } + + if (_name === expandedName) { + start = str.length; + length = _substr3.length; + str += _substr3; + } else if ( + _substr3.length < 10 && + str.length + _substr3.length < 40 + ) { + str += _substr3; + } else { + str += "..."; + } + } + + str += "}"; + } + } + + if (expandedName === undefined) { + return str; + } + + if (start > -1 && length > 0) { + var highlight = " ".repeat(start) + "^".repeat(length); + return "\n " + str + "\n " + highlight; + } + + return "\n " + str; + } + // A pure JS implementation of a string hashing function. We do not use it for // security or obfuscation purposes, only to create compact hashes. So we // prioritize speed over collision avoidance. For example, we use this to hash @@ -1992,12 +2306,6 @@ if (__DEV__) { return url; } - var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - - function isArray(a) { - return isArrayImpl(a); - } - // The build script is at scripts/rollup/generate-inline-fizz-runtime.js. // Run `yarn generate-inline-fizz-runtime` to generate. var clientRenderBoundary = @@ -8034,49 +8342,6 @@ if (__DEV__) { } var NotPendingTransition = NotPending; - // ATTENTION - // When adding new symbols to this file, - // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' - // The Symbol used to tag the ReactElement-like types. - var REACT_ELEMENT_TYPE = Symbol.for("react.element"); - var REACT_PORTAL_TYPE = Symbol.for("react.portal"); - var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); - var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); - var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); - var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); // TODO: Delete with enableRenderableContext - - var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"); - var REACT_CONTEXT_TYPE = Symbol.for("react.context"); - var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); - var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); - var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); - var REACT_MEMO_TYPE = Symbol.for("react.memo"); - var REACT_LAZY_TYPE = Symbol.for("react.lazy"); - var REACT_SCOPE_TYPE = Symbol.for("react.scope"); - var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"); - var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); - var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"); - var REACT_CACHE_TYPE = Symbol.for("react.cache"); - var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"); - var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = "@@iterator"; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== "object") { - return null; - } - - var maybeIterator = - (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || - maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === "function") { - return maybeIterator; - } - - return null; - } - function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; @@ -10939,19 +11204,19 @@ if (__DEV__) { boundary.errorDigest = digest; { - // In dev we additionally encode the error message and component stack on the boundary - var errorMessage; + var message; // In dev we additionally encode the error message and component stack on the boundary - if (typeof error === "string") { - errorMessage = error; - } else if (error && typeof error.message === "string") { - errorMessage = error.message; + if (error instanceof Error) { + // eslint-disable-next-line react-internal/safe-string-coercion + message = String(error.message); + } else if (typeof error === "object" && error !== null) { + message = describeObjectForErrorMessage(error); } else { // eslint-disable-next-line react-internal/safe-string-coercion - errorMessage = String(error); + message = String(error); } - boundary.errorMessage = errorMessage; + boundary.errorMessage = message; boundary.errorComponentStack = thrownInfo.componentStack; } } diff --git a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js index 16ae162e9d33e..58d910df2ed64 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js @@ -41,7 +41,29 @@ var React = require("react"), enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, enableUseDeferredValueInitialArg = dynamicFeatureFlags.enableUseDeferredValueInitialArg, - enableRenderableContext = dynamicFeatureFlags.enableRenderableContext; + enableRenderableContext = dynamicFeatureFlags.enableRenderableContext, + REACT_ELEMENT_TYPE = Symbol.for("react.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"), + REACT_PROVIDER_TYPE = Symbol.for("react.provider"), + REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), + REACT_CONTEXT_TYPE = Symbol.for("react.context"), + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), + REACT_MEMO_TYPE = Symbol.for("react.memo"), + REACT_LAZY_TYPE = Symbol.for("react.lazy"), + REACT_SCOPE_TYPE = Symbol.for("react.scope"), + REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"), + REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), + REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), + REACT_CACHE_TYPE = Symbol.for("react.cache"), + REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"), + REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), + MAYBE_ITERATOR_SYMBOL = Symbol.iterator, + isArrayImpl = Array.isArray; function murmurhash3_32_gc(key, seed) { var remainder = key.length & 3; var bytes = key.length - remainder; @@ -249,8 +271,7 @@ function sanitizeURL(url) { ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : url; } -var isArrayImpl = Array.isArray, - ReactSharedInternals = +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, sharedNotPendingObject = { pending: !1, @@ -2571,28 +2592,7 @@ function hoistStyleQueueDependency(styleQueue) { function hoistStylesheetDependency(stylesheet) { this.stylesheets.add(stylesheet); } -var REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_PORTAL_TYPE = Symbol.for("react.portal"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), - REACT_PROFILER_TYPE = Symbol.for("react.profiler"), - REACT_PROVIDER_TYPE = Symbol.for("react.provider"), - REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), - REACT_CONTEXT_TYPE = Symbol.for("react.context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_SCOPE_TYPE = Symbol.for("react.scope"), - REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode"), - REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"), - REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden"), - REACT_CACHE_TYPE = Symbol.for("react.cache"), - REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"), - REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), - MAYBE_ITERATOR_SYMBOL = Symbol.iterator, - REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); +var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 2a5687de9eb09..c1ac8fea1fb83 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -17080,7 +17080,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1789 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-f74843f1", + version: "18.3.0-www-modern-0aa4491b", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2160 = { @@ -17111,7 +17111,7 @@ var internals$jscomp$inline_2160 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-f74843f1" + reconcilerVersion: "18.3.0-www-modern-0aa4491b" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2161 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17532,4 +17532,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); }; -exports.version = "18.3.0-www-modern-f74843f1"; +exports.version = "18.3.0-www-modern-0aa4491b"; diff --git a/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js b/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js index 5817b57183661..95333856072ed 100644 --- a/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactFlightDOMServer-dev.modern.js @@ -2336,10 +2336,10 @@ if (__DEV__) { stack = String(error.stack); } else if (typeof error === "object" && error !== null) { - message = "Error: " + describeObjectForErrorMessage(error); + message = describeObjectForErrorMessage(error); } else { // eslint-disable-next-line react-internal/safe-string-coercion - message = "Error: " + String(error); + message = String(error); } } catch (x) { message =