From 0fe197bb3e8eb76078a86541301b4b058fd729e1 Mon Sep 17 00:00:00 2001 From: gnoff Date: Thu, 17 Aug 2023 17:35:00 +0000 Subject: [PATCH] [Float][Flight][Fizz][Fiber] Implement `preloadModule` and `preinitModule` (#27220) Stacked on #27224 ### Implements `ReactDOM.preloadModule()` `preloadModule` is a function to preload modules of various types. Similar to `preload` this is useful when you expect to use a Resource soon but can't render that resource directly. At the moment the only sensible module to preload is script modules along with some other `as` variants such as `as="serviceworker"`. In the future when there is some notion of how to preload style module script or json module scripts this API will be extended to support those as well. ##### Arguments 1. `href: string` -> the href or src value you want to preload. 2. `options?: {...}` -> 2.1. `options.as?: string` -> the `as` property the modulepreload link should render with. If not provided it will be omitted which will cause the modulepreload to be treated like a script module 2.2. `options.crossOrigin?: string` -> modules always load with CORS but you can provide `use-credentials` if you want to change the default behavior 2.3. `options.integrity?: string` -> an integrity hash for subresource integrity APIs ##### Rendering each preloaded module will emit a `` if `as` is specified and is something other than `"script"` the as attribute will also be included if crossOrigin or integrity as specified their attributes will also be included During SSR these script tags will be emitted before content. If we have not yet flushed the document head they will be emitted there after things that block paint such as font preloads, img preloads, and stylesheets. On the client these link tags will be appended to the document.head. ### Implements `ReactDOM.preinitModule()` `preinitModule` is a function to loading module scripts before they are required. It has the same use cases as `preinit`. During SSR you would use this to tell the browsers to start fetching code that will be used without having to wait for bootstrapping to initiate module fetches. ON the client you would use this to start fetching a module script early for an anticipated navigation or other event that is likely to depend on this module script. the `as` property for Float methods drew inspiration from the `as` attribute of the `` tag but it is used as a sort of tag for the kind of thing being targetted by Float methods. For `preinitModule` we currently only support `as: "script"` and this is also the assumed default type so you current never need to specify this `as` value. In the future `preinitModule` will support additional module script types such as `style` or `json`. The support of these types will correspond to [Module Import Attributes](https://github.com/tc39/proposal-import-attributes). ##### Arguments 1. `href: string` -> the href or src value you want to preinitialize 2. `options?: {...}` -> 2.1 `options.as?: string` -> only supports `script` and this is the default behavior. Until we support import attributes such as `json` and `style` there will not be much reason to provide an `as` option. 2.2. `options.crossOrigin?: string`: modules always load with CORS but you can provide `use-credentials` if you want to change the default behavior 2.3 `options.integrity?: string` -> an integrity hash for subresource integrity APIs ##### Rendering each preinitialized `script` module will emit a ``. Since this tag is an inline script variants of React that do not use inline scripts will simply omit these preinitialization tags from the SSR output. This is not implemented in this PR but will appear in a future update. DiffTrain build for [e50531692010bbda2a4627b07c7c810c3770a52a](https://github.com/facebook/react/commit/e50531692010bbda2a4627b07c7c810c3770a52a) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/React-dev.modern.js | 2 +- compiled/facebook-www/ReactART-dev.modern.js | 2 +- compiled/facebook-www/ReactART-prod.modern.js | 4 +- compiled/facebook-www/ReactDOM-dev.classic.js | 241 +++++++++++++++++- compiled/facebook-www/ReactDOM-dev.modern.js | 241 +++++++++++++++++- .../facebook-www/ReactDOM-prod.classic.js | 113 +++++++- compiled/facebook-www/ReactDOM-prod.modern.js | 113 +++++++- .../ReactDOM-profiling.classic.js | 113 +++++++- .../facebook-www/ReactDOM-profiling.modern.js | 113 +++++++- .../ReactDOMServer-dev.classic.js | 187 +++++++++++++- .../facebook-www/ReactDOMServer-dev.modern.js | 187 +++++++++++++- .../ReactDOMServer-prod.classic.js | 63 ++++- .../ReactDOMServer-prod.modern.js | 63 ++++- .../ReactDOMServerStreaming-dev.modern.js | 185 +++++++++++++- .../ReactDOMServerStreaming-prod.modern.js | 61 ++++- .../ReactDOMTesting-dev.classic.js | 241 +++++++++++++++++- .../ReactDOMTesting-dev.modern.js | 241 +++++++++++++++++- .../ReactDOMTesting-prod.classic.js | 113 +++++++- .../ReactDOMTesting-prod.modern.js | 113 +++++++- .../ReactTestRenderer-dev.classic.js | 2 +- compiled/facebook-www/WARNINGS | 3 + 22 files changed, 2337 insertions(+), 66 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 48e95e03aaf83..0d0bdbd41b690 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -ac1a16c67e268fcb2c52e91717cbc918c7c24446 +e50531692010bbda2a4627b07c7c810c3770a52a diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 5756a26c3a88c..a15ee943aa759 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-modern-00d6344c"; +var ReactVersion = "18.3.0-www-modern-cfb2f865"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index f24795f066565..8b86f4d05bd43 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-modern-2dcc215c"; +var ReactVersion = "18.3.0-www-modern-dc24a33c"; var LegacyRoot = 0; var ConcurrentRoot = 1; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index 2b68209100db1..75124b305cd57 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -9759,7 +9759,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-modern-0328f77f", + version: "18.3.0-www-modern-1182ef25", rendererPackageName: "react-art" }; var internals$jscomp$inline_1283 = { @@ -9790,7 +9790,7 @@ var internals$jscomp$inline_1283 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-0328f77f" + reconcilerVersion: "18.3.0-www-modern-1182ef25" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1284 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index fd400697079b2..4bbe1baef1363 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -33944,7 +33944,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-87900e0d"; +var ReactVersion = "18.3.0-www-classic-40cd88c9"; function createPortal$1( children, @@ -43365,7 +43365,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; // We expect this to get inlined. It is a function mostly to communicate the special nature of // how we resolve the HoistableRoot for ReactDOM.pre*() methods. Because we support calling // these methods outside of render there is no way to know which Document or ShadowRoot is 'scoped' @@ -43583,6 +43585,95 @@ function preload$1(href, options) { } } +function preloadModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && typeof options.as !== "string") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingObjectForWarning(options.as) + + "."; + } + + if (encountered) { + error( + 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s', + encountered + ); + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var as = options && typeof options.as === "string" ? options.as : "script"; + var preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]'; // Some preloads are keyed under their selector. This happens when the preload is for + // an arbitrary type. Other preloads are keyed under the resource key they represent a preload for. + // Here we figure out which key to use to determine if we have a preload already. + + var key = preloadSelector; + + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + key = getScriptKey(href); + break; + } + } + + if (!preloadPropsMap.has(key)) { + var preloadProps = preloadModulePropsFromPreloadModuleOptions( + href, + as, + options + ); + preloadPropsMap.set(key, preloadProps); + + if (null === ownerDocument.querySelector(preloadSelector)) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) { + return; + } + } + } + + var instance = ownerDocument.createElement("link"); + setInitialProperties(instance, "link", preloadProps); + markNodeAsHoistable(instance); + ownerDocument.head.appendChild(instance); + } + } + } +} + function preloadPropsFromPreloadOptions(href, as, options) { return { rel: "preload", @@ -43603,6 +43694,16 @@ function preloadPropsFromPreloadOptions(href, as, options) { }; } +function preloadModulePropsFromPreloadModuleOptions(href, as, options) { + return { + rel: "modulepreload", + as: as !== "script" ? as : undefined, + href: href, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function preinit$1(href, options) { { validatePreinitArguments(href, options); @@ -43730,6 +43831,112 @@ function preinit$1(href, options) { } } +function preinitModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && options.as !== "script") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingEnumForWarning(options.as) + + "."; + } + + if (encountered) { + error( + "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", + encountered + ); + } else { + var as = + options && typeof options.as === "string" ? options.as : "script"; + + switch (as) { + case "script": { + break; + } + // We have an invalid as type and need to warn + + default: { + var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); + + error( + 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + + " module types will be supported, aligning with the import-attributes proposal. Learn more here:" + + " (https://github.com/tc39/proposal-import-attributes)", + typeOfAs, + href + ); + } + } + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var _as = options && typeof options.as === "string" ? options.as : "script"; + + switch (_as) { + case "script": { + var src = href; + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts; + var key = getScriptKey(src); // Check if this resource already exists + + var resource = scripts.get(key); + + if (resource) { + // We can early return. The resource exists and there is nothing + // more to do + return; + } // Attempt to hydrate instance from DOM + + var instance = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + ); + + if (!instance) { + // Construct a new instance and insert it + var scriptProps = modulePropsFromPreinitModuleOptions(src, options); // Adopt certain preload props + + var preloadProps = preloadPropsMap.get(key); + + if (preloadProps) { + adoptPreloadPropsForScript(scriptProps, preloadProps); + } + + instance = ownerDocument.createElement("script"); + markNodeAsHoistable(instance); + setInitialProperties(instance, "link", scriptProps); + ownerDocument.head.appendChild(instance); + } // Construct a Resource and cache it + + resource = { + type: "script", + instance: instance, + count: 1, + state: null + }; + scripts.set(key, resource); + return; + } + } + } +} + function stylesheetPropsFromPreinitOptions(href, precedence, options) { return { rel: "stylesheet", @@ -43750,6 +43957,16 @@ function scriptPropsFromPreinitOptions(src, options) { nonce: options.nonce, fetchPriority: options.fetchPriority }; +} + +function modulePropsFromPreinitModuleOptions(src, options) { + return { + src: src, + async: true, + type: "module", + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; } // This function is called in begin work and we should always have a currentDocument set function getResource(type, currentProps, pendingProps) { @@ -46657,6 +46874,15 @@ function preload(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preloadModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preloadModule(href, options); + } // We don't error because preload needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} function preinit(href, options) { var dispatcher = Dispatcher.current; @@ -46666,6 +46892,15 @@ function preinit(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preinitModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preinitModule(href, options); + } // We don't error because preinit needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} { if ( @@ -46813,7 +47048,9 @@ exports.hydrateRoot = hydrateRoot; exports.preconnect = preconnect; exports.prefetchDNS = prefetchDNS; exports.preinit = preinit; +exports.preinitModule = preinitModule; exports.preload = preload; +exports.preloadModule = preloadModule; exports.render = render; exports.unmountComponentAtNode = unmountComponentAtNode; exports.unstable_batchedUpdates = batchedUpdates$1; diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index ebc226713221f..afce771795d22 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -33789,7 +33789,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-2dcc215c"; +var ReactVersion = "18.3.0-www-modern-dc24a33c"; function createPortal$1( children, @@ -43875,7 +43875,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; // We expect this to get inlined. It is a function mostly to communicate the special nature of // how we resolve the HoistableRoot for ReactDOM.pre*() methods. Because we support calling // these methods outside of render there is no way to know which Document or ShadowRoot is 'scoped' @@ -44093,6 +44095,95 @@ function preload$1(href, options) { } } +function preloadModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && typeof options.as !== "string") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingObjectForWarning(options.as) + + "."; + } + + if (encountered) { + error( + 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s', + encountered + ); + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var as = options && typeof options.as === "string" ? options.as : "script"; + var preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]'; // Some preloads are keyed under their selector. This happens when the preload is for + // an arbitrary type. Other preloads are keyed under the resource key they represent a preload for. + // Here we figure out which key to use to determine if we have a preload already. + + var key = preloadSelector; + + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + key = getScriptKey(href); + break; + } + } + + if (!preloadPropsMap.has(key)) { + var preloadProps = preloadModulePropsFromPreloadModuleOptions( + href, + as, + options + ); + preloadPropsMap.set(key, preloadProps); + + if (null === ownerDocument.querySelector(preloadSelector)) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) { + return; + } + } + } + + var instance = ownerDocument.createElement("link"); + setInitialProperties(instance, "link", preloadProps); + markNodeAsHoistable(instance); + ownerDocument.head.appendChild(instance); + } + } + } +} + function preloadPropsFromPreloadOptions(href, as, options) { return { rel: "preload", @@ -44113,6 +44204,16 @@ function preloadPropsFromPreloadOptions(href, as, options) { }; } +function preloadModulePropsFromPreloadModuleOptions(href, as, options) { + return { + rel: "modulepreload", + as: as !== "script" ? as : undefined, + href: href, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function preinit$1(href, options) { { validatePreinitArguments(href, options); @@ -44240,6 +44341,112 @@ function preinit$1(href, options) { } } +function preinitModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && options.as !== "script") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingEnumForWarning(options.as) + + "."; + } + + if (encountered) { + error( + "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", + encountered + ); + } else { + var as = + options && typeof options.as === "string" ? options.as : "script"; + + switch (as) { + case "script": { + break; + } + // We have an invalid as type and need to warn + + default: { + var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); + + error( + 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + + " module types will be supported, aligning with the import-attributes proposal. Learn more here:" + + " (https://github.com/tc39/proposal-import-attributes)", + typeOfAs, + href + ); + } + } + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var _as = options && typeof options.as === "string" ? options.as : "script"; + + switch (_as) { + case "script": { + var src = href; + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts; + var key = getScriptKey(src); // Check if this resource already exists + + var resource = scripts.get(key); + + if (resource) { + // We can early return. The resource exists and there is nothing + // more to do + return; + } // Attempt to hydrate instance from DOM + + var instance = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + ); + + if (!instance) { + // Construct a new instance and insert it + var scriptProps = modulePropsFromPreinitModuleOptions(src, options); // Adopt certain preload props + + var preloadProps = preloadPropsMap.get(key); + + if (preloadProps) { + adoptPreloadPropsForScript(scriptProps, preloadProps); + } + + instance = ownerDocument.createElement("script"); + markNodeAsHoistable(instance); + setInitialProperties(instance, "link", scriptProps); + ownerDocument.head.appendChild(instance); + } // Construct a Resource and cache it + + resource = { + type: "script", + instance: instance, + count: 1, + state: null + }; + scripts.set(key, resource); + return; + } + } + } +} + function stylesheetPropsFromPreinitOptions(href, precedence, options) { return { rel: "stylesheet", @@ -44260,6 +44467,16 @@ function scriptPropsFromPreinitOptions(src, options) { nonce: options.nonce, fetchPriority: options.fetchPriority }; +} + +function modulePropsFromPreinitModuleOptions(src, options) { + return { + src: src, + async: true, + type: "module", + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; } // This function is called in begin work and we should always have a currentDocument set function getResource(type, currentProps, pendingProps) { @@ -45746,6 +45963,15 @@ function preload(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preloadModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preloadModule(href, options); + } // We don't error because preload needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} function preinit(href, options) { var dispatcher = Dispatcher.current; @@ -45755,6 +45981,15 @@ function preinit(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preinitModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preinitModule(href, options); + } // We don't error because preinit needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} { if ( @@ -45880,7 +46115,9 @@ exports.hydrateRoot = hydrateRoot; exports.preconnect = preconnect; exports.prefetchDNS = prefetchDNS; exports.preinit = preinit; +exports.preinitModule = preinitModule; exports.preload = preload; +exports.preloadModule = preloadModule; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = createEventHandle; exports.unstable_runWithPriority = runWithPriority; diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index 9a20594c4721e..97e30ad204ee9 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -15142,7 +15142,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; function preconnectAs(rel, crossOrigin, href) { var ownerDocument = document; @@ -15242,13 +15244,62 @@ function preload$1(href, options) { getStylesheetSelectorFromKey(imageSrcSet) )) || ("script" === as && - ownerDocument.querySelector("script[async]" + imageSrcSet)) || + ownerDocument.querySelector(getScriptSelectorFromKey(imageSrcSet))) || ((as = ownerDocument.createElement("link")), setInitialProperties(as, "link", href), markNodeAsHoistable(as), ownerDocument.head.appendChild(as))); } } +function preloadModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) { + var as = options && "string" === typeof options.as ? options.as : "script", + preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]', + key = preloadSelector; + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + key = getScriptKey(href); + } + if ( + !preloadPropsMap.has(key) && + ((href = { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + preloadPropsMap.set(key, href), + null === ownerDocument.querySelector(preloadSelector)) + ) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) + return; + } + as = ownerDocument.createElement("link"); + setInitialProperties(as, "link", href); + markNodeAsHoistable(as); + ownerDocument.head.appendChild(as); + } + } +} function preinit$1(href, options) { var ownerDocument = document; if ( @@ -15311,7 +15362,9 @@ function preinit$1(href, options) { (key = getScriptKey(href)), (precedence = styles.get(key)), precedence || - ((precedence = ownerDocument.querySelector("script[async]" + key)), + ((precedence = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), precedence || ((href = { src: href, @@ -15336,6 +15389,41 @@ function preinit$1(href, options) { styles.set(key, precedence)); } } +function preinitModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) + switch (options && "string" === typeof options.as ? options.as : "script") { + case "script": + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts, + key = getScriptKey(href), + resource = scripts.get(key); + resource || + ((resource = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), + resource || + ((href = { + src: href, + async: !0, + type: "module", + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + (options = preloadPropsMap.get(key)) && + adoptPreloadPropsForScript(href, options), + (resource = ownerDocument.createElement("script")), + markNodeAsHoistable(resource), + setInitialProperties(resource, "link", href), + ownerDocument.head.appendChild(resource)), + (resource = { + type: "script", + instance: resource, + count: 1, + state: null + }), + scripts.set(key, resource)); + } +} function getResource(type, currentProps, pendingProps) { currentProps = (currentProps = rootInstanceStackCursor.current) ? getHoistableRoot(currentProps) @@ -15439,6 +15527,9 @@ function preloadStylesheet(ownerDocument, key, preloadProps, state) { function getScriptKey(src) { return '[src="' + escapeSelectorAttributeValueInsideDoubleQuotes(src) + '"]'; } +function getScriptSelectorFromKey(key) { + return "script[async]" + key; +} function acquireResource(hoistableRoot, resource, props) { resource.count++; if (null === resource.instance) @@ -15499,7 +15590,7 @@ function acquireResource(hoistableRoot, resource, props) { instance$282 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$282 + getScriptSelectorFromKey(instance$282) )) ) return ( @@ -16575,7 +16666,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1800 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-a80847ca", + version: "18.3.0-www-classic-5cdf4bb8", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2159 = { @@ -16605,7 +16696,7 @@ var internals$jscomp$inline_2159 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-a80847ca" + reconcilerVersion: "18.3.0-www-classic-5cdf4bb8" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2160 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16750,10 +16841,18 @@ exports.preinit = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preinit(href, options); }; +exports.preinitModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preinitModule(href, options); +}; exports.preload = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preload(href, options); }; +exports.preloadModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preloadModule(href, options); +}; exports.render = function (element, container, callback) { if (!isValidContainerLegacy(container)) throw Error(formatProdErrorMessage(200)); @@ -16833,4 +16932,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-a80847ca"; +exports.version = "18.3.0-www-classic-5cdf4bb8"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 6eec3e1fb3abb..a2c7a6804d736 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -15373,7 +15373,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; function preconnectAs(rel, crossOrigin, href) { var ownerDocument = document; @@ -15473,13 +15475,62 @@ function preload$1(href, options) { getStylesheetSelectorFromKey(imageSrcSet) )) || ("script" === as && - ownerDocument.querySelector("script[async]" + imageSrcSet)) || + ownerDocument.querySelector(getScriptSelectorFromKey(imageSrcSet))) || ((as = ownerDocument.createElement("link")), setInitialProperties(as, "link", href), markNodeAsHoistable(as), ownerDocument.head.appendChild(as))); } } +function preloadModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) { + var as = options && "string" === typeof options.as ? options.as : "script", + preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]', + key = preloadSelector; + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + key = getScriptKey(href); + } + if ( + !preloadPropsMap.has(key) && + ((href = { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + preloadPropsMap.set(key, href), + null === ownerDocument.querySelector(preloadSelector)) + ) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) + return; + } + as = ownerDocument.createElement("link"); + setInitialProperties(as, "link", href); + markNodeAsHoistable(as); + ownerDocument.head.appendChild(as); + } + } +} function preinit$1(href, options) { var ownerDocument = document; if ( @@ -15542,7 +15593,9 @@ function preinit$1(href, options) { (key = getScriptKey(href)), (precedence = styles.get(key)), precedence || - ((precedence = ownerDocument.querySelector("script[async]" + key)), + ((precedence = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), precedence || ((href = { src: href, @@ -15567,6 +15620,41 @@ function preinit$1(href, options) { styles.set(key, precedence)); } } +function preinitModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) + switch (options && "string" === typeof options.as ? options.as : "script") { + case "script": + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts, + key = getScriptKey(href), + resource = scripts.get(key); + resource || + ((resource = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), + resource || + ((href = { + src: href, + async: !0, + type: "module", + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + (options = preloadPropsMap.get(key)) && + adoptPreloadPropsForScript(href, options), + (resource = ownerDocument.createElement("script")), + markNodeAsHoistable(resource), + setInitialProperties(resource, "link", href), + ownerDocument.head.appendChild(resource)), + (resource = { + type: "script", + instance: resource, + count: 1, + state: null + }), + scripts.set(key, resource)); + } +} function getResource(type, currentProps, pendingProps) { currentProps = (currentProps = rootInstanceStackCursor.current) ? getHoistableRoot(currentProps) @@ -15670,6 +15758,9 @@ function preloadStylesheet(ownerDocument, key, preloadProps, state) { function getScriptKey(src) { return '[src="' + escapeSelectorAttributeValueInsideDoubleQuotes(src) + '"]'; } +function getScriptSelectorFromKey(key) { + return "script[async]" + key; +} function acquireResource(hoistableRoot, resource, props) { resource.count++; if (null === resource.instance) @@ -15730,7 +15821,7 @@ function acquireResource(hoistableRoot, resource, props) { instance$286 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$286 + getScriptSelectorFromKey(instance$286) )) ) return ( @@ -16105,7 +16196,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1759 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-0328f77f", + version: "18.3.0-www-modern-1182ef25", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2123 = { @@ -16136,7 +16227,7 @@ var internals$jscomp$inline_2123 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-0328f77f" + reconcilerVersion: "18.3.0-www-modern-1182ef25" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2124 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16257,10 +16348,18 @@ exports.preinit = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preinit(href, options); }; +exports.preinitModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preinitModule(href, options); +}; exports.preload = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preload(href, options); }; +exports.preloadModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preloadModule(href, options); +}; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = function (type, options) { function eventHandle(target, callback) { @@ -16292,4 +16391,4 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-0328f77f"; +exports.version = "18.3.0-www-modern-1182ef25"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 760668fe53877..b3a1366ebe638 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -15916,7 +15916,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; function preconnectAs(rel, crossOrigin, href) { var ownerDocument = document; @@ -16016,13 +16018,62 @@ function preload$1(href, options) { getStylesheetSelectorFromKey(imageSrcSet) )) || ("script" === as && - ownerDocument.querySelector("script[async]" + imageSrcSet)) || + ownerDocument.querySelector(getScriptSelectorFromKey(imageSrcSet))) || ((as = ownerDocument.createElement("link")), setInitialProperties(as, "link", href), markNodeAsHoistable(as), ownerDocument.head.appendChild(as))); } } +function preloadModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) { + var as = options && "string" === typeof options.as ? options.as : "script", + preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]', + key = preloadSelector; + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + key = getScriptKey(href); + } + if ( + !preloadPropsMap.has(key) && + ((href = { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + preloadPropsMap.set(key, href), + null === ownerDocument.querySelector(preloadSelector)) + ) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) + return; + } + as = ownerDocument.createElement("link"); + setInitialProperties(as, "link", href); + markNodeAsHoistable(as); + ownerDocument.head.appendChild(as); + } + } +} function preinit$1(href, options) { var ownerDocument = document; if ( @@ -16085,7 +16136,9 @@ function preinit$1(href, options) { (key = getScriptKey(href)), (precedence = styles.get(key)), precedence || - ((precedence = ownerDocument.querySelector("script[async]" + key)), + ((precedence = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), precedence || ((href = { src: href, @@ -16110,6 +16163,41 @@ function preinit$1(href, options) { styles.set(key, precedence)); } } +function preinitModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) + switch (options && "string" === typeof options.as ? options.as : "script") { + case "script": + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts, + key = getScriptKey(href), + resource = scripts.get(key); + resource || + ((resource = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), + resource || + ((href = { + src: href, + async: !0, + type: "module", + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + (options = preloadPropsMap.get(key)) && + adoptPreloadPropsForScript(href, options), + (resource = ownerDocument.createElement("script")), + markNodeAsHoistable(resource), + setInitialProperties(resource, "link", href), + ownerDocument.head.appendChild(resource)), + (resource = { + type: "script", + instance: resource, + count: 1, + state: null + }), + scripts.set(key, resource)); + } +} function getResource(type, currentProps, pendingProps) { currentProps = (currentProps = rootInstanceStackCursor.current) ? getHoistableRoot(currentProps) @@ -16213,6 +16301,9 @@ function preloadStylesheet(ownerDocument, key, preloadProps, state) { function getScriptKey(src) { return '[src="' + escapeSelectorAttributeValueInsideDoubleQuotes(src) + '"]'; } +function getScriptSelectorFromKey(key) { + return "script[async]" + key; +} function acquireResource(hoistableRoot, resource, props) { resource.count++; if (null === resource.instance) @@ -16273,7 +16364,7 @@ function acquireResource(hoistableRoot, resource, props) { instance$303 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$303 + getScriptSelectorFromKey(instance$303) )) ) return ( @@ -17349,7 +17440,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1885 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-8964de47", + version: "18.3.0-www-classic-32fb2121", rendererPackageName: "react-dom" }; (function (internals) { @@ -17393,7 +17484,7 @@ var devToolsConfig$jscomp$inline_1885 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-8964de47" + reconcilerVersion: "18.3.0-www-classic-32fb2121" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -17525,10 +17616,18 @@ exports.preinit = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preinit(href, options); }; +exports.preinitModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preinitModule(href, options); +}; exports.preload = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preload(href, options); }; +exports.preloadModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preloadModule(href, options); +}; exports.render = function (element, container, callback) { if (!isValidContainerLegacy(container)) throw Error(formatProdErrorMessage(200)); @@ -17608,7 +17707,7 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-8964de47"; +exports.version = "18.3.0-www-classic-32fb2121"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index ac6e278e12870..994fa5fb7c5ba 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -16141,7 +16141,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; function preconnectAs(rel, crossOrigin, href) { var ownerDocument = document; @@ -16241,13 +16243,62 @@ function preload$1(href, options) { getStylesheetSelectorFromKey(imageSrcSet) )) || ("script" === as && - ownerDocument.querySelector("script[async]" + imageSrcSet)) || + ownerDocument.querySelector(getScriptSelectorFromKey(imageSrcSet))) || ((as = ownerDocument.createElement("link")), setInitialProperties(as, "link", href), markNodeAsHoistable(as), ownerDocument.head.appendChild(as))); } } +function preloadModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) { + var as = options && "string" === typeof options.as ? options.as : "script", + preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]', + key = preloadSelector; + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + key = getScriptKey(href); + } + if ( + !preloadPropsMap.has(key) && + ((href = { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + preloadPropsMap.set(key, href), + null === ownerDocument.querySelector(preloadSelector)) + ) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) + return; + } + as = ownerDocument.createElement("link"); + setInitialProperties(as, "link", href); + markNodeAsHoistable(as); + ownerDocument.head.appendChild(as); + } + } +} function preinit$1(href, options) { var ownerDocument = document; if ( @@ -16310,7 +16361,9 @@ function preinit$1(href, options) { (key = getScriptKey(href)), (precedence = styles.get(key)), precedence || - ((precedence = ownerDocument.querySelector("script[async]" + key)), + ((precedence = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), precedence || ((href = { src: href, @@ -16335,6 +16388,41 @@ function preinit$1(href, options) { styles.set(key, precedence)); } } +function preinitModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) + switch (options && "string" === typeof options.as ? options.as : "script") { + case "script": + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts, + key = getScriptKey(href), + resource = scripts.get(key); + resource || + ((resource = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), + resource || + ((href = { + src: href, + async: !0, + type: "module", + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + (options = preloadPropsMap.get(key)) && + adoptPreloadPropsForScript(href, options), + (resource = ownerDocument.createElement("script")), + markNodeAsHoistable(resource), + setInitialProperties(resource, "link", href), + ownerDocument.head.appendChild(resource)), + (resource = { + type: "script", + instance: resource, + count: 1, + state: null + }), + scripts.set(key, resource)); + } +} function getResource(type, currentProps, pendingProps) { currentProps = (currentProps = rootInstanceStackCursor.current) ? getHoistableRoot(currentProps) @@ -16438,6 +16526,9 @@ function preloadStylesheet(ownerDocument, key, preloadProps, state) { function getScriptKey(src) { return '[src="' + escapeSelectorAttributeValueInsideDoubleQuotes(src) + '"]'; } +function getScriptSelectorFromKey(key) { + return "script[async]" + key; +} function acquireResource(hoistableRoot, resource, props) { resource.count++; if (null === resource.instance) @@ -16498,7 +16589,7 @@ function acquireResource(hoistableRoot, resource, props) { instance$307 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$307 + getScriptSelectorFromKey(instance$307) )) ) return ( @@ -16873,7 +16964,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1844 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-5790f94f", + version: "18.3.0-www-modern-84557740", rendererPackageName: "react-dom" }; (function (internals) { @@ -16918,7 +17009,7 @@ var devToolsConfig$jscomp$inline_1844 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-5790f94f" + reconcilerVersion: "18.3.0-www-modern-84557740" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -17026,10 +17117,18 @@ exports.preinit = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preinit(href, options); }; +exports.preinitModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preinitModule(href, options); +}; exports.preload = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preload(href, options); }; +exports.preloadModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preloadModule(href, options); +}; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = function (type, options) { function eventHandle(target, callback) { @@ -17061,7 +17160,7 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-5790f94f"; +exports.version = "18.3.0-www-modern-84557740"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 8a65c344e5c37..2ed2b764ecaac 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-6c503419"; +var ReactVersion = "18.3.0-www-classic-f7f9d058"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -1871,7 +1871,9 @@ var ReactDOMServerDispatcher = { prefetchDNS: prefetchDNS, preconnect: preconnect, preload: preload, - preinit: preinit + preloadModule: preloadModule, + preinit: preinit, + preinitModule: preinitModule }; function prepareHostDispatcher() { ReactDOMCurrentDispatcher.current = ReactDOMServerDispatcher; @@ -6564,6 +6566,71 @@ function preload(href, options) { } } +function preloadModule(href, options) { + var request = resolveRequest(); + + if (!request) { + // In async contexts we can sometimes resolve resources from AsyncLocalStorage. If we can't we can also + // possibly get them from the stack if we are not in an async context. Since we were not able to resolve + // the resources for this call in either case we opt to do nothing. We can consider making this a warning + // but there may be times where calling a function outside of render is intentional (i.e. to warm up data + // fetching) and we don't want to warn in those cases. + return; + } + + var resources = getResources(request); + + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && typeof options.as !== "string") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingObjectForWarning(options.as) + + "."; + } + + if (encountered) { + error( + 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s', + encountered + ); + } + } + + if (typeof href === "string" && href) { + var as = options && typeof options.as === "string" ? options.as : "script"; + var key = getResourceKey(as, href); + var resource = resources.preloadsMap.get(key); + + if (!resource) { + resource = { + type: "preload", + chunks: [], + state: NoState, + props: preloadModulePropsFromPreloadModuleOptions(href, as, options) + }; + resources.preloadsMap.set(key, resource); + pushLinkImpl(resource.chunks, resource.props); + } + + resources.bulkPreloads.add(resource); + flushResources(request); + } +} + function preinit(href, options) { var request = resolveRequest(); @@ -6682,6 +6749,102 @@ function preinit(href, options) { flushResources(request); } + return; + } + } + } +} + +function preinitModule(href, options) { + var request = resolveRequest(); + + if (!request) { + // In async contexts we can sometimes resolve resources from AsyncLocalStorage. If we can't we can also + // possibly get them from the stack if we are not in an async context. Since we were not able to resolve + // the resources for this call in either case we opt to do nothing. We can consider making this a warning + // but there may be times where calling a function outside of render is intentional (i.e. to warm up data + // fetching) and we don't want to warn in those cases. + return; + } + + var resources = getResources(request); + + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && options.as !== "script") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingEnumForWarning(options.as) + + "."; + } + + if (encountered) { + error( + "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", + encountered + ); + } else { + var as = + options && typeof options.as === "string" ? options.as : "script"; + + switch (as) { + case "script": { + break; + } + // We have an invalid as type and need to warn + + default: { + var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); + + error( + 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + + " module types will be supported, aligning with the import-attributes proposal. Learn more here:" + + " (https://github.com/tc39/proposal-import-attributes)", + typeOfAs, + href + ); + } + } + } + } + + if (typeof href === "string" && href) { + var _as = options && typeof options.as === "string" ? options.as : "script"; + + switch (_as) { + case "script": { + var src = href; + var key = getResourceKey(_as, src); + var resource = resources.scriptsMap.get(key); + + if (!resource) { + resource = { + type: "script", + chunks: [], + state: NoState, + props: null + }; + resources.scriptsMap.set(key, resource); + var resourceProps = modulePropsFromPreinitModuleOptions(src, options); + resources.scripts.add(resource); + pushScriptImpl(resource.chunks, resourceProps); + flushResources(request); + } + return; } } @@ -6802,6 +6965,16 @@ function preloadPropsFromPreloadOptions(href, as, options) { }; } +function preloadModulePropsFromPreloadModuleOptions(href, as, options) { + return { + rel: "modulepreload", + as: as !== "script" ? as : undefined, + href: href, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function preloadAsStylePropsFromProps(href, props) { return { rel: "preload", @@ -6852,6 +7025,16 @@ function scriptPropsFromPreinitOptions(src, options) { }; } +function modulePropsFromPreinitModuleOptions(src, options) { + return { + src: src, + type: "module", + async: true, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function adoptPreloadPropsForScriptProps(resourceProps, preloadProps) { if (resourceProps.crossOrigin == null) resourceProps.crossOrigin = preloadProps.crossOrigin; diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index 531c37f1d51ae..3d9e3bb46c1d5 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-778649fb"; +var ReactVersion = "18.3.0-www-modern-96d06777"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -1871,7 +1871,9 @@ var ReactDOMServerDispatcher = { prefetchDNS: prefetchDNS, preconnect: preconnect, preload: preload, - preinit: preinit + preloadModule: preloadModule, + preinit: preinit, + preinitModule: preinitModule }; function prepareHostDispatcher() { ReactDOMCurrentDispatcher.current = ReactDOMServerDispatcher; @@ -6564,6 +6566,71 @@ function preload(href, options) { } } +function preloadModule(href, options) { + var request = resolveRequest(); + + if (!request) { + // In async contexts we can sometimes resolve resources from AsyncLocalStorage. If we can't we can also + // possibly get them from the stack if we are not in an async context. Since we were not able to resolve + // the resources for this call in either case we opt to do nothing. We can consider making this a warning + // but there may be times where calling a function outside of render is intentional (i.e. to warm up data + // fetching) and we don't want to warn in those cases. + return; + } + + var resources = getResources(request); + + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && typeof options.as !== "string") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingObjectForWarning(options.as) + + "."; + } + + if (encountered) { + error( + 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s', + encountered + ); + } + } + + if (typeof href === "string" && href) { + var as = options && typeof options.as === "string" ? options.as : "script"; + var key = getResourceKey(as, href); + var resource = resources.preloadsMap.get(key); + + if (!resource) { + resource = { + type: "preload", + chunks: [], + state: NoState, + props: preloadModulePropsFromPreloadModuleOptions(href, as, options) + }; + resources.preloadsMap.set(key, resource); + pushLinkImpl(resource.chunks, resource.props); + } + + resources.bulkPreloads.add(resource); + flushResources(request); + } +} + function preinit(href, options) { var request = resolveRequest(); @@ -6682,6 +6749,102 @@ function preinit(href, options) { flushResources(request); } + return; + } + } + } +} + +function preinitModule(href, options) { + var request = resolveRequest(); + + if (!request) { + // In async contexts we can sometimes resolve resources from AsyncLocalStorage. If we can't we can also + // possibly get them from the stack if we are not in an async context. Since we were not able to resolve + // the resources for this call in either case we opt to do nothing. We can consider making this a warning + // but there may be times where calling a function outside of render is intentional (i.e. to warm up data + // fetching) and we don't want to warn in those cases. + return; + } + + var resources = getResources(request); + + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && options.as !== "script") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingEnumForWarning(options.as) + + "."; + } + + if (encountered) { + error( + "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", + encountered + ); + } else { + var as = + options && typeof options.as === "string" ? options.as : "script"; + + switch (as) { + case "script": { + break; + } + // We have an invalid as type and need to warn + + default: { + var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); + + error( + 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + + " module types will be supported, aligning with the import-attributes proposal. Learn more here:" + + " (https://github.com/tc39/proposal-import-attributes)", + typeOfAs, + href + ); + } + } + } + } + + if (typeof href === "string" && href) { + var _as = options && typeof options.as === "string" ? options.as : "script"; + + switch (_as) { + case "script": { + var src = href; + var key = getResourceKey(_as, src); + var resource = resources.scriptsMap.get(key); + + if (!resource) { + resource = { + type: "script", + chunks: [], + state: NoState, + props: null + }; + resources.scriptsMap.set(key, resource); + var resourceProps = modulePropsFromPreinitModuleOptions(src, options); + resources.scripts.add(resource); + pushScriptImpl(resource.chunks, resourceProps); + flushResources(request); + } + return; } } @@ -6802,6 +6965,16 @@ function preloadPropsFromPreloadOptions(href, as, options) { }; } +function preloadModulePropsFromPreloadModuleOptions(href, as, options) { + return { + rel: "modulepreload", + as: as !== "script" ? as : undefined, + href: href, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function preloadAsStylePropsFromProps(href, props) { return { rel: "preload", @@ -6852,6 +7025,16 @@ function scriptPropsFromPreinitOptions(src, options) { }; } +function modulePropsFromPreinitModuleOptions(src, options) { + return { + src: src, + type: "module", + async: true, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function adoptPreloadPropsForScriptProps(resourceProps, preloadProps) { if (resourceProps.crossOrigin == null) resourceProps.crossOrigin = preloadProps.crossOrigin; diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 431bfb5851295..200554d31d71c 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -190,7 +190,9 @@ var isArrayImpl = Array.isArray, prefetchDNS: prefetchDNS, preconnect: preconnect, preload: preload, - preinit: preinit + preloadModule: preloadModule, + preinit: preinit, + preinitModule: preinitModule }; function createFormatContext(insertionMode, selectedValue, noscriptTagInScope) { return { @@ -2019,6 +2021,35 @@ function preload(href, options) { } } } +function preloadModule(href, options) { + var request = currentRequest ? currentRequest : null; + if (request) { + var resources = request.resources; + if ("string" === typeof href && href) { + var as = + options && "string" === typeof options.as ? options.as : "script", + key = "[" + as + "]" + href, + resource = resources.preloadsMap.get(key); + resource || + ((resource = { + type: "preload", + chunks: [], + state: 0, + props: { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + } + }), + resources.preloadsMap.set(key, resource), + pushLinkImpl(resource.chunks, resource.props)); + resources.bulkPreloads.add(resource); + enqueueFlush(request); + } + } +} function preinit(href, options) { var request = currentRequest ? currentRequest : null; if (request) { @@ -2090,6 +2121,34 @@ function preinit(href, options) { } } } +function preinitModule(href, options) { + var request = currentRequest ? currentRequest : null; + if (request) { + var resources = request.resources; + if ("string" === typeof href && href) { + var as = + options && "string" === typeof options.as ? options.as : "script"; + switch (as) { + case "script": + var key = "[" + as + "]" + href; + as = resources.scriptsMap.get(key); + as || + ((as = { type: "script", chunks: [], state: 0, props: null }), + resources.scriptsMap.set(key, as), + (href = { + src: href, + type: "module", + async: !0, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + resources.scripts.add(as), + pushScriptImpl(as.chunks, href), + enqueueFlush(request)); + } + } + } +} function hoistStyleResource(resource) { this.add(resource); } @@ -4133,4 +4192,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-36080993"; +exports.version = "18.3.0-www-classic-392f5b19"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index 76e3732c3e0c9..d04ffe944c687 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -189,7 +189,9 @@ var isArrayImpl = Array.isArray, prefetchDNS: prefetchDNS, preconnect: preconnect, preload: preload, - preinit: preinit + preloadModule: preloadModule, + preinit: preinit, + preinitModule: preinitModule }; function createFormatContext(insertionMode, selectedValue, noscriptTagInScope) { return { @@ -2018,6 +2020,35 @@ function preload(href, options) { } } } +function preloadModule(href, options) { + var request = currentRequest ? currentRequest : null; + if (request) { + var resources = request.resources; + if ("string" === typeof href && href) { + var as = + options && "string" === typeof options.as ? options.as : "script", + key = "[" + as + "]" + href, + resource = resources.preloadsMap.get(key); + resource || + ((resource = { + type: "preload", + chunks: [], + state: 0, + props: { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + } + }), + resources.preloadsMap.set(key, resource), + pushLinkImpl(resource.chunks, resource.props)); + resources.bulkPreloads.add(resource); + enqueueFlush(request); + } + } +} function preinit(href, options) { var request = currentRequest ? currentRequest : null; if (request) { @@ -2089,6 +2120,34 @@ function preinit(href, options) { } } } +function preinitModule(href, options) { + var request = currentRequest ? currentRequest : null; + if (request) { + var resources = request.resources; + if ("string" === typeof href && href) { + var as = + options && "string" === typeof options.as ? options.as : "script"; + switch (as) { + case "script": + var key = "[" + as + "]" + href; + as = resources.scriptsMap.get(key); + as || + ((as = { type: "script", chunks: [], state: 0, props: null }), + resources.scriptsMap.set(key, as), + (href = { + src: href, + type: "module", + async: !0, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + resources.scripts.add(as), + pushScriptImpl(as.chunks, href), + enqueueFlush(request)); + } + } + } +} function hoistStyleResource(resource) { this.add(resource); } @@ -4057,4 +4116,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-ab005b15"; +exports.version = "18.3.0-www-modern-fdb24284"; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js index 0c6f5e20945ec..1b5258e71e791 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js @@ -1868,7 +1868,9 @@ var ReactDOMServerDispatcher = { prefetchDNS: prefetchDNS, preconnect: preconnect, preload: preload, - preinit: preinit + preloadModule: preloadModule, + preinit: preinit, + preinitModule: preinitModule }; function prepareHostDispatcher() { ReactDOMCurrentDispatcher.current = ReactDOMServerDispatcher; @@ -6571,6 +6573,71 @@ function preload(href, options) { } } +function preloadModule(href, options) { + var request = resolveRequest(); + + if (!request) { + // In async contexts we can sometimes resolve resources from AsyncLocalStorage. If we can't we can also + // possibly get them from the stack if we are not in an async context. Since we were not able to resolve + // the resources for this call in either case we opt to do nothing. We can consider making this a warning + // but there may be times where calling a function outside of render is intentional (i.e. to warm up data + // fetching) and we don't want to warn in those cases. + return; + } + + var resources = getResources(request); + + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && typeof options.as !== "string") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingObjectForWarning(options.as) + + "."; + } + + if (encountered) { + error( + 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s', + encountered + ); + } + } + + if (typeof href === "string" && href) { + var as = options && typeof options.as === "string" ? options.as : "script"; + var key = getResourceKey(as, href); + var resource = resources.preloadsMap.get(key); + + if (!resource) { + resource = { + type: "preload", + chunks: [], + state: NoState, + props: preloadModulePropsFromPreloadModuleOptions(href, as, options) + }; + resources.preloadsMap.set(key, resource); + pushLinkImpl(resource.chunks, resource.props); + } + + resources.bulkPreloads.add(resource); + flushResources(request); + } +} + function preinit(href, options) { var request = resolveRequest(); @@ -6689,6 +6756,102 @@ function preinit(href, options) { flushResources(request); } + return; + } + } + } +} + +function preinitModule(href, options) { + var request = resolveRequest(); + + if (!request) { + // In async contexts we can sometimes resolve resources from AsyncLocalStorage. If we can't we can also + // possibly get them from the stack if we are not in an async context. Since we were not able to resolve + // the resources for this call in either case we opt to do nothing. We can consider making this a warning + // but there may be times where calling a function outside of render is intentional (i.e. to warm up data + // fetching) and we don't want to warn in those cases. + return; + } + + var resources = getResources(request); + + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && options.as !== "script") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingEnumForWarning(options.as) + + "."; + } + + if (encountered) { + error( + "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", + encountered + ); + } else { + var as = + options && typeof options.as === "string" ? options.as : "script"; + + switch (as) { + case "script": { + break; + } + // We have an invalid as type and need to warn + + default: { + var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); + + error( + 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + + " module types will be supported, aligning with the import-attributes proposal. Learn more here:" + + " (https://github.com/tc39/proposal-import-attributes)", + typeOfAs, + href + ); + } + } + } + } + + if (typeof href === "string" && href) { + var _as = options && typeof options.as === "string" ? options.as : "script"; + + switch (_as) { + case "script": { + var src = href; + var key = getResourceKey(_as, src); + var resource = resources.scriptsMap.get(key); + + if (!resource) { + resource = { + type: "script", + chunks: [], + state: NoState, + props: null + }; + resources.scriptsMap.set(key, resource); + var resourceProps = modulePropsFromPreinitModuleOptions(src, options); + resources.scripts.add(resource); + pushScriptImpl(resource.chunks, resourceProps); + flushResources(request); + } + return; } } @@ -6809,6 +6972,16 @@ function preloadPropsFromPreloadOptions(href, as, options) { }; } +function preloadModulePropsFromPreloadModuleOptions(href, as, options) { + return { + rel: "modulepreload", + as: as !== "script" ? as : undefined, + href: href, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function preloadAsStylePropsFromProps(href, props) { return { rel: "preload", @@ -6859,6 +7032,16 @@ function scriptPropsFromPreinitOptions(src, options) { }; } +function modulePropsFromPreinitModuleOptions(src, options) { + return { + src: src, + type: "module", + async: true, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function adoptPreloadPropsForScriptProps(resourceProps, preloadProps) { if (resourceProps.crossOrigin == null) resourceProps.crossOrigin = preloadProps.crossOrigin; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js index 404a188437a66..c972330ced2c2 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js @@ -180,7 +180,9 @@ var isArrayImpl = Array.isArray, prefetchDNS: prefetchDNS, preconnect: preconnect, preload: preload, - preinit: preinit + preloadModule: preloadModule, + preinit: preinit, + preinitModule: preinitModule }, scriptRegex = /(<\/|<)(s)(cript)/gi; function scriptReplacer(match, prefix, s, suffix) { @@ -2068,6 +2070,35 @@ function preload(href, options) { } } } +function preloadModule(href, options) { + var request = currentRequest ? currentRequest : null; + if (request) { + var resources = request.resources; + if ("string" === typeof href && href) { + var as = + options && "string" === typeof options.as ? options.as : "script", + key = "[" + as + "]" + href, + resource = resources.preloadsMap.get(key); + resource || + ((resource = { + type: "preload", + chunks: [], + state: 0, + props: { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + } + }), + resources.preloadsMap.set(key, resource), + pushLinkImpl(resource.chunks, resource.props)); + resources.bulkPreloads.add(resource); + enqueueFlush(request); + } + } +} function preinit(href, options) { var request = currentRequest ? currentRequest : null; if (request) { @@ -2139,6 +2170,34 @@ function preinit(href, options) { } } } +function preinitModule(href, options) { + var request = currentRequest ? currentRequest : null; + if (request) { + var resources = request.resources; + if ("string" === typeof href && href) { + var as = + options && "string" === typeof options.as ? options.as : "script"; + switch (as) { + case "script": + var key = "[" + as + "]" + href; + as = resources.scriptsMap.get(key); + as || + ((as = { type: "script", chunks: [], state: 0, props: null }), + resources.scriptsMap.set(key, as), + (href = { + src: href, + type: "module", + async: !0, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + resources.scripts.add(as), + pushScriptImpl(as.chunks, href), + enqueueFlush(request)); + } + } + } +} function hoistStyleResource(resource) { this.add(resource); } diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index 22d4259fde291..b7adc63c2500e 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -34561,7 +34561,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-a029c8fa"; +var ReactVersion = "18.3.0-www-classic-83b4bba5"; function createPortal$1( children, @@ -44114,7 +44114,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; // We expect this to get inlined. It is a function mostly to communicate the special nature of // how we resolve the HoistableRoot for ReactDOM.pre*() methods. Because we support calling // these methods outside of render there is no way to know which Document or ShadowRoot is 'scoped' @@ -44332,6 +44334,95 @@ function preload$1(href, options) { } } +function preloadModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && typeof options.as !== "string") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingObjectForWarning(options.as) + + "."; + } + + if (encountered) { + error( + 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s', + encountered + ); + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var as = options && typeof options.as === "string" ? options.as : "script"; + var preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]'; // Some preloads are keyed under their selector. This happens when the preload is for + // an arbitrary type. Other preloads are keyed under the resource key they represent a preload for. + // Here we figure out which key to use to determine if we have a preload already. + + var key = preloadSelector; + + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + key = getScriptKey(href); + break; + } + } + + if (!preloadPropsMap.has(key)) { + var preloadProps = preloadModulePropsFromPreloadModuleOptions( + href, + as, + options + ); + preloadPropsMap.set(key, preloadProps); + + if (null === ownerDocument.querySelector(preloadSelector)) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) { + return; + } + } + } + + var instance = ownerDocument.createElement("link"); + setInitialProperties(instance, "link", preloadProps); + markNodeAsHoistable(instance); + ownerDocument.head.appendChild(instance); + } + } + } +} + function preloadPropsFromPreloadOptions(href, as, options) { return { rel: "preload", @@ -44352,6 +44443,16 @@ function preloadPropsFromPreloadOptions(href, as, options) { }; } +function preloadModulePropsFromPreloadModuleOptions(href, as, options) { + return { + rel: "modulepreload", + as: as !== "script" ? as : undefined, + href: href, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function preinit$1(href, options) { { validatePreinitArguments(href, options); @@ -44479,6 +44580,112 @@ function preinit$1(href, options) { } } +function preinitModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && options.as !== "script") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingEnumForWarning(options.as) + + "."; + } + + if (encountered) { + error( + "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", + encountered + ); + } else { + var as = + options && typeof options.as === "string" ? options.as : "script"; + + switch (as) { + case "script": { + break; + } + // We have an invalid as type and need to warn + + default: { + var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); + + error( + 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + + " module types will be supported, aligning with the import-attributes proposal. Learn more here:" + + " (https://github.com/tc39/proposal-import-attributes)", + typeOfAs, + href + ); + } + } + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var _as = options && typeof options.as === "string" ? options.as : "script"; + + switch (_as) { + case "script": { + var src = href; + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts; + var key = getScriptKey(src); // Check if this resource already exists + + var resource = scripts.get(key); + + if (resource) { + // We can early return. The resource exists and there is nothing + // more to do + return; + } // Attempt to hydrate instance from DOM + + var instance = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + ); + + if (!instance) { + // Construct a new instance and insert it + var scriptProps = modulePropsFromPreinitModuleOptions(src, options); // Adopt certain preload props + + var preloadProps = preloadPropsMap.get(key); + + if (preloadProps) { + adoptPreloadPropsForScript(scriptProps, preloadProps); + } + + instance = ownerDocument.createElement("script"); + markNodeAsHoistable(instance); + setInitialProperties(instance, "link", scriptProps); + ownerDocument.head.appendChild(instance); + } // Construct a Resource and cache it + + resource = { + type: "script", + instance: instance, + count: 1, + state: null + }; + scripts.set(key, resource); + return; + } + } + } +} + function stylesheetPropsFromPreinitOptions(href, precedence, options) { return { rel: "stylesheet", @@ -44499,6 +44706,16 @@ function scriptPropsFromPreinitOptions(src, options) { nonce: options.nonce, fetchPriority: options.fetchPriority }; +} + +function modulePropsFromPreinitModuleOptions(src, options) { + return { + src: src, + async: true, + type: "module", + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; } // This function is called in begin work and we should always have a currentDocument set function getResource(type, currentProps, pendingProps) { @@ -47408,6 +47625,15 @@ function preload(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preloadModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preloadModule(href, options); + } // We don't error because preload needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} function preinit(href, options) { var dispatcher = Dispatcher.current; @@ -47417,6 +47643,15 @@ function preinit(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preinitModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preinitModule(href, options); + } // We don't error because preinit needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} { if ( @@ -47574,7 +47809,9 @@ exports.observeVisibleRects = observeVisibleRects; exports.preconnect = preconnect; exports.prefetchDNS = prefetchDNS; exports.preinit = preinit; +exports.preinitModule = preinitModule; exports.preload = preload; +exports.preloadModule = preloadModule; exports.render = render; exports.unmountComponentAtNode = unmountComponentAtNode; exports.unstable_batchedUpdates = batchedUpdates$1; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index 908a620ebf4fe..cb300315915f9 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -34406,7 +34406,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-02ec8d47"; +var ReactVersion = "18.3.0-www-modern-8d3adc88"; function createPortal$1( children, @@ -44624,7 +44624,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; // We expect this to get inlined. It is a function mostly to communicate the special nature of // how we resolve the HoistableRoot for ReactDOM.pre*() methods. Because we support calling // these methods outside of render there is no way to know which Document or ShadowRoot is 'scoped' @@ -44842,6 +44844,95 @@ function preload$1(href, options) { } } +function preloadModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && typeof options.as !== "string") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingObjectForWarning(options.as) + + "."; + } + + if (encountered) { + error( + 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s', + encountered + ); + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var as = options && typeof options.as === "string" ? options.as : "script"; + var preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]'; // Some preloads are keyed under their selector. This happens when the preload is for + // an arbitrary type. Other preloads are keyed under the resource key they represent a preload for. + // Here we figure out which key to use to determine if we have a preload already. + + var key = preloadSelector; + + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + key = getScriptKey(href); + break; + } + } + + if (!preloadPropsMap.has(key)) { + var preloadProps = preloadModulePropsFromPreloadModuleOptions( + href, + as, + options + ); + preloadPropsMap.set(key, preloadProps); + + if (null === ownerDocument.querySelector(preloadSelector)) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": { + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) { + return; + } + } + } + + var instance = ownerDocument.createElement("link"); + setInitialProperties(instance, "link", preloadProps); + markNodeAsHoistable(instance); + ownerDocument.head.appendChild(instance); + } + } + } +} + function preloadPropsFromPreloadOptions(href, as, options) { return { rel: "preload", @@ -44862,6 +44953,16 @@ function preloadPropsFromPreloadOptions(href, as, options) { }; } +function preloadModulePropsFromPreloadModuleOptions(href, as, options) { + return { + rel: "modulepreload", + as: as !== "script" ? as : undefined, + href: href, + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; +} + function preinit$1(href, options) { { validatePreinitArguments(href, options); @@ -44989,6 +45090,112 @@ function preinit$1(href, options) { } } +function preinitModule$1(href, options) { + { + var encountered = ""; + + if (typeof href !== "string" || !href) { + encountered += + " The `href` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(href) + + "."; + } + + if (options !== undefined && typeof options !== "object") { + encountered += + " The `options` argument encountered was " + + getValueDescriptorExpectingObjectForWarning(options) + + "."; + } else if (options && "as" in options && options.as !== "script") { + encountered += + " The `as` option encountered was " + + getValueDescriptorExpectingEnumForWarning(options.as) + + "."; + } + + if (encountered) { + error( + "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s", + encountered + ); + } else { + var as = + options && typeof options.as === "string" ? options.as : "script"; + + switch (as) { + case "script": { + break; + } + // We have an invalid as type and need to warn + + default: { + var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); + + error( + 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + + " module types will be supported, aligning with the import-attributes proposal. Learn more here:" + + " (https://github.com/tc39/proposal-import-attributes)", + typeOfAs, + href + ); + } + } + } + } + + var ownerDocument = getDocumentForImperativeFloatMethods(); + + if (typeof href === "string" && href) { + var _as = options && typeof options.as === "string" ? options.as : "script"; + + switch (_as) { + case "script": { + var src = href; + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts; + var key = getScriptKey(src); // Check if this resource already exists + + var resource = scripts.get(key); + + if (resource) { + // We can early return. The resource exists and there is nothing + // more to do + return; + } // Attempt to hydrate instance from DOM + + var instance = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + ); + + if (!instance) { + // Construct a new instance and insert it + var scriptProps = modulePropsFromPreinitModuleOptions(src, options); // Adopt certain preload props + + var preloadProps = preloadPropsMap.get(key); + + if (preloadProps) { + adoptPreloadPropsForScript(scriptProps, preloadProps); + } + + instance = ownerDocument.createElement("script"); + markNodeAsHoistable(instance); + setInitialProperties(instance, "link", scriptProps); + ownerDocument.head.appendChild(instance); + } // Construct a Resource and cache it + + resource = { + type: "script", + instance: instance, + count: 1, + state: null + }; + scripts.set(key, resource); + return; + } + } + } +} + function stylesheetPropsFromPreinitOptions(href, precedence, options) { return { rel: "stylesheet", @@ -45009,6 +45216,16 @@ function scriptPropsFromPreinitOptions(src, options) { nonce: options.nonce, fetchPriority: options.fetchPriority }; +} + +function modulePropsFromPreinitModuleOptions(src, options) { + return { + src: src, + async: true, + type: "module", + crossOrigin: options ? options.crossOrigin : undefined, + integrity: options ? options.integrity : undefined + }; } // This function is called in begin work and we should always have a currentDocument set function getResource(type, currentProps, pendingProps) { @@ -46497,6 +46714,15 @@ function preload(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preloadModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preloadModule(href, options); + } // We don't error because preload needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} function preinit(href, options) { var dispatcher = Dispatcher.current; @@ -46506,6 +46732,15 @@ function preinit(href, options) { // and the runtime may not be capable of responding. The function is optimistic and not critical // so we favor silent bailout over warning or erroring. } +function preinitModule(href, options) { + var dispatcher = Dispatcher.current; + + if (dispatcher) { + dispatcher.preinitModule(href, options); + } // We don't error because preinit needs to be resilient to being called in a variety of scopes + // and the runtime may not be capable of responding. The function is optimistic and not critical + // so we favor silent bailout over warning or erroring. +} { if ( @@ -46641,7 +46876,9 @@ exports.observeVisibleRects = observeVisibleRects; exports.preconnect = preconnect; exports.prefetchDNS = prefetchDNS; exports.preinit = preinit; +exports.preinitModule = preinitModule; exports.preload = preload; +exports.preloadModule = preloadModule; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = createEventHandle; exports.unstable_runWithPriority = runWithPriority; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 30baee45b9fa5..0458c099e61ed 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -15471,7 +15471,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; function preconnectAs(rel, crossOrigin, href) { var ownerDocument = document; @@ -15571,13 +15573,62 @@ function preload$1(href, options) { getStylesheetSelectorFromKey(imageSrcSet) )) || ("script" === as && - ownerDocument.querySelector("script[async]" + imageSrcSet)) || + ownerDocument.querySelector(getScriptSelectorFromKey(imageSrcSet))) || ((as = ownerDocument.createElement("link")), setInitialProperties(as, "link", href), markNodeAsHoistable(as), ownerDocument.head.appendChild(as))); } } +function preloadModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) { + var as = options && "string" === typeof options.as ? options.as : "script", + preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]', + key = preloadSelector; + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + key = getScriptKey(href); + } + if ( + !preloadPropsMap.has(key) && + ((href = { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + preloadPropsMap.set(key, href), + null === ownerDocument.querySelector(preloadSelector)) + ) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) + return; + } + as = ownerDocument.createElement("link"); + setInitialProperties(as, "link", href); + markNodeAsHoistable(as); + ownerDocument.head.appendChild(as); + } + } +} function preinit$1(href, options) { var ownerDocument = document; if ( @@ -15640,7 +15691,9 @@ function preinit$1(href, options) { (key = getScriptKey(href)), (precedence = styles.get(key)), precedence || - ((precedence = ownerDocument.querySelector("script[async]" + key)), + ((precedence = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), precedence || ((href = { src: href, @@ -15665,6 +15718,41 @@ function preinit$1(href, options) { styles.set(key, precedence)); } } +function preinitModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) + switch (options && "string" === typeof options.as ? options.as : "script") { + case "script": + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts, + key = getScriptKey(href), + resource = scripts.get(key); + resource || + ((resource = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), + resource || + ((href = { + src: href, + async: !0, + type: "module", + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + (options = preloadPropsMap.get(key)) && + adoptPreloadPropsForScript(href, options), + (resource = ownerDocument.createElement("script")), + markNodeAsHoistable(resource), + setInitialProperties(resource, "link", href), + ownerDocument.head.appendChild(resource)), + (resource = { + type: "script", + instance: resource, + count: 1, + state: null + }), + scripts.set(key, resource)); + } +} function getResource(type, currentProps, pendingProps) { currentProps = (currentProps = rootInstanceStackCursor.current) ? getHoistableRoot(currentProps) @@ -15768,6 +15856,9 @@ function preloadStylesheet(ownerDocument, key, preloadProps, state) { function getScriptKey(src) { return '[src="' + escapeSelectorAttributeValueInsideDoubleQuotes(src) + '"]'; } +function getScriptSelectorFromKey(key) { + return "script[async]" + key; +} function acquireResource(hoistableRoot, resource, props) { resource.count++; if (null === resource.instance) @@ -15828,7 +15919,7 @@ function acquireResource(hoistableRoot, resource, props) { instance$283 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$283 + getScriptSelectorFromKey(instance$283) )) ) return ( @@ -16904,7 +16995,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1829 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-5f4d33c7", + version: "18.3.0-www-classic-263bdb86", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2193 = { @@ -16934,7 +17025,7 @@ var internals$jscomp$inline_2193 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-5f4d33c7" + reconcilerVersion: "18.3.0-www-classic-263bdb86" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2194 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17230,10 +17321,18 @@ exports.preinit = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preinit(href, options); }; +exports.preinitModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preinitModule(href, options); +}; exports.preload = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preload(href, options); }; +exports.preloadModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preloadModule(href, options); +}; exports.render = function (element, container, callback) { if (!isValidContainerLegacy(container)) throw Error(formatProdErrorMessage(200)); @@ -17313,4 +17412,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-5f4d33c7"; +exports.version = "18.3.0-www-classic-263bdb86"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index d8539c93e4955..ac0986c9c6e00 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -15757,7 +15757,9 @@ var ReactDOMClientDispatcher = { prefetchDNS: prefetchDNS$1, preconnect: preconnect$1, preload: preload$1, - preinit: preinit$1 + preloadModule: preloadModule$1, + preinit: preinit$1, + preinitModule: preinitModule$1 }; function preconnectAs(rel, crossOrigin, href) { var ownerDocument = document; @@ -15857,13 +15859,62 @@ function preload$1(href, options) { getStylesheetSelectorFromKey(imageSrcSet) )) || ("script" === as && - ownerDocument.querySelector("script[async]" + imageSrcSet)) || + ownerDocument.querySelector(getScriptSelectorFromKey(imageSrcSet))) || ((as = ownerDocument.createElement("link")), setInitialProperties(as, "link", href), markNodeAsHoistable(as), ownerDocument.head.appendChild(as))); } } +function preloadModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) { + var as = options && "string" === typeof options.as ? options.as : "script", + preloadSelector = + 'link[rel="modulepreload"][as="' + + escapeSelectorAttributeValueInsideDoubleQuotes(as) + + '"][href="' + + escapeSelectorAttributeValueInsideDoubleQuotes(href) + + '"]', + key = preloadSelector; + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + key = getScriptKey(href); + } + if ( + !preloadPropsMap.has(key) && + ((href = { + rel: "modulepreload", + as: "script" !== as ? as : void 0, + href: href, + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + preloadPropsMap.set(key, href), + null === ownerDocument.querySelector(preloadSelector)) + ) { + switch (as) { + case "audioworklet": + case "paintworklet": + case "serviceworker": + case "sharedworker": + case "worker": + case "script": + if (ownerDocument.querySelector(getScriptSelectorFromKey(key))) + return; + } + as = ownerDocument.createElement("link"); + setInitialProperties(as, "link", href); + markNodeAsHoistable(as); + ownerDocument.head.appendChild(as); + } + } +} function preinit$1(href, options) { var ownerDocument = document; if ( @@ -15926,7 +15977,9 @@ function preinit$1(href, options) { (key = getScriptKey(href)), (precedence = styles.get(key)), precedence || - ((precedence = ownerDocument.querySelector("script[async]" + key)), + ((precedence = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), precedence || ((href = { src: href, @@ -15951,6 +16004,41 @@ function preinit$1(href, options) { styles.set(key, precedence)); } } +function preinitModule$1(href, options) { + var ownerDocument = document; + if ("string" === typeof href && href) + switch (options && "string" === typeof options.as ? options.as : "script") { + case "script": + var scripts = getResourcesFromRoot(ownerDocument).hoistableScripts, + key = getScriptKey(href), + resource = scripts.get(key); + resource || + ((resource = ownerDocument.querySelector( + getScriptSelectorFromKey(key) + )), + resource || + ((href = { + src: href, + async: !0, + type: "module", + crossOrigin: options ? options.crossOrigin : void 0, + integrity: options ? options.integrity : void 0 + }), + (options = preloadPropsMap.get(key)) && + adoptPreloadPropsForScript(href, options), + (resource = ownerDocument.createElement("script")), + markNodeAsHoistable(resource), + setInitialProperties(resource, "link", href), + ownerDocument.head.appendChild(resource)), + (resource = { + type: "script", + instance: resource, + count: 1, + state: null + }), + scripts.set(key, resource)); + } +} function getResource(type, currentProps, pendingProps) { currentProps = (currentProps = rootInstanceStackCursor.current) ? getHoistableRoot(currentProps) @@ -16054,6 +16142,9 @@ function preloadStylesheet(ownerDocument, key, preloadProps, state) { function getScriptKey(src) { return '[src="' + escapeSelectorAttributeValueInsideDoubleQuotes(src) + '"]'; } +function getScriptSelectorFromKey(key) { + return "script[async]" + key; +} function acquireResource(hoistableRoot, resource, props) { resource.count++; if (null === resource.instance) @@ -16114,7 +16205,7 @@ function acquireResource(hoistableRoot, resource, props) { instance$287 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$287 + getScriptSelectorFromKey(instance$287) )) ) return ( @@ -16489,7 +16580,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1788 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-00d6344c", + version: "18.3.0-www-modern-cfb2f865", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2157 = { @@ -16520,7 +16611,7 @@ var internals$jscomp$inline_2157 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-00d6344c" + reconcilerVersion: "18.3.0-www-modern-cfb2f865" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2158 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16792,10 +16883,18 @@ exports.preinit = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preinit(href, options); }; +exports.preinitModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preinitModule(href, options); +}; exports.preload = function (href, options) { var dispatcher = Dispatcher.current; dispatcher && dispatcher.preload(href, options); }; +exports.preloadModule = function (href, options) { + var dispatcher = Dispatcher.current; + dispatcher && dispatcher.preloadModule(href, options); +}; exports.unstable_batchedUpdates = batchedUpdates$1; exports.unstable_createEventHandle = function (type, options) { function eventHandle(target, callback) { @@ -16827,4 +16926,4 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-00d6344c"; +exports.version = "18.3.0-www-modern-cfb2f865"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 7ec1459cc1e5e..26bce9cf5f112 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -24328,7 +24328,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-a029c8fa"; +var ReactVersion = "18.3.0-www-classic-83b4bba5"; // Might add PROFILE later. diff --git a/compiled/facebook-www/WARNINGS b/compiled/facebook-www/WARNINGS index d1adec12b3c12..21f1aca1059f1 100644 --- a/compiled/facebook-www/WARNINGS +++ b/compiled/facebook-www/WARNINGS @@ -243,8 +243,11 @@ "ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are \"style\" and \"script\"." "ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead." "ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead." +"ReactDOM.preinitModule(): Currently the only supported \"as\" type for this function is \"script\" but received \"%s\" instead. This warning was generated for `href` \"%s\". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)" +"ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s" "ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `` tag. %s" "ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `` tag.%s" +"ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `` tag.%s" "ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot" "ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot" "ReactTestUtils.mockComponent() is deprecated. Use shallow rendering or jest.mock() instead.\n\nSee https://reactjs.org/link/test-utils-mock-component for more information."