From 1d665b6fa3fccdd17852a449b2920ca7c53ad3f9 Mon Sep 17 00:00:00 2001 From: gnoff Date: Tue, 23 May 2023 03:01:14 +0000 Subject: [PATCH] Update preload links to support nonce and fetchpriority (#26826) Currently when React generates rel=preload link tags for script/stylesheet resources, it will not carryover nonce and fetchpriority values if specified on the original elements. This change ensures that the preload links use the nonce and fetchPriority values if they were specified. DiffTrain build for [535c038d15d21f33e678187410d658456cc0ce39](https://github.com/facebook/react/commit/535c038d15d21f33e678187410d658456cc0ce39) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/ReactDOMServer-dev.classic.js | 5 ++++- compiled/facebook-www/ReactDOMServer-dev.modern.js | 5 ++++- compiled/facebook-www/ReactDOMServer-prod.classic.js | 5 ++++- compiled/facebook-www/ReactDOMServer-prod.modern.js | 5 ++++- compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js | 3 +++ compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js | 3 +++ 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 21fb7cb076..a0551b0704 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -5309f102854475030fb91ab732141411b49c1126 +535c038d15d21f33e678187410d658456cc0ce39 diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 3040036f70..1a77bdec95 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-6fc3b80a"; +var ReactVersion = "18.3.0-www-classic-4ad4dc38"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -7504,6 +7504,7 @@ function preloadAsStylePropsFromProps(href, props) { as: "style", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, media: props.media, hrefLang: props.hrefLang, @@ -7517,7 +7518,9 @@ function preloadAsScriptPropsFromProps(href, props) { as: "script", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, + nonce: props.nonce, referrerPolicy: props.referrerPolicy }; } diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index d1c84a6a2c..c7f79bfd92 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-044bfa2a"; +var ReactVersion = "18.3.0-www-modern-bcd77572"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -7504,6 +7504,7 @@ function preloadAsStylePropsFromProps(href, props) { as: "style", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, media: props.media, hrefLang: props.hrefLang, @@ -7517,7 +7518,9 @@ function preloadAsScriptPropsFromProps(href, props) { as: "script", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, + nonce: props.nonce, referrerPolicy: props.referrerPolicy }; } diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 1ff521af74..dbd759e80b 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -1085,7 +1085,9 @@ function pushStartInstance( as: "script", href: props.src, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, + nonce: props.nonce, referrerPolicy: props.referrerPolicy } }), @@ -2104,6 +2106,7 @@ function preloadAsStylePropsFromProps(href, props) { as: "style", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, media: props.media, hrefLang: props.hrefLang, @@ -4011,4 +4014,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-cf2c1840"; +exports.version = "18.3.0-www-classic-15c0e05f"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index f8d5688fbd..0753e2c932 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -1084,7 +1084,9 @@ function pushStartInstance( as: "script", href: props.src, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, + nonce: props.nonce, referrerPolicy: props.referrerPolicy } }), @@ -2103,6 +2105,7 @@ function preloadAsStylePropsFromProps(href, props) { as: "style", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, media: props.media, hrefLang: props.hrefLang, @@ -3909,4 +3912,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-c8d57b01"; +exports.version = "18.3.0-www-modern-38ef6896"; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js index 19ba0a9a66..b103af42cd 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js @@ -7511,6 +7511,7 @@ function preloadAsStylePropsFromProps(href, props) { as: "style", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, media: props.media, hrefLang: props.hrefLang, @@ -7524,7 +7525,9 @@ function preloadAsScriptPropsFromProps(href, props) { as: "script", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, + nonce: props.nonce, referrerPolicy: props.referrerPolicy }; } diff --git a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js index 42d2f8b237..4247087e1c 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js @@ -1106,7 +1106,9 @@ function pushStartInstance( as: "script", href: props.src, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, + nonce: props.nonce, referrerPolicy: props.referrerPolicy } }), @@ -2158,6 +2160,7 @@ function preloadAsStylePropsFromProps(href, props) { as: "style", href: href, crossOrigin: props.crossOrigin, + fetchPriority: props.fetchPriority, integrity: props.integrity, media: props.media, hrefLang: props.hrefLang,