From 1e7f4a58fec9a60337d736d4befad0b1274818d1 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Thu, 9 Mar 2023 20:44:33 +0100 Subject: [PATCH] Update vendored react (#46970) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update to latest next channel of react mainly for https://github.com/facebook/react/pull/26353 ``` - 3706edb81 [Float][Fizz]: Don't preload nomodule scripts (#26353) (Josh Story) - 2b003a5cc Split out ServerReferenceMetadata into Id and Bound Arguments (#26351) (Sebastian Markbåge) - 62cd5af08 Codemod redundant async act scopes (#26350) (Andrew Clark) - 037378202 Internal `act`: Call scope function after an async gap (#26347) (Andrew Clark) - d8e49f2af Use setTimeout to schedule work on the server in Edge environments (#26348) (Sebastian Markbåge) - 83643778b Internal test helpers: Use Node's MessageChannel to queue task (#26345) (Andrew Clark) - f36ab0e37 Remove timers from ReactDOMSuspensePlaceholder tests (#26346) (Andrew Clark) - 44d380794 Move internalAct to internal-test-utils package (#26344) (Andrew Clark) - 8c100620c Build: specify Node.js 16 as minimum for dev (#26343) (Jan Kassens) - d81447304 [Internal API only] Delete non-awaited form of act (#26339) (Andrew Clark) - 702fc984e Codemod act -> await act (4/?) (#26338) (Andrew Clark) - 9fb2469a6 Restore definition of NativeMethods as an object for React Native (#26341) (Rubén Norte) - aef930314 [DevTools] upgrade electron to latest version & security improvements (#26337) (Mengdi Chen) - 161f6ae42 Codemod act -> await act (3/?) (#26336) (Andrew Clark) - 58605f798 Codemod act -> await act (2/?) (#26335) (Andrew Clark) ``` --- package.json | 6 +- ...t-dom-server-legacy.browser.development.js | 43 ++++++----- ...om-server-legacy.browser.production.min.js | 16 ++-- ...eact-dom-server-legacy.node.development.js | 43 ++++++----- ...t-dom-server-legacy.node.production.min.js | 6 +- ...t-dom-server-rendering-stub.development.js | 2 +- ...om-server-rendering-stub.production.min.js | 2 +- .../react-dom-server.browser.development.js | 43 ++++++----- ...react-dom-server.browser.production.min.js | 18 ++--- .../cjs/react-dom-server.edge.development.js | 45 +++++------ .../react-dom-server.edge.production.min.js | 75 ++++++++++--------- .../cjs/react-dom-server.node.development.js | 43 ++++++----- .../react-dom-server.node.production.min.js | 12 +-- .../react-dom/cjs/react-dom.development.js | 2 +- .../react-dom/cjs/react-dom.production.min.js | 6 +- .../react-dom/cjs/react-dom.profiling.min.js | 6 +- .../next/src/compiled/react-dom/package.json | 6 +- ...-dom-webpack-client.browser.development.js | 4 + ...m-webpack-client.browser.production.min.js | 3 +- ...ver-dom-webpack-client.edge.development.js | 4 + ...-dom-webpack-client.edge.production.min.js | 3 +- ...ver-dom-webpack-client.node.development.js | 4 + ...-dom-webpack-client.node.production.min.js | 3 +- ...bpack-client.node.unbundled.development.js | 4 + ...ck-client.node.unbundled.production.min.js | 2 +- .../react-server-dom-webpack-node-register.js | 6 +- ...-dom-webpack-server.browser.development.js | 18 +++-- ...m-webpack-server.browser.production.min.js | 8 +- ...ver-dom-webpack-server.edge.development.js | 20 +++-- ...-dom-webpack-server.edge.production.min.js | 17 +++-- ...ver-dom-webpack-server.node.development.js | 18 +++-- ...-dom-webpack-server.node.production.min.js | 10 +-- ...bpack-server.node.unbundled.development.js | 18 +++-- ...ck-server.node.unbundled.production.min.js | 10 +-- .../react-server-dom-webpack/package.json | 6 +- .../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 +- packages/next/src/compiled/react/package.json | 2 +- pnpm-lock.yaml | 36 ++++----- 41 files changed, 319 insertions(+), 259 deletions(-) diff --git a/package.json b/package.json index 8d594fd7016c3..8abba5be0975f 100644 --- a/package.json +++ b/package.json @@ -191,11 +191,11 @@ "random-seed": "0.3.0", "react": "18.2.0", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@18.3.0-next-703c67560-20230307", + "react-builtin": "npm:react@18.3.0-next-3706edb81-20230308", "react-dom": "18.2.0", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@18.3.0-next-703c67560-20230307", - "react-server-dom-webpack": "18.3.0-next-703c67560-20230307", + "react-dom-builtin": "npm:react-dom@18.3.0-next-3706edb81-20230308", + "react-server-dom-webpack": "18.3.0-next-3706edb81-20230308", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js index fea5f817a4bd0..7e11e4a1e9ca1 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") { var React = require('react'); var ReactDOM = require('react-dom'); -var ReactVersion = '18.3.0-next-703c67560-20230307'; +var ReactVersion = '18.3.0-next-3706edb81-20230308'; var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; @@ -3473,28 +3473,31 @@ function pushScript(target, props, resources, textEmbedded, insertionMode, noscr var key = getResourceKey('script', src); if (props.async !== true || props.onLoad || props.onError) { - // We can't resourcify scripts with load listeners. To avoid ambiguity with - // other Resourcified async scripts on the server we omit them from the server - // stream and expect them to be inserted during hydration on the client. - // We can still preload them however so the client can start fetching the script - // as soon as possible - var resource = resources.preloadsMap.get(key); + // we don't want to preload nomodule scripts + if (props.noModule !== true) { + // We can't resourcify scripts with load listeners. To avoid ambiguity with + // other Resourcified async scripts on the server we omit them from the server + // stream and expect them to be inserted during hydration on the client. + // We can still preload them however so the client can start fetching the script + // as soon as possible + var resource = resources.preloadsMap.get(key); - if (!resource) { - resource = { - type: 'preload', - chunks: [], - state: NoState, - props: preloadAsScriptPropsFromProps(props.src, props) - }; - resources.preloadsMap.set(key, resource); + if (!resource) { + resource = { + type: 'preload', + chunks: [], + state: NoState, + props: preloadAsScriptPropsFromProps(props.src, props) + }; + resources.preloadsMap.set(key, resource); - { - markAsImplicitResourceDEV(resource, props, resource.props); - } + { + markAsImplicitResourceDEV(resource, props, resource.props); + } - resources.usedScripts.add(resource); - pushLinkImpl(resource.chunks, resource.props); + resources.usedScripts.add(resource); + pushLinkImpl(resource.chunks, resource.props); + } } if (props.async !== true) { diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.min.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.min.js index 5a540e4a0423c..860636f976d7c 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.min.js @@ -37,13 +37,13 @@ function Ma(a,b,c,d,e,f,g){switch(b){case "select":a.push(E("select"));d=g=null; r;break;case "value":l=r;default:A(a,n,r)}}if(null!=g)if(c=null!==l?""+l:Ea(d),pa(g))for(n=0;n");B(a,h,d);return d;case "textarea":a.push(E("textarea"));h=d=g=null;for(r in c)if(t.call(c,r)&&(n=c[r],null!=n))switch(r){case "children":h=n;break;case "value":g=n;break;case "defaultValue":d=n;break;case "dangerouslySetInnerHTML":throw Error(m(91));default:A(a,r,n)}null=== g&&null!==d&&(g=d);a.push(">");if(null!=h){if(null!=g)throw Error(m(92));if(pa(h)&&1");return null;case "menuitem":a.push(E("menuitem"));for(var D in c)if(t.call(c,D)&&(g=c[D],null!=g))switch(D){case "children":case "dangerouslySetInnerHTML":throw Error(m(400));default:A(a,D,g)}a.push(">");return null;case "title":return 3===f.insertionMode||f.noscriptTagInScope||null!=c.itemProp?a=Ia(a,c):(Ia(e.hoistableChunks,c),a=null),a;case "link":return Fa(a,c,e,d,g,f.insertionMode, -f.noscriptTagInScope);case "script":a:if(3===f.insertionMode||f.noscriptTagInScope||null!=c.itemProp||"string"!==typeof c.src||!c.src)a=Ja(a,c);else{l="[script]"+c.src;if(!0!==c.async||c.onLoad||c.onError){if(h=d.preloadsMap.get(l),h||(h={type:"preload",chunks:[],state:0,props:{rel:"preload",as:"script",href:c.src,crossOrigin:c.crossOrigin,integrity:c.integrity,referrerPolicy:c.referrerPolicy}},d.preloadsMap.set(l,h),d.usedScripts.add(h),C(h.chunks,h.props)),!0!==c.async){Ja(a,c);a=null;break a}}else if(h= -d.scriptsMap.get(l),!h){h={type:"script",chunks:[],state:0,props:null};d.scriptsMap.set(l,h);d.scripts.add(h);n=c;if(d=d.preloadsMap.get(l))d.state|=4,c=n=q({},c),d=d.props,null==c.crossOrigin&&(c.crossOrigin=d.crossOrigin),null==c.integrity&&(c.integrity=d.integrity);Ja(h.chunks,n)}g&&a.push("\x3c!-- --\x3e");a=null}return a;case "style":n=c.precedence;l=c.href;if(3===f.insertionMode||f.noscriptTagInScope||null!=c.itemProp||"string"!==typeof n||"string"!==typeof l||""===l){a.push(E("style"));d=g= -null;for(p in c)if(t.call(c,p)&&(h=c[p],null!=h))switch(p){case "children":g=h;break;case "dangerouslySetInnerHTML":d=h;break;default:A(a,p,h)}a.push(">");c=Array.isArray(g)?2>g.length?g[0]:null:g;"function"!==typeof c&&"symbol"!==typeof c&&null!==c&&void 0!==c&&a.push(w(""+c));B(a,d,g);a.push("");a=null}else{p="[style]"+l;r=d.stylesMap.get(p);if(!r){(r=d.stylePrecedences.get(n))?r.props.hrefs.push(l):(r={type:"style",chunks:[],state:0,props:{precedence:n,hrefs:[l]}},d.stylePrecedences.set(n, -r),l=new Set,l.add(r),d.precedences.set(n,l));d.stylesMap.set(p,r);d.boundaryResources&&d.boundaryResources.add(r);d=r.chunks;l=n=null;for(h in c)if(t.call(c,h)&&(p=c[h],null!=p))switch(h){case "children":n=p;break;case "dangerouslySetInnerHTML":l=p}c=Array.isArray(n)?2>n.length?n[0]:null:n;"function"!==typeof c&&"symbol"!==typeof c&&null!==c&&void 0!==c&&d.push(w(""+c));B(d,l,n)}g&&a.push("\x3c!-- --\x3e");a=void 0}return a;case "meta":return 3===f.insertionMode||f.noscriptTagInScope||null!=c.itemProp? -a=Ha(a,c,"meta"):(g&&a.push("\x3c!-- --\x3e"),a="string"===typeof c.charSet?Ha(e.charsetChunks,c,"meta"):Ha(e.hoistableChunks,c,"meta")),a;case "listing":case "pre":a.push(E(b));d=g=null;for(var H in c)if(t.call(c,H)&&(h=c[H],null!=h))switch(H){case "children":g=h;break;case "dangerouslySetInnerHTML":d=h;break;default:A(a,H,h)}a.push(">");if(null!=d){if(null!=g)throw Error(m(60));if("object"!==typeof d||!("__html"in d))throw Error(m(61));c=d.__html;null!==c&&void 0!==c&&("string"===typeof c&&0f.insertionMode&&null===e.headChunks? -(e.headChunks=[],a=F(e.headChunks,c,"head")):a=F(a,c,"head"),a;case "html":return 0===f.insertionMode&&null===e.htmlChunks?(e.htmlChunks=[""],a=F(e.htmlChunks,c,"html")):a=F(a,c,"html"),a;default:if(-1===b.indexOf("-")&&"string"!==typeof c.is)return F(a,c,b);a.push(E(b));d=g=null;for(var z in c)if(t.call(c,z)&&(h=c[z],null!=h))switch(z){case "children":g=h;break;case "dangerouslySetInnerHTML":d=h;break;case "style":Da(a,h);break;case "suppressContentEditableWarning":case "suppressHydrationWarning":break; +f.noscriptTagInScope);case "script":a:if(3===f.insertionMode||f.noscriptTagInScope||null!=c.itemProp||"string"!==typeof c.src||!c.src)a=Ja(a,c);else{l="[script]"+c.src;if(!0!==c.async||c.onLoad||c.onError){if(!0!==c.noModule&&(h=d.preloadsMap.get(l),h||(h={type:"preload",chunks:[],state:0,props:{rel:"preload",as:"script",href:c.src,crossOrigin:c.crossOrigin,integrity:c.integrity,referrerPolicy:c.referrerPolicy}},d.preloadsMap.set(l,h),d.usedScripts.add(h),C(h.chunks,h.props))),!0!==c.async){Ja(a, +c);a=null;break a}}else if(h=d.scriptsMap.get(l),!h){h={type:"script",chunks:[],state:0,props:null};d.scriptsMap.set(l,h);d.scripts.add(h);n=c;if(d=d.preloadsMap.get(l))d.state|=4,c=n=q({},c),d=d.props,null==c.crossOrigin&&(c.crossOrigin=d.crossOrigin),null==c.integrity&&(c.integrity=d.integrity);Ja(h.chunks,n)}g&&a.push("\x3c!-- --\x3e");a=null}return a;case "style":n=c.precedence;l=c.href;if(3===f.insertionMode||f.noscriptTagInScope||null!=c.itemProp||"string"!==typeof n||"string"!==typeof l||""=== +l){a.push(E("style"));d=g=null;for(p in c)if(t.call(c,p)&&(h=c[p],null!=h))switch(p){case "children":g=h;break;case "dangerouslySetInnerHTML":d=h;break;default:A(a,p,h)}a.push(">");c=Array.isArray(g)?2>g.length?g[0]:null:g;"function"!==typeof c&&"symbol"!==typeof c&&null!==c&&void 0!==c&&a.push(w(""+c));B(a,d,g);a.push("");a=null}else{p="[style]"+l;r=d.stylesMap.get(p);if(!r){(r=d.stylePrecedences.get(n))?r.props.hrefs.push(l):(r={type:"style",chunks:[],state:0,props:{precedence:n,hrefs:[l]}}, +d.stylePrecedences.set(n,r),l=new Set,l.add(r),d.precedences.set(n,l));d.stylesMap.set(p,r);d.boundaryResources&&d.boundaryResources.add(r);d=r.chunks;l=n=null;for(h in c)if(t.call(c,h)&&(p=c[h],null!=p))switch(h){case "children":n=p;break;case "dangerouslySetInnerHTML":l=p}c=Array.isArray(n)?2>n.length?n[0]:null:n;"function"!==typeof c&&"symbol"!==typeof c&&null!==c&&void 0!==c&&d.push(w(""+c));B(d,l,n)}g&&a.push("\x3c!-- --\x3e");a=void 0}return a;case "meta":return 3===f.insertionMode||f.noscriptTagInScope|| +null!=c.itemProp?a=Ha(a,c,"meta"):(g&&a.push("\x3c!-- --\x3e"),a="string"===typeof c.charSet?Ha(e.charsetChunks,c,"meta"):Ha(e.hoistableChunks,c,"meta")),a;case "listing":case "pre":a.push(E(b));d=g=null;for(var H in c)if(t.call(c,H)&&(h=c[H],null!=h))switch(H){case "children":g=h;break;case "dangerouslySetInnerHTML":d=h;break;default:A(a,H,h)}a.push(">");if(null!=d){if(null!=g)throw Error(m(60));if("object"!==typeof d||!("__html"in d))throw Error(m(61));c=d.__html;null!==c&&void 0!==c&&("string"=== +typeof c&&0f.insertionMode&& +null===e.headChunks?(e.headChunks=[],a=F(e.headChunks,c,"head")):a=F(a,c,"head"),a;case "html":return 0===f.insertionMode&&null===e.htmlChunks?(e.htmlChunks=[""],a=F(e.htmlChunks,c,"html")):a=F(a,c,"html"),a;default:if(-1===b.indexOf("-")&&"string"!==typeof c.is)return F(a,c,b);a.push(E(b));d=g=null;for(var z in c)if(t.call(c,z)&&(h=c[z],null!=h))switch(z){case "children":g=h;break;case "dangerouslySetInnerHTML":d=h;break;case "style":Da(a,h);break;case "suppressContentEditableWarning":case "suppressHydrationWarning":break; default:ha(z)&&"function"!==typeof h&&"symbol"!==typeof h&&a.push(" ",z,'="',w(h),'"')}a.push(">");B(a,d,g);return g}}function Na(a,b,c){a.push('\x3c!--$?--\x3e')} function Oa(a,b,c,d){switch(c.insertionMode){case 0:case 1:case 2:return a.push('