From 6d769d0eb80e9a706ac93f36a0afc75d60e5dd9f Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 23 Aug 2023 00:27:54 +0200 Subject: [PATCH] Upgrade vendored react (#54399) ### React upstream changes - https://github.com/facebook/react/pull/27265 - https://github.com/facebook/react/pull/27259 - https://github.com/facebook/react/pull/27264 - https://github.com/facebook/react/pull/27257 - https://github.com/facebook/react/pull/27258 - https://github.com/facebook/react/pull/27187 - https://github.com/facebook/react/pull/27243 - https://github.com/facebook/react/pull/27205 - https://github.com/facebook/react/pull/27220 - https://github.com/facebook/react/pull/27238 - https://github.com/facebook/react/pull/27234 - https://github.com/facebook/react/pull/27224 - https://github.com/facebook/react/pull/27223 - https://github.com/facebook/react/pull/27222 This will help unblock https://github.com/vercel/next.js/pull/53906 --- package.json | 16 +- ...t-dom-server-legacy.browser.development.js | 848 +++++------------ ...om-server-legacy.browser.production.min.js | 255 +++--- ...eact-dom-server-legacy.node.development.js | 862 ++++++------------ ...t-dom-server-legacy.node.production.min.js | 271 +++--- ...t-dom-server-rendering-stub.development.js | 2 +- ...om-server-rendering-stub.production.min.js | 2 +- .../react-dom-server.browser.development.js | 849 +++++------------ ...react-dom-server.browser.production.min.js | 264 +++--- .../cjs/react-dom-server.edge.development.js | 849 +++++------------ .../react-dom-server.edge.production.min.js | 284 +++--- .../cjs/react-dom-server.node.development.js | 849 +++++------------ .../react-dom-server.node.production.min.js | 272 +++--- .../react-dom-static.browser.development.js | 849 +++++------------ ...react-dom-static.browser.production.min.js | 264 +++--- .../cjs/react-dom-static.edge.development.js | 849 +++++------------ .../react-dom-static.edge.production.min.js | 267 +++--- .../cjs/react-dom-static.node.development.js | 849 +++++------------ .../react-dom-static.node.production.min.js | 280 +++--- .../react-dom-unstable_testing.development.js | 597 ++++++++---- ...act-dom-unstable_testing.production.min.js | 813 +++++++++-------- .../cjs/react-dom.development.js | 597 ++++++++---- .../cjs/react-dom.production.min.js | 780 ++++++++-------- .../cjs/react-dom.profiling.min.js | 823 ++++++++--------- .../react-dom-experimental/package.json | 4 +- ...t-dom-server-legacy.browser.development.js | 831 +++++------------ ...om-server-legacy.browser.production.min.js | 243 ++--- ...eact-dom-server-legacy.node.development.js | 845 +++++------------ ...t-dom-server-legacy.node.production.min.js | 265 +++--- ...t-dom-server-rendering-stub.development.js | 2 +- ...om-server-rendering-stub.production.min.js | 2 +- .../react-dom-server.browser.development.js | 831 +++++------------ ...react-dom-server.browser.production.min.js | 262 +++--- .../cjs/react-dom-server.edge.development.js | 831 +++++------------ .../react-dom-server.edge.production.min.js | 274 +++--- .../cjs/react-dom-server.node.development.js | 831 +++++------------ .../react-dom-server.node.production.min.js | 268 +++--- .../react-dom/cjs/react-dom.development.js | 590 ++++++++---- .../react-dom/cjs/react-dom.production.min.js | 557 +++++------ .../react-dom/cjs/react-dom.profiling.min.js | 595 ++++++------ .../next/src/compiled/react-dom/package.json | 4 +- .../cjs/react.development.js | 11 +- .../cjs/react.production.min.js | 21 +- .../cjs/react.shared-subset.development.js | 11 +- .../cjs/react.shared-subset.production.min.js | 20 +- ...-dom-webpack-client.browser.development.js | 49 + ...m-webpack-client.browser.production.min.js | 46 +- ...ver-dom-webpack-client.edge.development.js | 49 + ...-dom-webpack-client.edge.production.min.js | 46 +- ...ver-dom-webpack-client.node.development.js | 49 + ...-dom-webpack-client.node.production.min.js | 58 +- ...bpack-client.node.unbundled.development.js | 49 + ...ck-client.node.unbundled.production.min.js | 53 +- ...-dom-webpack-server.browser.development.js | 378 ++++---- ...m-webpack-server.browser.production.min.js | 122 +-- ...ver-dom-webpack-server.edge.development.js | 378 ++++---- ...-dom-webpack-server.edge.production.min.js | 124 +-- ...ver-dom-webpack-server.node.development.js | 378 ++++---- ...-dom-webpack-server.node.production.min.js | 128 +-- ...bpack-server.node.unbundled.development.js | 378 ++++---- ...ck-server.node.unbundled.production.min.js | 123 +-- .../package.json | 4 +- ...-dom-webpack-client.browser.development.js | 21 + ...m-webpack-client.browser.production.min.js | 8 +- ...ver-dom-webpack-client.edge.development.js | 21 + ...-dom-webpack-client.edge.production.min.js | 7 +- ...ver-dom-webpack-client.node.development.js | 21 + ...-dom-webpack-client.node.production.min.js | 2 +- ...bpack-client.node.unbundled.development.js | 21 + ...ck-client.node.unbundled.production.min.js | 2 +- ...-dom-webpack-server.browser.development.js | 317 ++++--- ...m-webpack-server.browser.production.min.js | 110 +-- ...ver-dom-webpack-server.edge.development.js | 317 ++++--- ...-dom-webpack-server.edge.production.min.js | 110 +-- ...ver-dom-webpack-server.node.development.js | 317 ++++--- ...-dom-webpack-server.node.production.min.js | 124 +-- ...bpack-server.node.unbundled.development.js | 317 ++++--- ...ck-server.node.unbundled.production.min.js | 119 +-- .../react-server-dom-webpack/package.json | 4 +- .../compiled/react/cjs/react.development.js | 2 +- .../react/cjs/react.production.min.js | 2 +- .../cjs/react.shared-subset.development.js | 2 +- .../cjs/react.shared-subset.production.min.js | 2 +- pnpm-lock.yaml | 80 +- 84 files changed, 10336 insertions(+), 13891 deletions(-) diff --git a/package.json b/package.json index 6967df7dd78a5..867a9d10d3f91 100644 --- a/package.json +++ b/package.json @@ -191,14 +191,14 @@ "random-seed": "0.3.0", "react": "18.2.0", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@18.3.0-canary-1a001dac6-20230812", + "react-builtin": "npm:react@18.3.0-canary-dd480ef92-20230822", "react-dom": "18.2.0", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@18.3.0-canary-1a001dac6-20230812", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-1a001dac6-20230812", - "react-experimental-builtin": "npm:react@0.0.0-experimental-1a001dac6-20230812", - "react-server-dom-webpack": "18.3.0-canary-1a001dac6-20230812", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-1a001dac6-20230812", + "react-dom-builtin": "npm:react-dom@18.3.0-canary-dd480ef92-20230822", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-dd480ef92-20230822", + "react-experimental-builtin": "npm:react@0.0.0-experimental-dd480ef92-20230822", + "react-server-dom-webpack": "18.3.0-canary-dd480ef92-20230822", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-dd480ef92-20230822", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -208,8 +208,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.10.1", - "scheduler-builtin": "npm:scheduler@0.24.0-canary-1a001dac6-20230812", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-1a001dac6-20230812", + "scheduler-builtin": "npm:scheduler@0.24.0-canary-dd480ef92-20230822", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-dd480ef92-20230822", "seedrandom": "3.0.5", "selenium-webdriver": "4.0.0-beta.4", "semver": "7.3.7", diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js index 055384d027a6d..15a3a5bd195b2 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js @@ -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-1a001dac6-20230812'; +var ReactVersion = '18.3.0-experimental-dd480ef92-20230822'; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; @@ -102,21 +102,6 @@ function closeWithError(destination, error) { destination.destroy(error); } -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - var assign = Object.assign; /* @@ -1530,303 +1515,6 @@ function getValueDescriptorExpectingEnumForWarning(thing) { return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : typeof thing === 'string' ? JSON.stringify(thing) : "something with type \"" + typeof thing + "\""; } -function compareResourcePropsForWarning(newProps, currentProps) { - { - var propDiffs = null; - var allProps = Array.from(new Set(Object.keys(currentProps).concat(Object.keys(newProps)))); - - for (var i = 0; i < allProps.length; i++) { - var propName = allProps[i]; - var newValue = newProps[propName]; - var currentValue = currentProps[propName]; - - if (newValue !== currentValue && !(newValue == null && currentValue == null)) { - if (newValue == null) { - if (propDiffs === null) { - propDiffs = { - missing: {}, - extra: {}, - different: {} - }; - } - - propDiffs.missing[propName] = currentValue; - } else if (currentValue == null) { - if (propDiffs === null) { - propDiffs = { - missing: {}, - extra: {}, - different: {} - }; - } - - propDiffs.extra[propName] = newValue; - } else { - if (propDiffs === null) { - propDiffs = { - missing: {}, - extra: {}, - different: {} - }; - } - - propDiffs.different[propName] = { - original: currentValue, - latest: newValue - }; - } - } - } - - return propDiffs; - } -} - -function describeDifferencesForStylesheets(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.missing) { - var propValue = diff.missing[propName]; - - if (propName === 'media') { - description += "\n \"" + propName + "\" missing for props, original value: " + getValueDescriptorExpectingEnumForWarning(propValue); - } - } - - for (var _propName in diff.extra) { - var _propValue = diff.extra[_propName]; - description += "\n \"" + _propName + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(_propValue) + ", missing from original props"; - } - - for (var _propName2 in diff.different) { - var latestValue = diff.different[_propName2].latest; - var originalValue = diff.different[_propName2].original; - description += "\n \"" + _propName2 + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", original value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - - return description; -} -function describeDifferencesForStylesheetOverPreinit(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.extra) { - var propValue = diff.extra[propName]; - - if (propName === 'precedence' || propName === 'crossOrigin' || propName === 'integrity') { - description += "\n \"" + propName + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(propValue) + ", option missing"; - } else { - description += "\n \"" + propName + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(propValue) + ", option not available with ReactDOM.preinit()"; - } - } - - for (var _propName3 in diff.different) { - var latestValue = diff.different[_propName3].latest; - var originalValue = diff.different[_propName3].original; - - if (_propName3 === 'precedence' && originalValue === 'default') { - description += "\n \"" + _propName3 + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", missing from options"; - } else { - description += "\n \"" + _propName3 + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", option value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - } - - return description; -} -function describeDifferencesForPreinitOverStylesheet(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.missing) { - var propValue = diff.missing[propName]; - - if (propName === 'precedence' && propValue !== 'default') { - description += "\n \"" + propName + "\" missing from options, prop value: " + getValueDescriptorExpectingEnumForWarning(propValue); - } - } - - for (var _propName4 in diff.extra) { - var _propValue2 = diff.extra[_propName4]; - - if (_propName4 === 'precedence' || _propName4 === 'crossOrigin' || _propName4 === 'integrity') { - description += "\n \"" + _propName4 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(_propValue2) + ", missing from props"; - } - } - - for (var _propName5 in diff.different) { - var latestValue = diff.different[_propName5].latest; - var originalValue = diff.different[_propName5].original; - description += "\n \"" + _propName5 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", prop value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - - return description; -} -function describeDifferencesForPreinits(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.missing) { - var propValue = diff.missing[propName]; - - if (propName === 'precedence' && propValue !== 'default') { - description += "\n \"" + propName + "\" missing from options, original option value: " + getValueDescriptorExpectingEnumForWarning(propValue); - } - } - - for (var _propName6 in diff.extra) { - var _propValue3 = diff.extra[_propName6]; - - if (_propName6 === 'precedence' && _propValue3 !== 'default' || _propName6 === 'crossOrigin' || _propName6 === 'integrity') { - description += "\n \"" + _propName6 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(_propValue3) + ", missing from original options"; - } - } - - for (var _propName7 in diff.different) { - var latestValue = diff.different[_propName7].latest; - var originalValue = diff.different[_propName7].original; - description += "\n \"" + _propName7 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", original option value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - - return description; -} -var preloadOptionsForComparison = ['as', 'crossOrigin', 'integrity', 'media']; -function describeDifferencesForPreloads(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.missing) { - var propValue = diff.missing[propName]; - - if (preloadOptionsForComparison.includes(propName)) { - description += "\n \"" + propName + "\" missing from options, original option value: " + getValueDescriptorExpectingEnumForWarning(propValue); - } - } - - for (var _propName8 in diff.extra) { - var _propValue4 = diff.extra[_propName8]; - - if (preloadOptionsForComparison.includes(_propName8)) { - description += "\n \"" + _propName8 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(_propValue4) + ", missing from original options"; - } - } - - for (var _propName9 in diff.different) { - var latestValue = diff.different[_propName9].latest; - var originalValue = diff.different[_propName9].original; - - if (preloadOptionsForComparison.includes(_propName9)) { - description += "\n \"" + _propName9 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", original option value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - } - - return description; -} -function describeDifferencesForPreloadOverImplicitPreload(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.missing) { - var propValue = diff.missing[propName]; - - if (preloadOptionsForComparison.includes(propName)) { - description += "\n \"" + propName + "\" missing from options, underlying prop value: " + getValueDescriptorExpectingEnumForWarning(propValue); - } - } - - for (var _propName10 in diff.extra) { - var _propValue5 = diff.extra[_propName10]; - - if (preloadOptionsForComparison.includes(_propName10)) { - description += "\n \"" + _propName10 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(_propValue5) + ", missing from underlying props"; - } - } - - for (var _propName11 in diff.different) { - var latestValue = diff.different[_propName11].latest; - var originalValue = diff.different[_propName11].original; - - if (preloadOptionsForComparison.includes(_propName11)) { - description += "\n \"" + _propName11 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", underlying prop value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - } - - return description; -} -function describeDifferencesForScripts(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.missing) { - var propValue = diff.missing[propName]; - description += "\n \"" + propName + "\" missing for props, original value: " + getValueDescriptorExpectingEnumForWarning(propValue); - } - - for (var _propName12 in diff.extra) { - var _propValue6 = diff.extra[_propName12]; - description += "\n \"" + _propName12 + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(_propValue6) + ", missing from original props"; - } - - for (var _propName13 in diff.different) { - var latestValue = diff.different[_propName13].latest; - var originalValue = diff.different[_propName13].original; - description += "\n \"" + _propName13 + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", original value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - - return description; -} -function describeDifferencesForScriptOverPreinit(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.extra) { - var propValue = diff.extra[propName]; - - if (propName === 'crossOrigin' || propName === 'integrity') { - description += "\n \"" + propName + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(propValue) + ", option missing"; - } else { - description += "\n \"" + propName + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(propValue) + ", option not available with ReactDOM.preinit()"; - } - } - - for (var _propName14 in diff.different) { - var latestValue = diff.different[_propName14].latest; - var originalValue = diff.different[_propName14].original; - description += "\n \"" + _propName14 + "\" prop value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", option value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - - return description; -} -function describeDifferencesForPreinitOverScript(newProps, currentProps) { - var diff = compareResourcePropsForWarning(newProps, currentProps); - if (!diff) return ''; - var description = ''; - - for (var propName in diff.extra) { - var propValue = diff.extra[propName]; - - if (propName === 'crossOrigin' || propName === 'integrity') { - description += "\n \"" + propName + "\" option value: " + getValueDescriptorExpectingEnumForWarning(propValue) + ", missing from props"; - } - } - - for (var _propName15 in diff.different) { - var latestValue = diff.different[_propName15].latest; - var originalValue = diff.different[_propName15].original; - description += "\n \"" + _propName15 + "\" option value: " + getValueDescriptorExpectingEnumForWarning(latestValue) + ", prop value: " + getValueDescriptorExpectingEnumForWarning(originalValue); - } - - return description; -} - // same object across all transitions. var sharedNotPendingObject = { @@ -1844,7 +1532,9 @@ var ReactDOMServerDispatcher = { prefetchDNS: prefetchDNS, preconnect: preconnect, preload: preload, - preinit: preinit + preloadModule: preloadModule, + preinit: preinit, + preinitModule: preinitModule }; function prepareHostDispatcher() { ReactDOMCurrentDispatcher.current = ReactDOMServerDispatcher; @@ -3384,38 +3074,6 @@ function pushLink(target, props, responseState, resources, textEmbedded, inserti // This stylesheet refers to a Resource and we create a new one if necessary var resource = resources.stylesMap.get(key); - { - var devResource = getAsResourceDEV(resource); - - if (devResource) { - switch (devResource.__provenance) { - case 'rendered': - { - var differenceDescription = describeDifferencesForStylesheets( // Diff the props from the JSX element, not the derived resource props - props, devResource.__originalProps); - - if (differenceDescription) { - error('React encountered a with a `precedence` prop that has props that conflict' + ' with another hoistable stylesheet with the same `href`. When using `precedence` with ' + ' the props from the first encountered instance will be used and props from later instances will be ignored.' + ' Update the props on either instance so they agree.%s', href, differenceDescription); - } - - break; - } - - case 'preinit': - { - var _differenceDescription = describeDifferencesForStylesheetOverPreinit( // Diff the props from the JSX element, not the derived resource props - props, devResource.__propsEquivalent); - - if (_differenceDescription) { - error('React encountered a with props that conflict' + ' with the options provided to `ReactDOM.preinit("%s", { as: "style", ... })`. React will use the first props or preinitialization' + ' options encountered when rendering a hoistable stylesheet with a particular `href` and will ignore any newer props or' + ' options. The first instance of this stylesheet resource was created using the `ReactDOM.preinit()` function.' + ' Please note, `ReactDOM.preinit()` is modeled off of module import assertions capabilities and does not support' + ' arbitrary props. If you need to have props not included with the preinit options you will need to rely on rendering' + ' tags only.%s', precedence, href, href, _differenceDescription); - } - - break; - } - } - } - } - if (!resource) { var resourceProps = stylesheetPropsFromRawProps(props); var preloadResource = resources.preloadsMap.get(key); @@ -3439,11 +3097,6 @@ function pushLink(target, props, responseState, resources, textEmbedded, inserti props: resourceProps }; resources.stylesMap.set(key, resource); - - { - markAsRenderedResourceDEV(resource, props); - } - var precedenceSet = resources.precedences.get(precedence); if (!precedenceSet) { @@ -3744,11 +3397,6 @@ function pushImg(target, props, resources) { } }; resources.preloadsMap.set(key, resource); - - { - markAsRenderedResourceDEV(resource, props); - } - pushLinkImpl(resource.chunks, resource.props); } @@ -3932,38 +3580,6 @@ function pushScript(target, props, resources, textEmbedded, insertionMode, noscr var resource = resources.scriptsMap.get(key); - { - var devResource = getAsResourceDEV(resource); - - if (devResource) { - switch (devResource.__provenance) { - case 'rendered': - { - var differenceDescription = describeDifferencesForScripts( // Diff the props from the JSX element, not the derived resource props - props, devResource.__originalProps); - - if (differenceDescription) { - error('React encountered a