From 4ca8268d74faaaa792598fa1fa92bf93d6acdce5 Mon Sep 17 00:00:00 2001 From: Josh Story Date: Thu, 10 Aug 2023 16:20:08 -0700 Subject: [PATCH 1/3] Should not export functions that are not imported --- .../react-dom-bindings/src/server/ReactFizzConfigDOM.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js index cccc3d0a76562..09910f654084a 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js @@ -5014,7 +5014,7 @@ function getResourceKey(as: string, href: string): string { return `[${as}]${href}`; } -export function prefetchDNS(href: string, options?: ?PrefetchDNSOptions) { +function prefetchDNS(href: string, options?: ?PrefetchDNSOptions) { if (!enableFloat) { return; } @@ -5073,7 +5073,7 @@ export function prefetchDNS(href: string, options?: ?PrefetchDNSOptions) { } } -export function preconnect(href: string, options?: ?PreconnectOptions) { +function preconnect(href: string, options?: ?PreconnectOptions) { if (!enableFloat) { return; } @@ -5136,7 +5136,7 @@ export function preconnect(href: string, options?: ?PreconnectOptions) { } } -export function preload(href: string, options: PreloadOptions) { +function preload(href: string, options: PreloadOptions) { if (!enableFloat) { return; } From 0e08c068b1b0ced2882ac110e1681a4f92d3c82a Mon Sep 17 00:00:00 2001 From: Josh Story Date: Fri, 11 Aug 2023 14:28:36 -0700 Subject: [PATCH 2/3] Removing some dev validations to be replaced later with something less complicated --- .../src/server/ReactFizzConfigDOM.js | 393 ----------------- .../src/shared/ReactDOMResourceValidation.js | 403 ------------------ .../src/__tests__/ReactDOMFloat-test.js | 262 ------------ 3 files changed, 1058 deletions(-) diff --git a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js index 09910f654084a..973c30333913b 100644 --- a/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js +++ b/packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js @@ -79,15 +79,6 @@ import { import { getValueDescriptorExpectingObjectForWarning, getValueDescriptorExpectingEnumForWarning, - describeDifferencesForStylesheets, - describeDifferencesForStylesheetOverPreinit, - describeDifferencesForScripts, - describeDifferencesForScriptOverPreinit, - describeDifferencesForPreinits, - describeDifferencesForPreinitOverStylesheet, - describeDifferencesForPreinitOverScript, - describeDifferencesForPreloads, - describeDifferencesForPreloadOverImplicitPreload, } from '../shared/ReactDOMResourceValidation'; import {NotPending} from '../shared/ReactDOMFormActions'; @@ -2004,55 +1995,6 @@ function pushLink( } else { // This stylesheet refers to a Resource and we create a new one if necessary let resource = resources.stylesMap.get(key); - if (__DEV__) { - const devResource = getAsResourceDEV(resource); - if (devResource) { - switch (devResource.__provenance) { - case 'rendered': { - const differenceDescription = describeDifferencesForStylesheets( - // Diff the props from the JSX element, not the derived resource props - props, - devResource.__originalProps, - ); - if (differenceDescription) { - console.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': { - const differenceDescription = - describeDifferencesForStylesheetOverPreinit( - // Diff the props from the JSX element, not the derived resource props - props, - devResource.__propsEquivalent, - ); - if (differenceDescription) { - console.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) { const resourceProps = stylesheetPropsFromRawProps(props); const preloadResource = resources.preloadsMap.get(key); @@ -2076,9 +2018,6 @@ function pushLink( props: resourceProps, }; resources.stylesMap.set(key, resource); - if (__DEV__) { - markAsRenderedResourceDEV(resource, props); - } let precedenceSet = resources.precedences.get(precedence); if (!precedenceSet) { precedenceSet = new Set(); @@ -2443,9 +2382,6 @@ function pushImg( }, }; resources.preloadsMap.set(key, resource); - if (__DEV__) { - markAsRenderedResourceDEV(resource, props); - } pushLinkImpl(resource.chunks, resource.props); } if ( @@ -2790,54 +2726,6 @@ function pushScript( const key = getResourceKey('script', src); // We can make this