diff --git a/.react-version b/.react-version index a9870eb754cd3f..24f2caef0b192f 100644 --- a/.react-version +++ b/.react-version @@ -1 +1 @@ -19.0.0-rc-a26e3f403e-20240611 \ No newline at end of file +19.0.0-rc-f3e09d6328-20240612 \ No newline at end of file diff --git a/package.json b/package.json index 58ec6265f68f9b..ea0be83f4bf419 100644 --- a/package.json +++ b/package.json @@ -200,19 +200,19 @@ "pretty-bytes": "5.3.0", "pretty-ms": "7.0.0", "random-seed": "0.3.0", - "react": "19.0.0-rc-a26e3f403e-20240611", + "react": "19.0.0-rc-f3e09d6328-20240612", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@19.0.0-rc-a26e3f403e-20240611", - "react-dom": "19.0.0-rc-a26e3f403e-20240611", + "react-builtin": "npm:react@19.0.0-rc-f3e09d6328-20240612", + "react-dom": "19.0.0-rc-f3e09d6328-20240612", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@19.0.0-rc-a26e3f403e-20240611", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-a26e3f403e-20240611", - "react-experimental-builtin": "npm:react@0.0.0-experimental-a26e3f403e-20240611", - "react-is-builtin": "npm:react-is@19.0.0-rc-a26e3f403e-20240611", - "react-server-dom-turbopack": "19.0.0-rc-a26e3f403e-20240611", - "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-a26e3f403e-20240611", - "react-server-dom-webpack": "19.0.0-rc-a26e3f403e-20240611", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-a26e3f403e-20240611", + "react-dom-builtin": "npm:react-dom@19.0.0-rc-f3e09d6328-20240612", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-f3e09d6328-20240612", + "react-experimental-builtin": "npm:react@0.0.0-experimental-f3e09d6328-20240612", + "react-is-builtin": "npm:react-is@19.0.0-rc-f3e09d6328-20240612", + "react-server-dom-turbopack": "19.0.0-rc-f3e09d6328-20240612", + "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-f3e09d6328-20240612", + "react-server-dom-webpack": "19.0.0-rc-f3e09d6328-20240612", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-f3e09d6328-20240612", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -222,8 +222,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.10.9", - "scheduler-builtin": "npm:scheduler@0.25.0-rc-a26e3f403e-20240611", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-a26e3f403e-20240611", + "scheduler-builtin": "npm:scheduler@0.25.0-rc-f3e09d6328-20240612", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-f3e09d6328-20240612", "seedrandom": "3.0.5", "semver": "7.3.7", "shell-quote": "1.7.3", @@ -257,10 +257,10 @@ "@babel/traverse": "7.22.5", "@types/react": "npm:types-react@19.0.0-rc.0", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0", - "react": "19.0.0-rc-a26e3f403e-20240611", - "react-dom": "19.0.0-rc-a26e3f403e-20240611", - "react-is": "19.0.0-rc-a26e3f403e-20240611", - "scheduler": "0.25.0-rc-a26e3f403e-20240611" + "react": "19.0.0-rc-f3e09d6328-20240612", + "react-dom": "19.0.0-rc-f3e09d6328-20240612", + "react-is": "19.0.0-rc-f3e09d6328-20240612", + "scheduler": "0.25.0-rc-f3e09d6328-20240612" }, "engines": { "node": ">=18.18.0", diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js index 96be8ccad13da4..fb8f167f39277a 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js @@ -291,6 +291,14 @@ if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; + break; + case 29: + type = fiber._debugInfo; + if (null != type) + for (var i = type.length - 1; 0 <= i; i--) + if ("string" === typeof type[i].name) return type[i].name; + if (null !== fiber.return) + return getComponentNameFromFiber(fiber.return); } return null; } @@ -5623,7 +5631,16 @@ var fiber = createFiber(29, x, null, returnFiber.mode); fiber.lanes = lanes; fiber.return = returnFiber; - fiber._debugInfo = currentDebugInfo; + var debugInfo = (fiber._debugInfo = currentDebugInfo); + fiber._debugOwner = returnFiber._debugOwner; + fiber._debugTask = returnFiber._debugTask; + if (null != debugInfo) + for (var i = debugInfo.length - 1; 0 <= i; i--) + if ("string" === typeof debugInfo[i].stack) { + fiber._debugOwner = debugInfo[i]; + fiber._debugTask = debugInfo[i].task; + break; + } return fiber; } finally { currentDebugInfo = prevDebugInfo; @@ -23791,14 +23808,6 @@ var didWarnAboutUndefinedDerivedState = new Set(); var didWarnAboutInvalidateContextType = new Set(); var didWarnOnInvalidCallback = new Set(); - Object.defineProperty(fakeInternalInstance, "_processChildContext", { - enumerable: !1, - value: function () { - throw Error( - "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." - ); - } - }); Object.freeze(fakeInternalInstance); var classComponentUpdater = { isMounted: function (component) { @@ -24495,11 +24504,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24554,12 +24563,12 @@ scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-experimental-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-experimental-f3e09d6328-20240612" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-experimental-a26e3f403e-20240611", + version: "19.0.0-experimental-f3e09d6328-20240612", rendererPackageName: "react-dom" }) && canUseDOM && @@ -24689,7 +24698,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js index ffd2e9d0862074..8c3ddb3a322488 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js @@ -14801,14 +14801,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1647 = React.version; if ( - "19.0.0-experimental-a26e3f403e-20240611" !== + "19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_1647 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1647, - "19.0.0-experimental-a26e3f403e-20240611" + "19.0.0-experimental-f3e09d6328-20240612" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -14827,7 +14827,7 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { var devToolsConfig$jscomp$inline_1654 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-experimental-a26e3f403e-20240611", + version: "19.0.0-experimental-f3e09d6328-20240612", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2032 = { @@ -14857,7 +14857,7 @@ var internals$jscomp$inline_2032 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-experimental-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-experimental-f3e09d6328-20240612" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2033 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -14963,4 +14963,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js index c02a261581e6e4..234511aa051305 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js @@ -291,6 +291,14 @@ if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; + break; + case 29: + type = fiber._debugInfo; + if (null != type) + for (var i = type.length - 1; 0 <= i; i--) + if ("string" === typeof type[i].name) return type[i].name; + if (null !== fiber.return) + return getComponentNameFromFiber(fiber.return); } return null; } @@ -5631,7 +5639,16 @@ var fiber = createFiber(29, x, null, returnFiber.mode); fiber.lanes = lanes; fiber.return = returnFiber; - fiber._debugInfo = currentDebugInfo; + var debugInfo = (fiber._debugInfo = currentDebugInfo); + fiber._debugOwner = returnFiber._debugOwner; + fiber._debugTask = returnFiber._debugTask; + if (null != debugInfo) + for (var i = debugInfo.length - 1; 0 <= i; i--) + if ("string" === typeof debugInfo[i].stack) { + fiber._debugOwner = debugInfo[i]; + fiber._debugTask = debugInfo[i].task; + break; + } return fiber; } finally { currentDebugInfo = prevDebugInfo; @@ -23848,14 +23865,6 @@ var didWarnAboutUndefinedDerivedState = new Set(); var didWarnAboutInvalidateContextType = new Set(); var didWarnOnInvalidCallback = new Set(); - Object.defineProperty(fakeInternalInstance, "_processChildContext", { - enumerable: !1, - value: function () { - throw Error( - "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." - ); - } - }); Object.freeze(fakeInternalInstance); var classComponentUpdater = { isMounted: function (component) { @@ -24552,11 +24561,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24611,12 +24620,12 @@ scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-experimental-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-experimental-f3e09d6328-20240612" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-experimental-a26e3f403e-20240611", + version: "19.0.0-experimental-f3e09d6328-20240612", rendererPackageName: "react-dom" }) && canUseDOM && @@ -25076,7 +25085,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js index 881b72f35d5831..a1aee2e4a8343e 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js @@ -15511,14 +15511,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1735 = React.version; if ( - "19.0.0-experimental-a26e3f403e-20240611" !== + "19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_1735 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1735, - "19.0.0-experimental-a26e3f403e-20240611" + "19.0.0-experimental-f3e09d6328-20240612" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15537,7 +15537,7 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { var devToolsConfig$jscomp$inline_1742 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-experimental-a26e3f403e-20240611", + version: "19.0.0-experimental-f3e09d6328-20240612", rendererPackageName: "react-dom" }; (function (internals) { @@ -15580,7 +15580,7 @@ var devToolsConfig$jscomp$inline_1742 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-experimental-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-experimental-f3e09d6328-20240612" }); function noop() {} function getCrossOriginStringAs(as, input) { @@ -15834,7 +15834,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js index b6843462412882..d31e337a15fee7 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js @@ -8853,5 +8853,5 @@ '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 = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js index 4e3fe9d5163036..30febb5e0e08bd 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js @@ -5887,4 +5887,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 = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js index f64be82e5b23de..48f24672896e20 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js @@ -8853,5 +8853,5 @@ '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 "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js index ff8790cceac542..bce674547a3507 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js @@ -5983,4 +5983,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 "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js index 96788c8799e38f..bfb997fbff13d1 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js @@ -7756,11 +7756,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -9453,5 +9453,5 @@ startWork(request); }); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js index 9dede7cc22720b..d412d7cc972e5c 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js @@ -6384,12 +6384,12 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-experimental-a26e3f403e-20240611" + "19.0.0-experimental-f3e09d6328-20240612" ) ); } @@ -6594,4 +6594,4 @@ exports.resume = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js index ee1a9f0c58ea21..17d12bb9657c65 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js @@ -5899,13 +5899,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_800 = React.version; if ( - "19.0.0-experimental-a26e3f403e-20240611" !== + "19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_800 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_800 + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -5993,4 +5993,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js index 93fe69672b0554..40c7317ec81742 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js @@ -7775,11 +7775,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -9468,5 +9468,5 @@ startWork(request); }); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js index 238d95c387481a..41d0d1cfcd6699 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js @@ -6492,11 +6492,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6700,4 +6700,4 @@ exports.resume = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js index e3bf8d1d531698..d8fc5c2945ddb5 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js @@ -7520,11 +7520,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -9299,5 +9299,5 @@ } }; }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js index c7c4ee8418311c..e1831153eb0ad7 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js @@ -6258,11 +6258,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6547,4 +6547,4 @@ exports.resumeToPipeableStream = function (children, postponedState, options) { } }; }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js index b888f48b1b8f57..4edc863239851b 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js @@ -291,6 +291,14 @@ if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; + break; + case 29: + type = fiber._debugInfo; + if (null != type) + for (var i = type.length - 1; 0 <= i; i--) + if ("string" === typeof type[i].name) return type[i].name; + if (null !== fiber.return) + return getComponentNameFromFiber(fiber.return); } return null; } @@ -5664,7 +5672,16 @@ var fiber = createFiber(29, x, null, returnFiber.mode); fiber.lanes = lanes; fiber.return = returnFiber; - fiber._debugInfo = currentDebugInfo; + var debugInfo = (fiber._debugInfo = currentDebugInfo); + fiber._debugOwner = returnFiber._debugOwner; + fiber._debugTask = returnFiber._debugTask; + if (null != debugInfo) + for (var i = debugInfo.length - 1; 0 <= i; i--) + if ("string" === typeof debugInfo[i].stack) { + fiber._debugOwner = debugInfo[i]; + fiber._debugTask = debugInfo[i].task; + break; + } return fiber; } finally { currentDebugInfo = prevDebugInfo; @@ -24120,14 +24137,6 @@ var didWarnAboutUndefinedDerivedState = new Set(); var didWarnAboutInvalidateContextType = new Set(); var didWarnOnInvalidCallback = new Set(); - Object.defineProperty(fakeInternalInstance, "_processChildContext", { - enumerable: !1, - value: function () { - throw Error( - "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." - ); - } - }); Object.freeze(fakeInternalInstance); var classComponentUpdater = { isMounted: function (component) { @@ -24829,11 +24838,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24888,12 +24897,12 @@ scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-experimental-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-experimental-f3e09d6328-20240612" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-experimental-a26e3f403e-20240611", + version: "19.0.0-experimental-f3e09d6328-20240612", rendererPackageName: "react-dom" }) && canUseDOM && @@ -25189,5 +25198,5 @@ } }; }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js index 79ccd7c21b79f1..4d6c59234b8865 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js @@ -15180,14 +15180,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1676 = React.version; if ( - "19.0.0-experimental-a26e3f403e-20240611" !== + "19.0.0-experimental-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_1676 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1676, - "19.0.0-experimental-a26e3f403e-20240611" + "19.0.0-experimental-f3e09d6328-20240612" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15206,7 +15206,7 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { var devToolsConfig$jscomp$inline_1683 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-experimental-a26e3f403e-20240611", + version: "19.0.0-experimental-f3e09d6328-20240612", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2066 = { @@ -15236,7 +15236,7 @@ var internals$jscomp$inline_2066 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-experimental-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-experimental-f3e09d6328-20240612" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2067 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15493,4 +15493,4 @@ exports.observeVisibleRects = function ( } }; }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js index b95eb02f58bdde..b8b9aeb863c69f 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js @@ -434,7 +434,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js index 2dbbdb4d3240ee..333fe96e5187bf 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js @@ -206,4 +206,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js index 031db3fa83de51..813de017ebddf1 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js @@ -356,5 +356,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js index 56d0263283f2c0..08dd4dd6f23634 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js @@ -151,4 +151,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom-experimental/package.json b/packages/next/src/compiled/react-dom-experimental/package.json index b069e21f8e1dfd..f08b5a927f569b 100644 --- a/packages/next/src/compiled/react-dom-experimental/package.json +++ b/packages/next/src/compiled/react-dom-experimental/package.json @@ -72,10 +72,10 @@ "./package.json": "./package.json" }, "dependencies": { - "scheduler": "0.0.0-experimental-a26e3f403e-20240611" + "scheduler": "0.0.0-experimental-f3e09d6328-20240612" }, "peerDependencies": { - "react": "0.0.0-experimental-a26e3f403e-20240611" + "react": "0.0.0-experimental-f3e09d6328-20240612" }, "browser": { "./server.js": "./server.browser.js", diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js index 77fa3e7c3971c0..669115cc6bc765 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js @@ -290,6 +290,14 @@ if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; + break; + case 29: + type = fiber._debugInfo; + if (null != type) + for (var i = type.length - 1; 0 <= i; i--) + if ("string" === typeof type[i].name) return type[i].name; + if (null !== fiber.return) + return getComponentNameFromFiber(fiber.return); } return null; } @@ -5440,7 +5448,14 @@ var fiber = createFiber(29, x, null, returnFiber.mode); fiber.lanes = lanes; fiber.return = returnFiber; - fiber._debugInfo = currentDebugInfo; + var debugInfo = (fiber._debugInfo = currentDebugInfo); + fiber._debugOwner = returnFiber._debugOwner; + if (null != debugInfo) + for (var i = debugInfo.length - 1; 0 <= i; i--) + if ("string" === typeof debugInfo[i].stack) { + fiber._debugOwner = debugInfo[i]; + break; + } return fiber; } finally { currentDebugInfo = prevDebugInfo; @@ -23446,14 +23461,6 @@ var didWarnAboutUndefinedDerivedState = new Set(); var didWarnAboutInvalidateContextType = new Set(); var didWarnOnInvalidCallback = new Set(); - Object.defineProperty(fakeInternalInstance, "_processChildContext", { - enumerable: !1, - value: function () { - throw Error( - "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." - ); - } - }); Object.freeze(fakeInternalInstance); var classComponentUpdater = { isMounted: function (component) { @@ -24150,11 +24157,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24209,12 +24216,12 @@ scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-rc-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-rc-f3e09d6328-20240612" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-rc-a26e3f403e-20240611", + version: "19.0.0-rc-f3e09d6328-20240612", rendererPackageName: "react-dom" }) && canUseDOM && @@ -24344,7 +24351,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js index d1e463b2e99b80..6d9aff3b5138c9 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js @@ -14645,14 +14645,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1666 = React.version; if ( - "19.0.0-rc-a26e3f403e-20240611" !== + "19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_1666 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1666, - "19.0.0-rc-a26e3f403e-20240611" + "19.0.0-rc-f3e09d6328-20240612" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -14671,7 +14671,7 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { var devToolsConfig$jscomp$inline_1673 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-rc-a26e3f403e-20240611", + version: "19.0.0-rc-f3e09d6328-20240612", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2051 = { @@ -14701,7 +14701,7 @@ var internals$jscomp$inline_2051 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-rc-f3e09d6328-20240612" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2052 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -14807,4 +14807,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js index 2fbf262cbb6ebd..7356ddae34e0ec 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js @@ -290,6 +290,14 @@ if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; + break; + case 29: + type = fiber._debugInfo; + if (null != type) + for (var i = type.length - 1; 0 <= i; i--) + if ("string" === typeof type[i].name) return type[i].name; + if (null !== fiber.return) + return getComponentNameFromFiber(fiber.return); } return null; } @@ -5448,7 +5456,14 @@ var fiber = createFiber(29, x, null, returnFiber.mode); fiber.lanes = lanes; fiber.return = returnFiber; - fiber._debugInfo = currentDebugInfo; + var debugInfo = (fiber._debugInfo = currentDebugInfo); + fiber._debugOwner = returnFiber._debugOwner; + if (null != debugInfo) + for (var i = debugInfo.length - 1; 0 <= i; i--) + if ("string" === typeof debugInfo[i].stack) { + fiber._debugOwner = debugInfo[i]; + break; + } return fiber; } finally { currentDebugInfo = prevDebugInfo; @@ -23503,14 +23518,6 @@ var didWarnAboutUndefinedDerivedState = new Set(); var didWarnAboutInvalidateContextType = new Set(); var didWarnOnInvalidCallback = new Set(); - Object.defineProperty(fakeInternalInstance, "_processChildContext", { - enumerable: !1, - value: function () { - throw Error( - "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." - ); - } - }); Object.freeze(fakeInternalInstance); var classComponentUpdater = { isMounted: function (component) { @@ -24207,11 +24214,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24266,12 +24273,12 @@ scheduleRoot: scheduleRoot, setRefreshHandler: setRefreshHandler, getCurrentFiber: getCurrentFiberForDevTools, - reconcilerVersion: "19.0.0-rc-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-rc-f3e09d6328-20240612" }); })({ findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 1, - version: "19.0.0-rc-a26e3f403e-20240611", + version: "19.0.0-rc-f3e09d6328-20240612", rendererPackageName: "react-dom" }) && canUseDOM && @@ -24731,7 +24738,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js index 0f92fcd8bf7bd1..b651d48005f425 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js @@ -15355,14 +15355,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1754 = React.version; if ( - "19.0.0-rc-a26e3f403e-20240611" !== + "19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_1754 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1754, - "19.0.0-rc-a26e3f403e-20240611" + "19.0.0-rc-f3e09d6328-20240612" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15381,7 +15381,7 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { var devToolsConfig$jscomp$inline_1761 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-rc-a26e3f403e-20240611", + version: "19.0.0-rc-f3e09d6328-20240612", rendererPackageName: "react-dom" }; (function (internals) { @@ -15424,7 +15424,7 @@ var devToolsConfig$jscomp$inline_1761 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-a26e3f403e-20240611" + reconcilerVersion: "19.0.0-rc-f3e09d6328-20240612" }); function noop() {} function getCrossOriginStringAs(as, input) { @@ -15678,7 +15678,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js index fdcca522d83070..4ead551549c321 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js @@ -8366,5 +8366,5 @@ '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 = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js index e8fc2987536603..ac88ab9fa9d28b 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js @@ -5493,4 +5493,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 = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js index 9f0ed4500e80bb..3265c5b206a0d6 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js @@ -8366,5 +8366,5 @@ '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 "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js index b9d35804cdcf01..b72cb8e40ed054 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js @@ -5575,4 +5575,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 "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js index cc855ce0b61115..81c542c9c85a14 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js @@ -8535,11 +8535,11 @@ didWarnAboutMaps = !1; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); exports.renderToReadableStream = function (children, options) { @@ -8632,5 +8632,5 @@ startWork(request$jscomp$0); }); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js index 41f15f33d1cb5f..68c9b52853edb9 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js @@ -5762,14 +5762,14 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_720 = React.version; if ( - "19.0.0-rc-a26e3f403e-20240611" !== + "19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_720 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_720, - "19.0.0-rc-a26e3f403e-20240611" + "19.0.0-rc-f3e09d6328-20240612" ) ); exports.renderToReadableStream = function (children, options) { @@ -5858,4 +5858,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js index a9bb9deac3c18f..d09132e7ee87a7 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js @@ -5465,13 +5465,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_724 = React.version; if ( - "19.0.0-rc-a26e3f403e-20240611" !== + "19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_724 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_724 + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -5559,4 +5559,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js index a10131ef2bc682..da5a81bd04894d 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js @@ -8550,11 +8550,11 @@ didWarnAboutMaps = !1; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); exports.renderToReadableStream = function (children, options) { @@ -8647,5 +8647,5 @@ startWork(request$jscomp$0); }); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js index 0c2b22d8dfa6b3..2e47e36870e63d 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js @@ -5856,13 +5856,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_728 = React.version; if ( - "19.0.0-rc-a26e3f403e-20240611" !== + "19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_728 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_728 + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -5950,4 +5950,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js index 5f4acfd261d871..cf4bca7cc1f1fe 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js @@ -8429,11 +8429,11 @@ didWarnAboutMaps = !1; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-a26e3f403e-20240611" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); exports.renderToPipeableStream = function (children, options) { @@ -8475,5 +8475,5 @@ } }; }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js index 834248406d6e18..2f88902978b6cd 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js @@ -5524,13 +5524,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_751 = React.version; if ( - "19.0.0-rc-a26e3f403e-20240611" !== + "19.0.0-rc-f3e09d6328-20240612" !== isomorphicReactPackageVersion$jscomp$inline_751 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_751 + - "\n - react-dom: 19.0.0-rc-a26e3f403e-20240611\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-f3e09d6328-20240612\nLearn more: https://react.dev/warnings/version-mismatch") ); function createDrainHandler(destination, request) { return function () { @@ -5805,4 +5805,4 @@ exports.renderToPipeableStream = function (children, options) { } }; }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom.development.js index 35727640885aee..4a69c8b1b68c79 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.development.js @@ -432,7 +432,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom.production.js index 2641d714146f21..97f154848c4358 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.production.js @@ -206,4 +206,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js index 366d44ac7864eb..79eb2886421bcb 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js @@ -354,5 +354,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js index 49ac486d802e1a..f7ea1ba1cea9bd 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js @@ -151,4 +151,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-dom/package.json b/packages/next/src/compiled/react-dom/package.json index 8265795fe38051..083032d50843ae 100644 --- a/packages/next/src/compiled/react-dom/package.json +++ b/packages/next/src/compiled/react-dom/package.json @@ -67,10 +67,10 @@ "./package.json": "./package.json" }, "dependencies": { - "scheduler": "0.25.0-rc-a26e3f403e-20240611" + "scheduler": "0.25.0-rc-f3e09d6328-20240612" }, "peerDependencies": { - "react": "19.0.0-rc-a26e3f403e-20240611" + "react": "19.0.0-rc-f3e09d6328-20240612" }, "browser": { "./server.js": "./server.browser.js", diff --git a/packages/next/src/compiled/react-experimental/cjs/react.development.js b/packages/next/src/compiled/react-experimental/cjs/react.development.js index d9ef3df33638fb..8f70bdf72ed99e 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.development.js @@ -1276,7 +1276,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-experimental/cjs/react.production.js b/packages/next/src/compiled/react-experimental/cjs/react.production.js index 79673e0f9603b5..c8c51a81a9b311 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.production.js @@ -559,4 +559,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js b/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js index 1d7cce566118fb..2224f58e658571 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js @@ -1024,5 +1024,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-experimental-a26e3f403e-20240611"; + exports.version = "19.0.0-experimental-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js b/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js index ab47228bcd3cb9..b426b47b717935 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js @@ -564,4 +564,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-experimental-a26e3f403e-20240611"; +exports.version = "19.0.0-experimental-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react-is/package.json b/packages/next/src/compiled/react-is/package.json index dfab8d7b2b04d7..9b77ea34cc77f5 100644 --- a/packages/next/src/compiled/react-is/package.json +++ b/packages/next/src/compiled/react-is/package.json @@ -1,6 +1,6 @@ { "name": "react-is", - "version": "19.0.0-rc-a26e3f403e-20240611", + "version": "19.0.0-rc-f3e09d6328-20240612", "description": "Brand checking of React Elements.", "main": "index.js", "sideEffects": false, diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js index c5709c08bcacc4..95883b81aadb29 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js @@ -827,7 +827,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -846,7 +845,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -917,33 +915,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1008,42 +1006,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1081,7 +1117,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1094,23 +1130,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1136,7 +1177,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1350,8 +1403,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1359,10 +1412,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1541,24 +1594,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -1845,9 +1899,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2012,7 +2083,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2024,10 +2094,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js index 5863aa40326bce..494b39576b3e72 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js @@ -479,7 +479,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -502,7 +501,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -521,7 +519,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -587,35 +584,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -645,46 +642,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -721,23 +743,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -763,7 +783,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -771,7 +803,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -952,8 +984,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -961,10 +993,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1092,8 +1124,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1280,21 +1312,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function createResponseFromOptions(options) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js index 336d66d04431d1..d8acc7ca236694 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js @@ -1002,7 +1002,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -1021,7 +1020,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1092,33 +1090,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1183,42 +1181,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1256,7 +1292,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1269,23 +1305,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1311,7 +1352,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1530,8 +1583,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1539,10 +1592,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1721,24 +1774,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -2025,9 +2079,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2200,7 +2271,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2212,10 +2282,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js index 2395dff1b79be3..5f41a5adf11b7b 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js @@ -642,7 +642,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -665,7 +664,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -684,7 +682,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -750,35 +747,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -808,46 +805,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -884,23 +906,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -926,7 +946,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -934,7 +966,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1120,8 +1152,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1129,10 +1161,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1260,8 +1292,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1448,21 +1480,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js index bfd2ed0a299704..d4c661b4aeb112 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js @@ -1002,7 +1002,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -1021,7 +1020,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1092,33 +1090,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1183,42 +1181,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1256,7 +1292,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1269,23 +1305,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1311,7 +1352,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1530,8 +1583,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1539,10 +1592,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1721,24 +1774,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -2025,9 +2079,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2092,7 +2163,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2104,10 +2174,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js index 6da299911d0d96..69ccaa6063788d 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js @@ -643,7 +643,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -666,7 +665,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -685,7 +683,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -751,35 +748,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -809,46 +806,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -885,23 +907,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -927,7 +947,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -935,7 +967,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1121,8 +1153,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1130,10 +1162,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1261,8 +1293,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1449,21 +1481,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.development.js index 02370b6dabb477..c48da7b1667c1c 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.development.js @@ -982,7 +982,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -1001,7 +1000,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1072,33 +1070,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1159,42 +1157,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1232,7 +1268,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1245,23 +1281,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1287,7 +1328,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1506,8 +1559,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1515,10 +1568,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1697,24 +1750,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -2001,9 +2055,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2068,7 +2139,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2080,10 +2150,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.production.js index 8a05335e785d4b..4e493d7e06dc43 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.unbundled.production.js @@ -627,7 +627,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -650,7 +649,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -669,7 +667,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -735,35 +732,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -789,46 +786,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -865,23 +887,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -907,7 +927,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -915,7 +947,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1101,8 +1133,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1110,10 +1142,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1241,8 +1273,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1429,21 +1461,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js index 5fe3bfb5c2c1b0..5124f47f27418d 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js @@ -629,7 +629,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -920,17 +928,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1257,6 +1263,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1461,15 +1468,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1485,7 +1488,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1495,10 +1499,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1506,7 +1508,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1519,6 +1521,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1548,48 +1556,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1624,9 +1635,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1639,8 +1650,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1653,7 +1664,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1670,6 +1681,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1681,14 +1710,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1791,11 +1820,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1806,7 +1835,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2098,8 +2127,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2120,7 +2150,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2175,14 +2208,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js index 22b33e3e749a8b..4f9c5789bddf9c 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js @@ -1325,15 +1325,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1349,7 +1345,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1359,11 +1356,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1371,6 +1369,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1391,46 +1395,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1596,10 +1600,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1610,7 +1615,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js index 309024c7e934d5..4f270bc9fb61e6 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js @@ -630,7 +630,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -931,17 +939,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1268,6 +1274,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1472,15 +1479,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1496,7 +1499,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1506,10 +1510,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1517,7 +1519,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1530,6 +1532,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1559,48 +1567,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1635,9 +1646,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1650,8 +1661,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1664,7 +1675,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1681,6 +1692,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1692,14 +1721,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1802,11 +1831,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1817,7 +1846,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2113,8 +2142,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2135,7 +2165,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2190,14 +2223,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js index 922f89505b864a..f0ca9c84102455 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js @@ -1330,15 +1330,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1354,7 +1350,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1364,11 +1361,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1376,6 +1374,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1396,46 +1400,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1601,10 +1605,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1615,7 +1620,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js index b1bd11b1bc0b88..c3450dea9519e0 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js @@ -652,7 +652,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -952,17 +960,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1289,6 +1295,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1491,15 +1498,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1515,7 +1518,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1525,10 +1529,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1536,7 +1538,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1549,6 +1551,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1578,48 +1586,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1654,9 +1665,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1669,8 +1680,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1683,7 +1694,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1700,6 +1711,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1711,14 +1740,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1821,11 +1850,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1836,7 +1865,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2119,8 +2148,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2140,7 +2170,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2195,14 +2228,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js index 5e612552db47a1..97541748099e2e 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js @@ -1341,15 +1341,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1365,7 +1361,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1375,11 +1372,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1387,6 +1385,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1407,46 +1411,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1612,10 +1616,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1626,7 +1631,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.development.js index 3351beea4b4980..6df150a28d10e8 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.development.js @@ -652,7 +652,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -952,17 +960,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1289,6 +1295,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1491,15 +1498,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1515,7 +1518,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1525,10 +1529,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1536,7 +1538,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1549,6 +1551,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1578,48 +1586,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1654,9 +1665,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1669,8 +1680,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1683,7 +1694,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1700,6 +1711,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1711,14 +1740,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1821,11 +1850,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1836,7 +1865,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2119,8 +2148,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2140,7 +2170,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2195,14 +2228,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.production.js index 905c6c88188003..119b2aa9495701 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.unbundled.production.js @@ -1341,15 +1341,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1365,7 +1361,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1375,11 +1372,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1387,6 +1385,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1407,46 +1411,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1612,10 +1616,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1626,7 +1631,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json b/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json index ecc9cad79ffa0d..887588db70507b 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json @@ -47,7 +47,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "0.0.0-experimental-a26e3f403e-20240611", - "react-dom": "0.0.0-experimental-a26e3f403e-20240611" + "react": "0.0.0-experimental-f3e09d6328-20240612", + "react-dom": "0.0.0-experimental-f3e09d6328-20240612" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js index e2c370bdae339c..29ce5b407ad844 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js @@ -718,6 +718,62 @@ function registerServerReference(proxy, reference) { knownServerReferences.set(proxy, reference); } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -738,7 +794,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -757,7 +812,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -828,33 +882,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -903,42 +957,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -976,7 +1061,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -989,23 +1074,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1031,7 +1121,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1243,8 +1345,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1252,10 +1354,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1607,41 +1709,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function createResponseFromOptions(options) { @@ -1762,6 +1887,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1776,7 +1907,8 @@ jsxChildrenParents = new WeakMap(), CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"), ObjectPrototype = Object.prototype, - knownServerReferences = new WeakMap(); + knownServerReferences = new WeakMap(), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1792,7 +1924,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1804,8 +1935,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js index 5d17f88c824a02..42ad7a10e03549 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js @@ -478,7 +478,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -501,7 +500,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -520,7 +518,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -586,35 +583,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -644,46 +641,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -720,23 +742,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -762,7 +782,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -770,7 +802,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -951,8 +983,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -960,10 +992,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1091,8 +1123,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1268,21 +1300,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function createResponseFromOptions(options) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js index 2d52852b14c753..dcbde629b6eee3 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js @@ -893,6 +893,62 @@ registerServerReference(proxy, { id: id, bound: null }, encodeFormAction); return proxy; } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -913,7 +969,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -932,7 +987,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1003,33 +1057,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1078,42 +1132,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1151,7 +1236,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1164,23 +1249,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1206,7 +1296,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1423,8 +1525,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1432,10 +1534,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1787,41 +1889,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function noServerCall() { @@ -1947,6 +2072,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1964,7 +2095,8 @@ knownServerReferences = new WeakMap(), boundCache = new WeakMap(), FunctionBind = Function.prototype.bind, - ArraySlice = Array.prototype.slice; + ArraySlice = Array.prototype.slice, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1980,7 +2112,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1992,8 +2123,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js index 278e516f42f08a..d58f9fbf816338 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js @@ -641,7 +641,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -664,7 +663,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -683,7 +681,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -749,35 +746,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -807,46 +804,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -883,23 +905,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -925,7 +945,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -933,7 +965,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1119,8 +1151,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1128,10 +1160,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1259,8 +1291,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1436,21 +1468,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js index 640893adaa3859..5a4394dd69c951 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js @@ -893,6 +893,62 @@ registerServerReference(proxy, { id: id, bound: null }, encodeFormAction); return proxy; } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -913,7 +969,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -932,7 +987,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1003,33 +1057,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1078,42 +1132,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1151,7 +1236,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1164,23 +1249,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1206,7 +1296,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1423,8 +1525,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1432,10 +1534,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1787,41 +1889,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function noServerCall() { @@ -1839,6 +1964,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1856,7 +1987,8 @@ knownServerReferences = new WeakMap(), boundCache = new WeakMap(), FunctionBind = Function.prototype.bind, - ArraySlice = Array.prototype.slice; + ArraySlice = Array.prototype.slice, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1872,7 +2004,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1884,8 +2015,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromNodeStream = function (stream, ssrManifest, options) { var response = new ResponseInstance( ssrManifest.moduleMap, diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js index 0d368479367d8d..b1ec3cec0d8ad8 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js @@ -642,7 +642,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -665,7 +664,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -684,7 +682,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -750,35 +747,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -808,46 +805,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -884,23 +906,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -926,7 +946,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -934,7 +966,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1120,8 +1152,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1129,10 +1161,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1260,8 +1292,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1437,21 +1469,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js index 3c0e8e85b04e76..f1862f9353162c 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.development.js @@ -873,6 +873,62 @@ registerServerReference(proxy, { id: id, bound: null }, encodeFormAction); return proxy; } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -893,7 +949,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -912,7 +967,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -983,33 +1037,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1054,42 +1108,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1127,7 +1212,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1140,23 +1225,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1182,7 +1272,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1399,8 +1501,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1408,10 +1510,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1763,41 +1865,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function noServerCall() { @@ -1815,6 +1940,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1832,7 +1963,8 @@ knownServerReferences = new WeakMap(), boundCache = new WeakMap(), FunctionBind = Function.prototype.bind, - ArraySlice = Array.prototype.slice; + ArraySlice = Array.prototype.slice, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1848,7 +1980,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1860,8 +1991,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromNodeStream = function (stream, ssrManifest, options) { var response = new ResponseInstance( ssrManifest.moduleMap, diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js index 42d309cdeab4f7..c77bc07d64a2c6 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.unbundled.production.js @@ -626,7 +626,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -649,7 +648,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -668,7 +666,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -734,35 +731,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -788,46 +785,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -864,23 +886,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -906,7 +926,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -914,7 +946,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1100,8 +1132,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1109,10 +1141,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1240,8 +1272,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1417,21 +1449,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js index 96c06278f8a7ba..64c7a9822006a7 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js @@ -514,7 +514,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -768,16 +776,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1063,28 +1069,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1240,7 +1246,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1250,10 +1257,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1261,7 +1266,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1270,6 +1275,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1299,46 +1310,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1373,9 +1387,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1388,8 +1402,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1400,7 +1414,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1417,6 +1431,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1428,14 +1452,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1532,11 +1556,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1547,7 +1571,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1796,7 +1820,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1849,14 +1876,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js index 97a8fbb272ed37..7a6979e5e24ad2 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js @@ -1147,23 +1147,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1293,7 +1292,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1303,11 +1303,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1315,6 +1316,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1335,44 +1342,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1534,10 +1541,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1548,7 +1556,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js index 108731c822cb86..c82e2952c0c937 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js @@ -510,7 +510,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -774,16 +782,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1069,28 +1075,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1246,7 +1252,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1256,10 +1263,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1267,7 +1272,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1276,6 +1281,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1305,46 +1316,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1379,9 +1393,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1394,8 +1408,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1406,7 +1420,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1423,6 +1437,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1434,14 +1458,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1538,11 +1562,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1553,7 +1577,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1804,7 +1828,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1857,14 +1884,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js index 32f7ed0dd24535..b30059e2580724 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js @@ -1152,23 +1152,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1298,7 +1297,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1308,11 +1308,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1320,6 +1321,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1340,44 +1347,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1539,10 +1546,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1553,7 +1561,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js index be7528478008cd..cf0cb338801bc5 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js @@ -535,7 +535,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -798,16 +806,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1093,28 +1099,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1268,7 +1274,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1278,10 +1285,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1289,7 +1294,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1298,6 +1303,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1327,46 +1338,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1401,9 +1415,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1416,8 +1430,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1428,7 +1442,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1445,6 +1459,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1456,14 +1480,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1560,11 +1584,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1575,7 +1599,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1817,7 +1841,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1870,14 +1897,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js index 85a86889bdc60d..10ebe520e92424 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js @@ -1165,23 +1165,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1309,7 +1308,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1319,11 +1319,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1331,6 +1332,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1351,44 +1358,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1550,10 +1557,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1564,7 +1572,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js index cd20aeda61e339..419c1f135d1000 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js @@ -535,7 +535,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -798,16 +806,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1093,28 +1099,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1268,7 +1274,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1278,10 +1285,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1289,7 +1294,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1298,6 +1303,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1327,46 +1338,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1401,9 +1415,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1416,8 +1430,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1428,7 +1442,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1445,6 +1459,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1456,14 +1480,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1560,11 +1584,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1575,7 +1599,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1817,7 +1841,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1870,14 +1897,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js index 8f9257cb03a1ee..18cc8a6a0aefa1 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.js @@ -1165,23 +1165,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1309,7 +1308,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1319,11 +1319,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1331,6 +1332,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1351,44 +1358,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1550,10 +1557,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1564,7 +1572,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/package.json b/packages/next/src/compiled/react-server-dom-turbopack/package.json index b5da2fcf76a8d2..e8d688052daeae 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/package.json +++ b/packages/next/src/compiled/react-server-dom-turbopack/package.json @@ -47,7 +47,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "19.0.0-rc-a26e3f403e-20240611", - "react-dom": "19.0.0-rc-a26e3f403e-20240611" + "react": "19.0.0-rc-f3e09d6328-20240612", + "react-dom": "19.0.0-rc-f3e09d6328-20240612" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js index 690640882ecfd7..bab056811f1bec 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js @@ -832,7 +832,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -851,7 +850,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -922,33 +920,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1013,42 +1011,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1086,7 +1122,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1099,23 +1135,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1141,7 +1182,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1355,8 +1408,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1364,10 +1417,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1546,24 +1599,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -1850,9 +1904,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2025,7 +2096,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2037,10 +2107,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js index b561063a58f5b1..b5016630b30d32 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js @@ -489,7 +489,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -512,7 +511,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -531,7 +529,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -597,35 +594,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -655,46 +652,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -731,23 +753,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -773,7 +793,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -781,7 +813,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -962,8 +994,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -971,10 +1003,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1102,8 +1134,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1290,21 +1322,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function createResponseFromOptions(options) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js index 68a8e68c2ca87e..c1dd17ca6a8e57 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js @@ -1003,7 +1003,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -1022,7 +1021,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1093,33 +1091,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1184,42 +1182,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1257,7 +1293,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1270,23 +1306,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1312,7 +1353,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1531,8 +1584,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1540,10 +1593,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1722,24 +1775,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -2026,9 +2080,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2201,7 +2272,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2213,10 +2283,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js index 09b92b6d21d6cf..b477fe63686b88 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js @@ -643,7 +643,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -666,7 +665,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -685,7 +683,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -751,35 +748,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -809,46 +806,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -885,23 +907,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -927,7 +947,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -935,7 +967,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1121,8 +1153,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1130,10 +1162,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1261,8 +1293,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1449,21 +1481,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js index 8c73ea3e6d10a0..beb9ad51b3bd87 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js @@ -1003,7 +1003,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -1022,7 +1021,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1093,33 +1091,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1184,42 +1182,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1257,7 +1293,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1270,23 +1306,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1312,7 +1353,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1531,8 +1584,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1540,10 +1593,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1722,24 +1775,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -2026,9 +2080,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2093,7 +2164,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2105,10 +2175,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js index 93bb0b52298afe..1f9d5be4c4b091 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js @@ -644,7 +644,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -667,7 +666,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -686,7 +684,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -752,35 +749,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -810,46 +807,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -886,23 +908,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -928,7 +948,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -936,7 +968,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1122,8 +1154,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1131,10 +1163,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1262,8 +1294,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1450,21 +1482,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js index 4463d4a540437f..c4a9174160dd3c 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js @@ -982,7 +982,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -1001,7 +1000,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1072,33 +1070,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1159,42 +1157,80 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + if (null !== chunk && "blocked" === chunk.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.stack = blockedValue._debugStack; + erroredComponent.task = blockedValue._debugTask; + (chunk._debugInfo || (chunk._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(chunk, error); + } + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1232,7 +1268,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1245,23 +1281,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1287,7 +1328,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1506,8 +1559,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1515,10 +1568,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1697,24 +1750,25 @@ return innerCall; } function initializeFakeTask(response, debugInfo) { - if (null === taskCache || "string" !== typeof debugInfo.stack) + if (!supportsCreateTask || "string" !== typeof debugInfo.stack) return null; var stack = debugInfo.stack, - cachedEntry = taskCache.get(debugInfo); + cachedEntry = debugInfo.task; if (void 0 !== cachedEntry) return cachedEntry; cachedEntry = null == debugInfo.owner ? null : initializeFakeTask(response, debugInfo.owner); - debugInfo = console.createTask.bind( + var createTaskFn = console.createTask.bind( console, "<" + (debugInfo.name || "...") + ">" ); - stack = buildFakeCallStack(response, stack, debugInfo); - return null === cachedEntry + stack = buildFakeCallStack(response, stack, createTaskFn); + null === cachedEntry ? ((response = response._debugRootTask), - null != response ? response.run(stack) : stack()) - : cachedEntry.run(stack); + (response = null != response ? response.run(stack) : stack())) + : (response = cachedEntry.run(stack)); + return (debugInfo.task = response); } function mergeBuffer(buffer, lastChunk) { for ( @@ -2001,9 +2055,26 @@ writable: !0, value: validated }); - null !== initializingChunkBlockedModel - ? ((key = Object.freeze.bind(Object, value.props)), - initializingChunk.then(key, key)) + null !== initializingHandler + ? ((stack = initializingHandler), + (initializingHandler = stack.parent), + stack.errored + ? ((key = new Chunk("rejected", null, stack.value, response)), + (stack = { + name: getComponentNameFromType(value.type) || "", + owner: value._owner + }), + (stack.stack = value._debugStack), + (stack.task = value._debugTask), + (key._debugInfo = [stack]), + (value = createLazyChunkWrapper(key))) + : 0 < stack.deps && + ((key = new Chunk("blocked", null, null, response)), + (stack.value = value), + (stack.chunk = key), + (value = Object.freeze.bind(Object, value.props)), + key.then(value, value), + (value = createLazyChunkWrapper(key)))) : Object.freeze(value.props); } return value; @@ -2068,7 +2139,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -2080,10 +2150,8 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null, + var initializingHandler = null, supportsCreateTask = !!console.createTask, - taskCache = supportsCreateTask ? new WeakMap() : null, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, frameRegExp = diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js index 11b927f8d01b5e..57f323fe039fd2 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js @@ -627,7 +627,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -650,7 +649,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -669,7 +667,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -735,35 +732,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -789,46 +786,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -865,23 +887,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -907,7 +927,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -915,7 +947,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1101,8 +1133,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1110,10 +1142,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1241,8 +1273,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1429,21 +1461,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js index 5179c2f49fcd16..7d495cec788500 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js @@ -633,7 +633,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -924,17 +932,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1261,6 +1267,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1465,15 +1472,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1489,7 +1492,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1499,10 +1503,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1510,7 +1512,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1523,6 +1525,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1552,48 +1560,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1628,9 +1639,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1643,8 +1654,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1657,7 +1668,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1674,6 +1685,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1685,14 +1714,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1795,11 +1824,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1810,7 +1839,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2102,8 +2131,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2124,7 +2154,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2179,14 +2212,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js index 611c6ee0bfd254..5ca2a56b0d9980 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js @@ -1325,15 +1325,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1349,7 +1345,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1359,11 +1356,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1371,6 +1369,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1391,46 +1395,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1596,10 +1600,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1610,7 +1615,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js index ba88f85472a8bf..6b6d4ddc6ec1bc 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js @@ -634,7 +634,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -935,17 +943,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1272,6 +1278,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1476,15 +1483,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1500,7 +1503,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1510,10 +1514,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1521,7 +1523,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1534,6 +1536,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1563,48 +1571,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1639,9 +1650,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1654,8 +1665,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1668,7 +1679,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1685,6 +1696,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1696,14 +1725,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1806,11 +1835,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1821,7 +1850,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2117,8 +2146,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2139,7 +2169,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2194,14 +2227,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js index d4f634fca6b028..a92c9b8a20e352 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js @@ -1330,15 +1330,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1354,7 +1350,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1364,11 +1361,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1376,6 +1374,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1396,46 +1400,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1601,10 +1605,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1615,7 +1620,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js index d1e6de72f726df..76f6ce2fac07c9 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js @@ -656,7 +656,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -956,17 +964,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1293,6 +1299,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1495,15 +1502,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1519,7 +1522,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1529,10 +1533,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1540,7 +1542,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1553,6 +1555,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1582,48 +1590,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1658,9 +1669,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1673,8 +1684,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1687,7 +1698,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1704,6 +1715,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1715,14 +1744,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1825,11 +1854,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1840,7 +1869,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2123,8 +2152,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2144,7 +2174,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2199,14 +2232,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js index cd43f000ff306d..b84269b8041fbf 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js @@ -1341,15 +1341,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1365,7 +1361,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1375,11 +1372,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1387,6 +1385,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1407,46 +1411,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1612,10 +1616,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1626,7 +1631,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js index c49ca70da3253a..f881a78c8b003d 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js @@ -656,7 +656,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -956,17 +964,15 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; owner.stack = stack; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; warnForMissingKey(request, key, validated, owner); } prepareToUseHooksForComponent(prevThenableState, owner); @@ -1293,6 +1299,7 @@ }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1495,15 +1502,11 @@ ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath, key), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath, key); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1519,7 +1522,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1529,10 +1533,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1540,7 +1542,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1553,6 +1555,12 @@ : value._debugStack, value._store.validated ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1582,48 +1590,51 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = TaintRegistryObjects.get(value); - void 0 !== _writtenObjects && throwTaintViolation(_writtenObjects); - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1658,9 +1669,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1673,8 +1684,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1687,7 +1698,7 @@ 0 ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1704,6 +1715,24 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "string" === typeof value.stack + ) + return ( + (request = { + name: value.name, + env: value.env, + owner: value.owner + }), + (request.stack = value.stack), + request + ); if ("Object" !== objectName(value)) error$jscomp$2( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1715,14 +1744,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1825,11 +1854,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1840,7 +1869,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -2123,8 +2152,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }; - methodName = [methodName, stackTrace, owner, request.environmentName]; + var counter = { objectCount: 0 }, + env = request.environmentName(); + methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { try { @@ -2144,7 +2174,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -2199,14 +2232,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js index c9e8a63deda70b..9748327f15cdc9 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js @@ -1341,15 +1341,11 @@ function renderModel(request, task, parent, key, value) { ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; - if (parent) - return ( - request.pendingChunks++, - (task = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, key)), - emitErrorChunk(request, task, prevKeyPath), - serializeLazyID(task) - ); - throw key; + request.pendingChunks++; + task = request.nextChunkId++; + prevKeyPath = logRecoverableError(request, key); + emitErrorChunk(request, task, prevKeyPath); + return parent ? serializeLazyID(task) : serializeByValueID(task); } } function renderModelDestructive( @@ -1365,7 +1361,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1375,11 +1372,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1387,6 +1385,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof value && + null !== value && + null !== elementReference && + (writtenObjects.has(value) || + writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1407,46 +1411,46 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = TaintRegistryObjects.get(value); - void 0 !== writtenObjects && throwTaintViolation(writtenObjects); - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = TaintRegistryObjects.get(value); + void 0 !== elementReference && throwTaintViolation(elementReference); + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1612,10 +1616,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1626,7 +1631,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json b/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json index 3d8a40ecc4db3e..78e6a2eac3e557 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json @@ -46,8 +46,8 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "0.0.0-experimental-a26e3f403e-20240611", - "react-dom": "0.0.0-experimental-a26e3f403e-20240611", + "react": "0.0.0-experimental-f3e09d6328-20240612", + "react-dom": "0.0.0-experimental-f3e09d6328-20240612", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js index 3ded60f37c9169..10cc3452149a23 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js @@ -723,6 +723,62 @@ function registerServerReference(proxy, reference) { knownServerReferences.set(proxy, reference); } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -743,7 +799,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -762,7 +817,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -833,33 +887,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -908,42 +962,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -981,7 +1066,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -994,23 +1079,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1036,7 +1126,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1248,8 +1350,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1257,10 +1359,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1612,41 +1714,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function createResponseFromOptions(options) { @@ -1775,6 +1900,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1789,7 +1920,8 @@ jsxChildrenParents = new WeakMap(), CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"), ObjectPrototype = Object.prototype, - knownServerReferences = new WeakMap(); + knownServerReferences = new WeakMap(), + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1805,7 +1937,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1817,8 +1948,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js index c5412f163da2cc..0b948ed2009d51 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js @@ -488,7 +488,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -511,7 +510,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -530,7 +528,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -596,35 +593,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -654,46 +651,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -730,23 +752,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -772,7 +792,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -780,7 +812,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -961,8 +993,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -970,10 +1002,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1101,8 +1133,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1278,21 +1310,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function createResponseFromOptions(options) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js index 18fe1023cec752..0f015166987635 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js @@ -894,6 +894,62 @@ registerServerReference(proxy, { id: id, bound: null }, encodeFormAction); return proxy; } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -914,7 +970,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -933,7 +988,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1004,33 +1058,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1079,42 +1133,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1152,7 +1237,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1165,23 +1250,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1207,7 +1297,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1424,8 +1526,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1433,10 +1535,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1788,41 +1890,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function noServerCall() { @@ -1948,6 +2073,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1965,7 +2096,8 @@ knownServerReferences = new WeakMap(), boundCache = new WeakMap(), FunctionBind = Function.prototype.bind, - ArraySlice = Array.prototype.slice; + ArraySlice = Array.prototype.slice, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1981,7 +2113,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1993,8 +2124,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js index a8f504955328b9..38fe9db4412595 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js @@ -642,7 +642,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -665,7 +664,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -684,7 +682,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -750,35 +747,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -808,46 +805,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -884,23 +906,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -926,7 +946,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -934,7 +966,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1120,8 +1152,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1129,10 +1161,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1260,8 +1292,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1437,21 +1469,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js index 03788b67f14637..d88cdf638308c9 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js @@ -894,6 +894,62 @@ registerServerReference(proxy, { id: id, bound: null }, encodeFormAction); return proxy; } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -914,7 +970,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -933,7 +988,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -1004,33 +1058,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1079,42 +1133,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1152,7 +1237,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1165,23 +1250,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1207,7 +1297,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1424,8 +1526,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1433,10 +1535,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1788,41 +1890,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function noServerCall() { @@ -1840,6 +1965,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1857,7 +1988,8 @@ knownServerReferences = new WeakMap(), boundCache = new WeakMap(), FunctionBind = Function.prototype.bind, - ArraySlice = Array.prototype.slice; + ArraySlice = Array.prototype.slice, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1873,7 +2005,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1885,8 +2016,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromNodeStream = function (stream, ssrManifest, options) { var response = new ResponseInstance( ssrManifest.moduleMap, diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js index 98db7b7c1f54e5..d27dce2c759b28 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js @@ -643,7 +643,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -666,7 +665,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -685,7 +683,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -751,35 +748,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -809,46 +806,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -885,23 +907,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -927,7 +947,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -935,7 +967,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1121,8 +1153,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1130,10 +1162,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1261,8 +1293,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1438,21 +1470,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js index 7e059e95da3259..de8d0d76dee6f6 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js @@ -873,6 +873,62 @@ registerServerReference(proxy, { id: id, bound: null }, encodeFormAction); return proxy; } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} + } + return null; + } function Chunk(status, value, reason, response) { this.status = status; this.value = value; @@ -893,7 +949,6 @@ return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -912,7 +967,6 @@ break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -983,33 +1037,33 @@ } } function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), - (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error$1) { (chunk.status = "rejected"), (chunk.reason = error$1); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -1054,42 +1108,73 @@ chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } - function createModelResolver( - chunk, + function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; - } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null - }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } parentObject[key] = map(response, value); "" === key && - null === blocked.value && - (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; - } - function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + null === handler.value && + (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + ("object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE && + ((blockedValue = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }), + (chunk._debugInfo || (chunk._debugInfo = [])).push(blockedValue)), + triggerErrorOnChunk(chunk, error)); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; + } else + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 + }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -1127,7 +1212,7 @@ id._debugInfo && ("object" !== typeof response || null === response || - (!Array.isArray(response) && + (!isArrayImpl(response) && "function" !== typeof response[ASYNC_ITERATOR] && response.$$typeof !== REACT_ELEMENT_TYPE) || response._debugInfo || @@ -1140,23 +1225,28 @@ return response; case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) + return waitForReference( + id, + parentObject, + key, + response, + map, + reference ); - return null; default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -1182,7 +1272,19 @@ } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -1399,8 +1501,8 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(response); - _chunk2.then( + var _chunk3 = createPendingChunk(response); + _chunk3.then( function (v) { return controller.enqueue(v); }, @@ -1408,10 +1510,10 @@ return controller.error(e); } ); - previousBlockedChunk = _chunk2; + previousBlockedChunk = _chunk3; chunk.then(function () { - previousBlockedChunk === _chunk2 && (previousBlockedChunk = null); - resolveModelChunk(_chunk2, json); + previousBlockedChunk === _chunk3 && (previousBlockedChunk = null); + resolveModelChunk(_chunk3, json); }); } }, @@ -1763,41 +1865,64 @@ } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? (value[0] === REACT_ELEMENT_TYPE - ? ((key = { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - props: value[3], - _owner: value[4] - }), - Object.defineProperty(key, "ref", { - enumerable: !1, - get: nullRefGetter - }), - (key._store = {}), - Object.defineProperty(key._store, "validated", { - configurable: !1, - enumerable: !1, - writable: !0, - value: 1 - }), - Object.defineProperty(key, "_debugInfo", { - configurable: !1, - enumerable: !1, - writable: !0, - value: null - }), - null !== initializingChunkBlockedModel - ? ((value = Object.freeze.bind(Object, key.props)), - initializingChunk.then(value, value)) - : Object.freeze(key.props)) - : (key = value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + props: value[3], + _owner: value[4] + }), + Object.defineProperty(key, "ref", { + enumerable: !1, + get: nullRefGetter + }), + (key._store = {}), + Object.defineProperty(key._store, "validated", { + configurable: !1, + enumerable: !1, + writable: !0, + value: 1 + }), + Object.defineProperty(key, "_debugInfo", { + configurable: !1, + enumerable: !1, + writable: !0, + value: null + }), + null !== initializingHandler) + ) { + var handler = initializingHandler; + initializingHandler = handler.parent; + handler.errored + ? ((value = new Chunk( + "rejected", + null, + handler.value, + response + )), + (key = { + name: getComponentNameFromType(key.type) || "", + owner: key._owner + }), + (value._debugInfo = [key]), + (key = createLazyChunkWrapper(value))) + : 0 < handler.deps && + ((value = new Chunk("blocked", null, null, response)), + (handler.value = key), + (handler.chunk = value), + (key = Object.freeze.bind(Object, key.props)), + value.then(key, key), + (key = createLazyChunkWrapper(value))); + } else Object.freeze(key.props); + else key = value; + return key; + } + return value; }; } function noServerCall() { @@ -1815,6 +1940,12 @@ ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), + REACT_PORTAL_TYPE = Symbol.for("react.portal"), + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), + REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), + REACT_PROFILER_TYPE = Symbol.for("react.profiler"); + Symbol.for("react.provider"); + var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), @@ -1832,7 +1963,8 @@ knownServerReferences = new WeakMap(), boundCache = new WeakMap(), FunctionBind = Function.prototype.bind, - ArraySlice = Array.prototype.slice; + ArraySlice = Array.prototype.slice, + REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -1848,7 +1980,6 @@ break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); @@ -1860,8 +1991,7 @@ reject && reject(this.reason); } }; - var initializingChunk = null, - initializingChunkBlockedModel = null; + var initializingHandler = null; exports.createFromNodeStream = function (stream, ssrManifest, options) { var response = new ResponseInstance( ssrManifest.moduleMap, diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js index 2e87485e3d7049..9abacce600dbcf 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js @@ -626,7 +626,6 @@ Chunk.prototype.then = function (resolve, reject) { break; case "pending": case "blocked": - case "cyclic": resolve && (null === this.value && (this.value = []), this.value.push(resolve)); reject && @@ -649,7 +648,6 @@ function readChunk(chunk) { return chunk.value; case "pending": case "blocked": - case "cyclic": throw chunk; default: throw chunk.reason; @@ -668,7 +666,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { break; case "pending": case "blocked": - case "cyclic": if (chunk.value) for (var i = 0; i < resolveListeners.length; i++) chunk.value.push(resolveListeners[i]); @@ -734,35 +731,35 @@ function resolveModuleChunk(chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -var initializingChunk = null, - initializingChunkBlockedModel = null; +var initializingHandler = null; function initializeModelChunk(chunk) { - var prevChunk = initializingChunk, - prevBlocked = initializingChunkBlockedModel; - initializingChunk = chunk; - initializingChunkBlockedModel = null; + var prevHandler = initializingHandler; + initializingHandler = null; var resolvedModel = chunk.value; - chunk.status = "cyclic"; + chunk.status = "blocked"; chunk.value = null; chunk.reason = null; try { - var value = JSON.parse(resolvedModel, chunk._response._fromJSON); - if ( - null !== initializingChunkBlockedModel && - 0 < initializingChunkBlockedModel.deps - ) - (initializingChunkBlockedModel.value = value), (chunk.status = "blocked"); - else { - var resolveListeners = chunk.value; - chunk.status = "fulfilled"; - chunk.value = value; - null !== resolveListeners && wakeChunk(resolveListeners, value); + var value = JSON.parse(resolvedModel, chunk._response._fromJSON), + resolveListeners = chunk.value; + null !== resolveListeners && + ((chunk.value = null), + (chunk.reason = null), + wakeChunk(resolveListeners, value)); + if (null !== initializingHandler) { + if (initializingHandler.errored) throw initializingHandler.value; + if (0 < initializingHandler.deps) { + initializingHandler.value = value; + initializingHandler.chunk = chunk; + return; + } } + chunk.status = "fulfilled"; + chunk.value = value; } catch (error) { (chunk.status = "rejected"), (chunk.reason = error); } finally { - (initializingChunk = prevChunk), - (initializingChunkBlockedModel = prevBlocked); + initializingHandler = prevHandler; } } function initializeModuleChunk(chunk) { @@ -788,46 +785,71 @@ function reportGlobalError(response, error) { "pending" === chunk.status && triggerErrorOnChunk(chunk, error); }); } +function createLazyChunkWrapper(chunk) { + return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk }; +} function getChunk(response, id) { var chunks = response._chunks, chunk = chunks.get(id); chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } -function createModelResolver( - chunk, +function waitForReference( + referencedChunk, parentObject, key, - cyclic, response, map, path ) { - if (initializingChunkBlockedModel) { - var blocked = initializingChunkBlockedModel; - cyclic || blocked.deps++; + function fulfill(value) { + for (var i = 1; i < path.length; i++) { + for (; value.$$typeof === REACT_LAZY_TYPE; ) + if (((value = value._payload), value === handler.chunk)) + value = handler.value; + else if ("fulfilled" === value.status) value = value.value; + else { + path.splice(0, i - 1); + value.then(fulfill, reject); + return; + } + value = value[path[i]]; + } + parentObject[key] = map(response, value); + "" === key && null === handler.value && (handler.value = parentObject[key]); + handler.deps--; + 0 === handler.deps && + ((i = handler.chunk), + null !== i && + "blocked" === i.status && + ((value = i.value), + (i.status = "fulfilled"), + (i.value = handler.value), + null !== value && wakeChunk(value, handler.value))); + } + function reject(error) { + if (!handler.errored) { + handler.errored = !0; + handler.value = error; + var chunk = handler.chunk; + null !== chunk && + "blocked" === chunk.status && + triggerErrorOnChunk(chunk, error); + } + } + if (initializingHandler) { + var handler = initializingHandler; + handler.deps++; } else - blocked = initializingChunkBlockedModel = { - deps: cyclic ? 0 : 1, - value: null + handler = initializingHandler = { + parent: null, + chunk: null, + value: null, + deps: 1, + errored: !1 }; - return function (value) { - for (var i = 1; i < path.length; i++) value = value[path[i]]; - parentObject[key] = map(response, value); - "" === key && null === blocked.value && (blocked.value = parentObject[key]); - blocked.deps--; - 0 === blocked.deps && - "blocked" === chunk.status && - ((value = chunk.value), - (chunk.status = "fulfilled"), - (chunk.value = blocked.value), - null !== value && wakeChunk(value, blocked.value)); - }; -} -function createModelReject(chunk) { - return function (error) { - return triggerErrorOnChunk(chunk, error); - }; + referencedChunk.then(fulfill, reject); + return null; } function createServerReferenceProxy(response, metaData) { function proxy() { @@ -864,23 +886,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) { return map(response, parentObject); case "pending": case "blocked": - case "cyclic": - var parentChunk = initializingChunk; - id.then( - createModelResolver( - parentChunk, - parentObject, - key, - "cyclic" === id.status, - response, - map, - reference - ), - createModelReject(parentChunk) - ); - return null; + return waitForReference(id, parentObject, key, response, map, reference); default: - throw id.reason; + return ( + initializingHandler + ? ((initializingHandler.errored = !0), + (initializingHandler.value = id.reason)) + : (initializingHandler = { + parent: null, + chunk: null, + value: id.reason, + deps: 0, + errored: !0 + }), + null + ); } } function createMap(response, model) { @@ -906,7 +926,19 @@ function createModel(response, model) { } function parseModelString(response, parentObject, key, value) { if ("$" === value[0]) { - if ("$" === value) return REACT_ELEMENT_TYPE; + if ("$" === value) + return ( + null !== initializingHandler && + "0" === key && + (initializingHandler = { + parent: initializingHandler, + chunk: null, + value: null, + deps: 0, + errored: !1 + }), + REACT_ELEMENT_TYPE + ); switch (value[1]) { case "$": return value.slice(1); @@ -914,7 +946,7 @@ function parseModelString(response, parentObject, key, value) { return ( (parentObject = parseInt(value.slice(2), 16)), (response = getChunk(response, parentObject)), - { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk } + createLazyChunkWrapper(response) ); case "@": if (2 === value.length) return new Promise(function () {}); @@ -1100,8 +1132,8 @@ function startReadableStream(response, id, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$51 = createPendingChunk(response); - chunk$51.then( + var chunk$52 = createPendingChunk(response); + chunk$52.then( function (v) { return controller.enqueue(v); }, @@ -1109,10 +1141,10 @@ function startReadableStream(response, id, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$51; + previousBlockedChunk = chunk$52; chunk.then(function () { - previousBlockedChunk === chunk$51 && (previousBlockedChunk = null); - resolveModelChunk(chunk$51, json); + previousBlockedChunk === chunk$52 && (previousBlockedChunk = null); + resolveModelChunk(chunk$52, json); }); } }, @@ -1240,8 +1272,8 @@ function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; byteLength = new Uint8Array(byteLength); - for (var i$52 = (i = 0); i$52 < l; i$52++) { - var chunk = buffer[i$52]; + for (var i$53 = (i = 0); i$53 < l; i$53++) { + var chunk = buffer[i$53]; byteLength.set(chunk, i); i += chunk.byteLength; } @@ -1417,21 +1449,37 @@ function processFullRow(response, id, tag, buffer, chunk) { } function createFromJSONCallback(response) { return function (key, value) { - return "string" === typeof value - ? parseModelString(response, this, key, value) - : "object" === typeof value && null !== value - ? ((key = - value[0] === REACT_ELEMENT_TYPE - ? { - $$typeof: REACT_ELEMENT_TYPE, - type: value[1], - key: value[2], - ref: null, - props: value[3] - } - : value), - key) - : value; + if ("string" === typeof value) + return parseModelString(response, this, key, value); + if ("object" === typeof value && null !== value) { + if (value[0] === REACT_ELEMENT_TYPE) { + if ( + ((key = { + $$typeof: REACT_ELEMENT_TYPE, + type: value[1], + key: value[2], + ref: null, + props: value[3] + }), + null !== initializingHandler) + ) + if ( + ((value = initializingHandler), + (initializingHandler = value.parent), + value.errored) + ) + (key = new Chunk("rejected", null, value.value, response)), + (key = createLazyChunkWrapper(key)); + else if (0 < value.deps) { + var blockedChunk = new Chunk("blocked", null, null, response); + value.value = key; + value.chunk = blockedChunk; + key = createLazyChunkWrapper(blockedChunk); + } + } else key = value; + return key; + } + return value; }; } function noServerCall() { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js index 32dc04039ed60a..f3f56f88acb165 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js @@ -518,7 +518,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -772,16 +780,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1067,28 +1073,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1244,7 +1250,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1254,10 +1261,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1265,7 +1270,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1274,6 +1279,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1303,46 +1314,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1377,9 +1391,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1392,8 +1406,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1404,7 +1418,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1421,6 +1435,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1432,14 +1456,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1536,11 +1560,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1551,7 +1575,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1800,7 +1824,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1853,14 +1880,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js index f875244ed5c720..6f878e7e45214c 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js @@ -1147,23 +1147,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1293,7 +1292,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1303,11 +1303,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1315,6 +1316,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1335,44 +1342,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1534,10 +1541,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1548,7 +1556,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js index 327f2bef38e554..017fbc8a4be926 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js @@ -514,7 +514,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -778,16 +786,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1073,28 +1079,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1250,7 +1256,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1260,10 +1267,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1271,7 +1276,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1280,6 +1285,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1309,46 +1320,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1383,9 +1397,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1398,8 +1412,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1410,7 +1424,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1427,6 +1441,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1438,14 +1462,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1542,11 +1566,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1557,7 +1581,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1808,7 +1832,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1861,14 +1888,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js index 1cab5403423059..f8f6024ac56fd9 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js @@ -1152,23 +1152,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1298,7 +1297,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1308,11 +1308,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1320,6 +1321,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1340,44 +1347,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1539,10 +1546,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1553,7 +1561,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js index 94dd6a78df232e..253db7a53542cf 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js @@ -539,7 +539,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -802,16 +810,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1097,28 +1103,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1272,7 +1278,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1282,10 +1289,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1293,7 +1298,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1302,6 +1307,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1331,46 +1342,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1405,9 +1419,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1420,8 +1434,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1432,7 +1446,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1449,6 +1463,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1460,14 +1484,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1564,11 +1588,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1579,7 +1603,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1821,7 +1845,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1874,14 +1901,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js index 1b4c7a48c16f75..4e714fe0c048fb 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js @@ -1165,23 +1165,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1309,7 +1308,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1319,11 +1319,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1331,6 +1332,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1351,44 +1358,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1550,10 +1557,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1564,7 +1572,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js index 37857fd5ea6e4b..774ee118a32820 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js @@ -539,7 +539,15 @@ this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.environmentName = - void 0 === environmentName ? "Server" : environmentName; + void 0 === environmentName + ? function () { + return "Server"; + } + : "function" !== typeof environmentName + ? function () { + return environmentName; + } + : environmentName; this.didWarnForKey = null; model = createTask(this, model, null, !1, abortSet); pingedTasks.push(model); @@ -802,16 +810,14 @@ if (null !== prevThenableState) owner = prevThenableState._componentDebugInfo; else { - var componentName = Component.displayName || Component.name || ""; + var componentDebugID = debugID, + componentName = Component.displayName || Component.name || "", + componentEnv = request.environmentName(); request.pendingChunks++; - var componentDebugID = debugID; - owner = { - name: componentName, - env: request.environmentName, - owner: owner - }; + owner = { name: componentName, env: componentEnv, owner: owner }; outlineModel(request, owner); emitDebugChunk(request, componentDebugID, owner); + task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, owner); props = callComponentInDEV(Component, props, owner); @@ -1097,28 +1103,28 @@ ? serializeLazyID(JSCompiler_inline_result.id) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (originalValue.status = 3), - (originalValue = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? serializeLazyID(originalValue) - : serializeByValueID(originalValue)); - else if ( - ((originalValue.keyPath = prevKeyPath), - (originalValue.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (originalValue = request.nextChunkId++), - (prevKeyPath = logRecoverableError(request, value)), - emitErrorChunk(request, originalValue, prevKeyPath, value), - (JSCompiler_inline_result = serializeLazyID(originalValue)); - else throw value; + else + thrownValue === AbortSigil + ? ((originalValue.status = 3), + (originalValue = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))) + : ((originalValue.keyPath = prevKeyPath), + (originalValue.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (originalValue = request.nextChunkId++), + (prevKeyPath = logRecoverableError(request, value)), + emitErrorChunk(request, originalValue, prevKeyPath, value), + (JSCompiler_inline_result = parentPropertyName + ? serializeLazyID(originalValue) + : serializeByValueID(originalValue))); } return JSCompiler_inline_result; }, thenableState: null }; + task.environmentName = request.environmentName(); abortSet.add(task); return task; } @@ -1272,7 +1278,8 @@ if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var _writtenObjects = request.writtenObjects; + var elementReference = null, + _writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var _existingReference = _writtenObjects.get(value); if (void 0 !== _existingReference) @@ -1282,10 +1289,8 @@ -1 === parentPropertyName.indexOf(":") && ((parent = _writtenObjects.get(parent)), void 0 !== parent && - _writtenObjects.set( - value, - parent + ":" + parentPropertyName - )); + ((elementReference = parent + ":" + parentPropertyName), + _writtenObjects.set(value, elementReference))); } if ((parentPropertyName = value._debugInfo)) { if (null === debugID) return outlineTask(request, task); @@ -1293,7 +1298,7 @@ } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + value = renderElement( request, task, value.type, @@ -1302,6 +1307,12 @@ parentPropertyName, value._owner ); + "object" === typeof value && + null !== value && + null !== elementReference && + (_writtenObjects.has(value) || + _writtenObjects.set(value, elementReference)); + return value; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = callLazyInitInDEV(value); @@ -1331,46 +1342,49 @@ ); if ( void 0 !== request.temporaryReferences && - ((_writtenObjects = request.temporaryReferences.get(value)), - void 0 !== _writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + _writtenObjects; - _writtenObjects = request.writtenObjects; - _existingReference = _writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + _writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== _existingReference) { + if (void 0 !== _writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return ( "$@" + serializeThenable(request, task, value).toString(16) ); if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - _writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== _existingReference) + if (void 0 !== _writtenObjects) if (modelRoot === value) modelRoot = null; - else return _existingReference; + else return _writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((_existingReference = _writtenObjects.get(parent)), - void 0 !== _existingReference) + ((_writtenObjects = elementReference.get(parent)), + void 0 !== _writtenObjects) ) { - var propertyName = parentPropertyName; + _existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + _existingReference = "type"; break; case "2": - propertyName = "key"; + _existingReference = "key"; break; case "3": - propertyName = "props"; + _existingReference = "props"; } - _writtenObjects.set(value, _existingReference + ":" + propertyName); + elementReference.set( + value, + _writtenObjects + ":" + _existingReference + ); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) return serializeMap(request, value); @@ -1405,9 +1419,9 @@ return serializeTypedArray(request, "V", value); if ("function" === typeof Blob && value instanceof Blob) return serializeBlob(request, value); - if ((_writtenObjects = getIteratorFn(value))) + if ((elementReference = getIteratorFn(value))) return ( - (parentPropertyName = _writtenObjects.call(value)), + (parentPropertyName = elementReference.call(value)), parentPropertyName === value ? "$i" + outlineModel(request, Array.from(parentPropertyName)).toString( @@ -1420,8 +1434,8 @@ value instanceof ReadableStream ) return serializeReadableStream(request, task, value); - _writtenObjects = value[ASYNC_ITERATOR]; - if ("function" === typeof _writtenObjects) + elementReference = value[ASYNC_ITERATOR]; + if ("function" === typeof elementReference) return ( null !== task.keyPath ? ((value = [ @@ -1432,7 +1446,7 @@ null ]), (value = task.implicitSlot ? [value] : value)) - : ((parentPropertyName = _writtenObjects.call(value)), + : ((parentPropertyName = elementReference.call(value)), (value = serializeAsyncIterable( request, task, @@ -1449,6 +1463,16 @@ throw Error( "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." ); + if ( + "object" === typeof value.task && + null !== value.task && + "function" === typeof value.task.run && + "string" === typeof value.name && + "string" === typeof value.env && + void 0 !== value.owner && + "undefined" === typeof value.stack + ) + return { name: value.name, env: value.env, owner: value.owner }; if ("Object" !== objectName(value)) error$jscomp$0( "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s", @@ -1460,14 +1484,14 @@ request = Object.getOwnPropertyNames(value); for (task = 0; task < request.length; task++) if ( - ((_writtenObjects = Object.getOwnPropertyDescriptor( + ((elementReference = Object.getOwnPropertyDescriptor( value, request[task] )), - !_writtenObjects || - (!_writtenObjects.enumerable && + !elementReference || + (!elementReference.enumerable && (("key" !== request[task] && "ref" !== request[task]) || - "function" !== typeof _writtenObjects.get))) + "function" !== typeof elementReference.get))) ) { request = !1; break a; @@ -1564,11 +1588,11 @@ } if ("symbol" === typeof value) { task = request.writtenSymbols; - _writtenObjects = task.get(value); - if (void 0 !== _writtenObjects) - return serializeByValueID(_writtenObjects); - _writtenObjects = value.description; - if (Symbol.for(_writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1579,7 +1603,7 @@ parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + _writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); @@ -1821,7 +1845,10 @@ } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) - request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]); + request.pendingChunks++, + "string" === typeof debugInfo[i].name && + outlineModel(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { var id = task.id; @@ -1874,14 +1901,20 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) + if ("object" === typeof resolvedModel && null !== resolvedModel) { request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ), - emitChunk(request, task, resolvedModel); - else { - var json = stringify(resolvedModel); + ); + var currentEnv = request.environmentName(); + currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: currentEnv }); + emitChunk(request, task, resolvedModel); + } else { + var json = stringify(resolvedModel), + _currentEnv = request.environmentName(); + _currentEnv !== task.environmentName && + emitDebugChunk(request, task.id, { env: _currentEnv }); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js index ff5dc6fb085733..472c0142838024 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js @@ -1165,23 +1165,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { ? "$L" + JSCompiler_inline_result.id.toString(16) : serializeByValueID(JSCompiler_inline_result.id); } - else if (thrownValue === AbortSigil) - (task.status = 3), - (prevKeyPath = request.fatalError), - (JSCompiler_inline_result = parentPropertyName - ? "$L" + prevKeyPath.toString(16) - : serializeByValueID(prevKeyPath)); - else if ( - ((task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parentPropertyName) - ) - request.pendingChunks++, - (prevKeyPath = request.nextChunkId++), - (prevImplicitSlot = logRecoverableError(request, value)), - emitErrorChunk(request, prevKeyPath, prevImplicitSlot), - (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16)); - else throw value; + else + thrownValue === AbortSigil + ? ((task.status = 3), + (prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))) + : ((task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + (prevImplicitSlot = logRecoverableError(request, value)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); } return JSCompiler_inline_result; }, @@ -1309,7 +1308,8 @@ function renderModelDestructive( if ("object" === typeof value) { switch (value.$$typeof) { case REACT_ELEMENT_TYPE: - var writtenObjects = request.writtenObjects; + var elementReference = null, + writtenObjects = request.writtenObjects; if (null === task.keyPath && !task.implicitSlot) { var existingReference = writtenObjects.get(value); if (void 0 !== existingReference) @@ -1319,11 +1319,12 @@ function renderModelDestructive( -1 === parentPropertyName.indexOf(":") && ((parent = writtenObjects.get(parent)), void 0 !== parent && - writtenObjects.set(value, parent + ":" + parentPropertyName)); + ((elementReference = parent + ":" + parentPropertyName), + writtenObjects.set(value, elementReference))); } parentPropertyName = value.props; parent = parentPropertyName.ref; - return renderElement( + request = renderElement( request, task, value.type, @@ -1331,6 +1332,12 @@ function renderModelDestructive( void 0 !== parent ? parent : null, parentPropertyName ); + "object" === typeof request && + null !== request && + null !== elementReference && + (writtenObjects.has(request) || + writtenObjects.set(request, elementReference)); + return request; case REACT_LAZY_TYPE: task.thenableState = null; parentPropertyName = value._init; @@ -1351,44 +1358,44 @@ function renderModelDestructive( ); if ( void 0 !== request.temporaryReferences && - ((writtenObjects = request.temporaryReferences.get(value)), - void 0 !== writtenObjects) + ((elementReference = request.temporaryReferences.get(value)), + void 0 !== elementReference) ) - return "$T" + writtenObjects; - writtenObjects = request.writtenObjects; - existingReference = writtenObjects.get(value); + return "$T" + elementReference; + elementReference = request.writtenObjects; + writtenObjects = elementReference.get(value); if ("function" === typeof value.then) { - if (void 0 !== existingReference) { + if (void 0 !== writtenObjects) { if (null !== task.keyPath || task.implicitSlot) return "$@" + serializeThenable(request, task, value).toString(16); if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; } request = "$@" + serializeThenable(request, task, value).toString(16); - writtenObjects.set(value, request); + elementReference.set(value, request); return request; } - if (void 0 !== existingReference) + if (void 0 !== writtenObjects) if (modelRoot === value) modelRoot = null; - else return existingReference; + else return writtenObjects; else if ( -1 === parentPropertyName.indexOf(":") && - ((existingReference = writtenObjects.get(parent)), - void 0 !== existingReference) + ((writtenObjects = elementReference.get(parent)), + void 0 !== writtenObjects) ) { - var propertyName = parentPropertyName; + existingReference = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { case "1": - propertyName = "type"; + existingReference = "type"; break; case "2": - propertyName = "key"; + existingReference = "key"; break; case "3": - propertyName = "props"; + existingReference = "props"; } - writtenObjects.set(value, existingReference + ":" + propertyName); + elementReference.set(value, writtenObjects + ":" + existingReference); } if (isArrayImpl(value)) return renderFragment(request, task, value); if (value instanceof Map) @@ -1550,10 +1557,11 @@ function renderModelDestructive( } if ("symbol" === typeof value) { task = request.writtenSymbols; - writtenObjects = task.get(value); - if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects); - writtenObjects = value.description; - if (Symbol.for(writtenObjects) !== value) + elementReference = task.get(value); + if (void 0 !== elementReference) + return serializeByValueID(elementReference); + elementReference = value.description; + if (Symbol.for(elementReference) !== value) throw Error( "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" + (value.description + ") cannot be found among global symbols.") + @@ -1564,7 +1572,7 @@ function renderModelDestructive( parent = encodeReferenceChunk( request, parentPropertyName, - "$S" + writtenObjects + "$S" + elementReference ); request.completedImportChunks.push(parent); task.set(value, parentPropertyName); diff --git a/packages/next/src/compiled/react-server-dom-webpack/package.json b/packages/next/src/compiled/react-server-dom-webpack/package.json index 6256f281316cf3..216ea15c8ed980 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/package.json +++ b/packages/next/src/compiled/react-server-dom-webpack/package.json @@ -46,8 +46,8 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "19.0.0-rc-a26e3f403e-20240611", - "react-dom": "19.0.0-rc-a26e3f403e-20240611", + "react": "19.0.0-rc-f3e09d6328-20240612", + "react-dom": "19.0.0-rc-f3e09d6328-20240612", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react/cjs/react.development.js b/packages/next/src/compiled/react/cjs/react.development.js index 9cf82e6b90f172..629af5ce663b43 100644 --- a/packages/next/src/compiled/react/cjs/react.development.js +++ b/packages/next/src/compiled/react/cjs/react.development.js @@ -1539,7 +1539,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react/cjs/react.production.js b/packages/next/src/compiled/react/cjs/react.production.js index b71e0e1a220da5..d14c2a2f87969d 100644 --- a/packages/next/src/compiled/react/cjs/react.production.js +++ b/packages/next/src/compiled/react/cjs/react.production.js @@ -536,4 +536,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/react/cjs/react.react-server.development.js b/packages/next/src/compiled/react/cjs/react.react-server.development.js index 10c33716a93e4e..ef57e1407efe89 100644 --- a/packages/next/src/compiled/react/cjs/react.react-server.development.js +++ b/packages/next/src/compiled/react/cjs/react.react-server.development.js @@ -1137,5 +1137,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-rc-a26e3f403e-20240611"; + exports.version = "19.0.0-rc-f3e09d6328-20240612"; })(); diff --git a/packages/next/src/compiled/react/cjs/react.react-server.production.js b/packages/next/src/compiled/react/cjs/react.react-server.production.js index f486bc50d29da5..9a2fc7eba79d16 100644 --- a/packages/next/src/compiled/react/cjs/react.react-server.production.js +++ b/packages/next/src/compiled/react/cjs/react.react-server.production.js @@ -424,4 +424,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-rc-a26e3f403e-20240611"; +exports.version = "19.0.0-rc-f3e09d6328-20240612"; diff --git a/packages/next/src/compiled/unistore/unistore.js b/packages/next/src/compiled/unistore/unistore.js index 704e649d00f11f..040bf0a84f9c23 100644 --- a/packages/next/src/compiled/unistore/unistore.js +++ b/packages/next/src/compiled/unistore/unistore.js @@ -1 +1 @@ -(()=>{var t={46:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a{var t={698:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a=0.15.0' - version: 2.2.1(react@19.0.0-rc-a26e3f403e-20240611) + version: 2.2.1(react@19.0.0-rc-f3e09d6328-20240612) source-map: specifier: ^0.7.0 version: 0.7.3 @@ -1587,8 +1587,8 @@ importers: packages/third-parties: dependencies: react: - specifier: 19.0.0-rc-a26e3f403e-20240611 - version: 19.0.0-rc-a26e3f403e-20240611 + specifier: 19.0.0-rc-f3e09d6328-20240612 + version: 19.0.0-rc-f3e09d6328-20240612 third-party-capital: specifier: 1.0.20 version: 1.0.20 @@ -3109,7 +3109,7 @@ packages: resolution: {integrity: sha512-5mlW1DquU5HaxjLkfkGN1GA/fvVGdyHURRiX/0FHl2cfIfRxSOfmxEH5YS43edp0OldZrZ+dkBKbngxcNCdZvA==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -3126,7 +3126,7 @@ packages: '@emotion/use-insertion-effect-with-fallbacks@1.0.1': resolution: {integrity: sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 '@emotion/utils@1.2.1': resolution: {integrity: sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==} @@ -3323,14 +3323,14 @@ packages: '@floating-ui/react-dom@2.1.0': resolution: {integrity: sha512-lNzj5EQmEKn5FFKc04+zasr09h/uX8RtJRNj5gUXsSQIXHVWTVh+hVAg1vOMCexkX8EgvemMvIFpQfkosnVNyA==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 '@floating-ui/react@0.26.16': resolution: {integrity: sha512-HEf43zxZNAI/E781QIVpYSF3K2VH4TTYZpqecjdsFkjsaU1EbaWcM++kw0HXFffj7gDUcBFevX8s0rQGQpxkow==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 '@floating-ui/utils@0.2.2': resolution: {integrity: sha512-J4yDIIthosAsRZ5CPYP/jQvUAQtlZTTD/4suA08/FEnlxqW3sKS9iAhgsa9VYLZ6vDHn/ixJgIqRQPotoBjxIw==} @@ -3921,13 +3921,13 @@ packages: resolution: {integrity: sha512-l9ypojKN3PjwO1CSLIsqxi7mA25+7w+xc71Q+JuCCREI0tuGwkZsKbIOpuTATIJOjPh8ycLiW7QxX1LYsRTq6w==} peerDependencies: '@mantine/hooks': 7.10.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 '@mantine/hooks@7.11.1': resolution: {integrity: sha512-28WS/U6QL4jaIHf1uFpny5Tglu9MoyyM4bWLmIcAQHtOD3YHpuNvs9OTWLqKAQs6VN+kydlxvjvT+w1LBWEpQg==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 '@mapbox/node-pre-gyp@1.0.5': resolution: {integrity: sha512-4srsKPXWlIxp5Vbqz5uLfBN+du2fJChBoYn/f2h991WLdk7jUvcSk/McVLSv/X+xQIPI8eGD5GjrnygdyHnhPA==} @@ -3944,7 +3944,7 @@ packages: '@mdx-js/react@2.2.1': resolution: {integrity: sha512-YdXcMcEnqZhzql98RNrqYo9cEhTTesBiCclEtoiQUbJwx87q9453GTapYU6kJ8ZZ2ek1Vp25SiAXEFy5O/eAPw==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 '@mswjs/cookies@1.1.0': resolution: {integrity: sha512-0ZcCVQxifZmhwNBoQIrystCb+2sWBY2Zw8lpfJBPCHGCA/HWqehITeCRVIv4VMy8MPlaHo2w2pTHFV2pFfqKPw==} @@ -4617,8 +4617,8 @@ packages: engines: {node: '>=18'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -10108,7 +10108,7 @@ packages: lucide-react@0.383.0: resolution: {integrity: sha512-13xlG0CQCJtzjSQYwwJ3WRqMHtRj3EXmLlorrARt7y+IHnxUCp3XyFNL1DfaGySWxHObDvnu1u1dV+0VMKHUSg==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} @@ -10677,8 +10677,8 @@ packages: peerDependencies: '@opentelemetry/api': ^1.1.0 '@playwright/test': ^1.41.2 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 sass: ^1.3.0 peerDependenciesMeta: '@opentelemetry/api': @@ -12352,23 +12352,23 @@ packages: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true - react-dom@0.0.0-experimental-a26e3f403e-20240611: - resolution: {integrity: sha512-BlHY7CbkFV7hEYWK/AcUSFxX+9qWe7Je+O0lDhFeEvsMrWrlSSbyKBjZHOEHDU1yU/MARqcKt81Aea6omfe+wg==} + react-dom@0.0.0-experimental-f3e09d6328-20240612: + resolution: {integrity: sha512-iw9YxBFXXpbz5L34GjdaeItPGkhv7khREhh0jI1UOW4zefN2osXaWzgPuWCQcNG1rL0gmk6rQuk3tJ2gYp5lxg==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 react-dom@17.0.2: resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 - react-dom@19.0.0-rc-a26e3f403e-20240611: - resolution: {integrity: sha512-xBytizW15efJUJxG7dnAVdLrgsLsHZMygQiB3njJLlqsN1mVPAKGSdQEwIcX+bDX2bVzSxQ7BTC1G2y+57NOog==} + react-dom@19.0.0-rc-f3e09d6328-20240612: + resolution: {integrity: sha512-8hxyAR1JjOiJPhZm8zn6QBKJ2kF2eas/L8mkTpmd4zGoHHq3Dqk5ViciwZTWCYt3mMQgp3BhCBdeWxD9a0T6fw==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 - react-is@19.0.0-rc-a26e3f403e-20240611: - resolution: {integrity: sha512-vOTGUadk9/0r7xBICNp6kssADmNJZgIG4vg5PWR0QCuokus/QjAemIHugtzgMZQ+Ur/EHf3N6qcLC40J4hMYAQ==} + react-is@19.0.0-rc-f3e09d6328-20240612: + resolution: {integrity: sha512-1Bvj+rcFLm941DtjAF1QBX/qEtZxROp2RMIYC7p+cYpCWvOjQ13aZUwT6ldz/nRITX5nqAv0l92xcZUqBrnMng==} react-lifecycles-compat@3.0.4: resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==} @@ -12376,8 +12376,8 @@ packages: react-number-format@5.4.0: resolution: {integrity: sha512-NWdICrqLhI7rAS8yUeLVd6Wr4cN7UjJ9IBTS0f/a9i7UB4x4Ti70kGnksBtZ7o4Z7YRbvCMMR/jQmkoOBa/4fg==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 react-refresh@0.12.0: resolution: {integrity: sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A==} @@ -12388,7 +12388,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -12398,53 +12398,53 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true - react-server-dom-turbopack@0.0.0-experimental-a26e3f403e-20240611: - resolution: {integrity: sha512-PFY/Zx7aCbA6vGh/ykLDMP7Vem3OWkKKxiA/ljD38eGPdLLexTOJUm79tcIBonXtQknLitJGYO0uBjh3bC6lzg==} + react-server-dom-turbopack@0.0.0-experimental-f3e09d6328-20240612: + resolution: {integrity: sha512-+Ow6MPIDhzElPdxUqi6p9fEJV1gcDN/3RkJyyHwBLyK3x5JEWakiXdu/RVyal/jSHgvRzk9U3vfZy+DMvED20Q==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 - react-server-dom-turbopack@19.0.0-rc-a26e3f403e-20240611: - resolution: {integrity: sha512-+esClhctkHirDDQAzSTczu6KusB1MF1JeoEz5tcPPUd5f2pdXggRP9Use1gh0B40yIVxdBmxqDn9pIX9nNH55A==} + react-server-dom-turbopack@19.0.0-rc-f3e09d6328-20240612: + resolution: {integrity: sha512-imJUwttAQrNpeTPDW/vMCslqE7hF46bZNARJPKL5mC1AUnrw+6rrAF8ViMniPHxmqw0sXMVJYvnE+6bwt29P+w==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 - react-server-dom-webpack@0.0.0-experimental-a26e3f403e-20240611: - resolution: {integrity: sha512-jt7vzKxj5S95YCGZWizI8s6ifa5c9XlC6t0iwbcSTL+8xZXpTLnK0ro3Aay3S87JZwShIM9hYmIuZzlQjOnQ5w==} + react-server-dom-webpack@0.0.0-experimental-f3e09d6328-20240612: + resolution: {integrity: sha512-EHZslKMHekY6QO1k++gj/pFT1tYoV2XB7s70/KONcbb0WXSL6tnkhdTp5spUup0ertDzg14Fs4sOlqQZTJgXDw==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 webpack: 5.90.0 - react-server-dom-webpack@19.0.0-rc-a26e3f403e-20240611: - resolution: {integrity: sha512-TJMZCCOq9kJufWULi3GXvD6b45gkVNOWa1LRfLWILB/pujyrGbo+EaEVi+idUNDSneXpkv+xk8LeVrw+iwBrMA==} + react-server-dom-webpack@19.0.0-rc-f3e09d6328-20240612: + resolution: {integrity: sha512-kPO7etOPqlT8cyegzaEKlQsp2h6fK6oev2GDA4e+dU1ZPrPYfE3RtmUmK6wKjvr9kOnGfk0Ee4yIS7Du8YyOjw==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 webpack: 5.90.0 react-ssr-prepass@1.0.8: resolution: {integrity: sha512-O0gfRA1SaK+9ITKxqfnXsej2jF+OHGP/+GxD4unROQaM/0/UczGF9fuF+wTboxaQoKdIf4FvS3h/OigWh704VA==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-is: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-is: 19.0.0-rc-f3e09d6328-20240612 react-style-singleton@2.2.1: resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==} engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -12453,24 +12453,24 @@ packages: resolution: {integrity: sha512-XT1024o2pqCuZSuBt9FwHlaDeNtVrtCXu0Rnz88t1jUGheCLa3PhjE1GH8Ctm2axEtvdCl5SUHYschyQ0L5QHQ==} engines: {node: '>=10'} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 react-virtualized@9.22.3: resolution: {integrity: sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 - react@0.0.0-experimental-a26e3f403e-20240611: - resolution: {integrity: sha512-DuuKc3RKPW4l24a0f1OdDHvEMAy5ipIV2N1CCLuJ7A58PbrgI0Bv71B81vwk7sQgVYKmifOBNAGmMgekSlnHaw==} + react@0.0.0-experimental-f3e09d6328-20240612: + resolution: {integrity: sha512-Nw8f08FRy98fe91YIaBVXYwnvRSQmjff6M16KH0tW9K8ssg/AyoDVmOa6GwAX1REC8kjiDyyGoRBLAEYtdQA+w==} engines: {node: '>=0.10.0'} react@17.0.2: resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==} engines: {node: '>=0.10.0'} - react@19.0.0-rc-a26e3f403e-20240611: - resolution: {integrity: sha512-3G/vbTTu/tGY33+REPECOd2Zsk+cXOtYersK3IhDicRRmCMElUvQ8fCjXSNMeGpvvRZEklyJ2R58PshYZh2dRw==} + react@19.0.0-rc-f3e09d6328-20240612: + resolution: {integrity: sha512-xfqayZMfs4jAkRgMZRVfrgAVFwmW3DbidUpd3InNwxot55Fqeno27d0d6y7SR/WOFT2r7O+qKBOtJ0mNmX2VXg==} engines: {node: '>=0.10.0'} read-cache@1.0.0: @@ -12985,11 +12985,11 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - scheduler@0.0.0-experimental-a26e3f403e-20240611: - resolution: {integrity: sha512-kLipxuYLLeGQutjQuxUB21L65isKXzVd6Gik3C2szDsnR2dd/0YUZVEYkoufkE0CuYaqvBrwnZPC0BuAG5Ag8A==} + scheduler@0.0.0-experimental-f3e09d6328-20240612: + resolution: {integrity: sha512-GvHSr8Tyx7QVA/O3XdLdX5Vb7fxK2YWQpfcfjM0ztSnKDzCzTC4KX6wWNjZJs8BiZJ1MFH6KzLOMSzK5aogBnQ==} - scheduler@0.25.0-rc-a26e3f403e-20240611: - resolution: {integrity: sha512-866Js4mBLds0wG0ILG9btP9QTuhqMBavBDTtneV485BN9YdwnxHAxv3DygQTZDRhtIMavrFlpCaNVP5eoPNyZg==} + scheduler@0.25.0-rc-f3e09d6328-20240612: + resolution: {integrity: sha512-/YYWVK2+PXQ1N1Sd9b/Oue1xJtQmeHvVyppEyhBIL1DRMxoEGGV3EWLh8BagWksMt5gWRq7FEBgca2m1S5lG+w==} schema-utils@2.7.1: resolution: {integrity: sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==} @@ -13556,8 +13556,8 @@ packages: engines: {node: '>= 16'} peerDependencies: babel-plugin-styled-components: '>= 2' - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: babel-plugin-styled-components: optional: true @@ -13571,7 +13571,7 @@ packages: peerDependencies: '@babel/core': '*' babel-plugin-macros: '*' - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@babel/core': optional: true @@ -13584,7 +13584,7 @@ packages: peerDependencies: '@babel/core': '*' babel-plugin-macros: '*' - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@babel/core': optional: true @@ -13661,7 +13661,7 @@ packages: swr@2.2.4: resolution: {integrity: sha512-njiZ/4RiIhoOlAaLYDqwz5qH/KZXVilRLvomrx83HjzCWTfa+InyfAjv05PSFxnmLzZkNO9ZfvgoqzAaEI4sGQ==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 symbol-observable@1.0.1: resolution: {integrity: sha512-Kb3PrPYz4HanVF1LVGuAdW6LoVgIwjUYJGzFe7NDrBLCN4lsV/5J0MFurV+ygS4bRVwrCEt2c7MQ1R2a72oJDw==} @@ -14394,7 +14394,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -14402,13 +14402,13 @@ packages: use-composed-ref@1.3.0: resolution: {integrity: sha512-GLMG0Jc/jiKov/3Ulid1wbv3r54K9HlMW29IWcDFPEqFkSO2nS0MuefWgMJpeHQ9YJeXDL3ZUF+P3jdXlZX/cQ==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 use-isomorphic-layout-effect@1.1.2: resolution: {integrity: sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -14417,7 +14417,7 @@ packages: resolution: {integrity: sha512-xA+AVm/Wlg3e2P/JiItTziwS7FK92LWrDB0p+hgXloIMuVCeJJ8v6f0eeHyPZaJrM+usM1FkFfbNCrJGs8A/zw==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -14427,7 +14427,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 peerDependenciesMeta: '@types/react': optional: true @@ -14435,7 +14435,7 @@ packages: use-sync-external-store@1.2.0: resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} peerDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 use@3.1.1: resolution: {integrity: sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==} @@ -16796,17 +16796,17 @@ snapshots: '@emotion/memoize@0.8.1': {} - '@emotion/react@11.11.1(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0)': + '@emotion/react@11.11.1(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0)': dependencies: '@babel/runtime': 7.22.5 '@emotion/babel-plugin': 11.11.0 '@emotion/cache': 11.11.0 '@emotion/serialize': 1.1.2 - '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-a26e3f403e-20240611) + '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-f3e09d6328-20240612) '@emotion/utils': 1.2.1 '@emotion/weak-memoize': 0.3.1 hoist-non-react-statics: 3.3.2 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 @@ -16822,9 +16822,9 @@ snapshots: '@emotion/unitless@0.8.1': {} - '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-a26e3f403e-20240611)': + '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-f3e09d6328-20240612)': dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 '@emotion/utils@1.2.1': {} @@ -17095,18 +17095,18 @@ snapshots: '@floating-ui/core': 1.6.2 '@floating-ui/utils': 0.2.2 - '@floating-ui/react-dom@2.1.0(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611)': + '@floating-ui/react-dom@2.1.0(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612)': dependencies: '@floating-ui/dom': 1.6.5 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) - '@floating-ui/react@0.26.16(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611)': + '@floating-ui/react@0.26.16(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612)': dependencies: - '@floating-ui/react-dom': 2.1.0(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611) + '@floating-ui/react-dom': 2.1.0(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612) '@floating-ui/utils': 0.2.2 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) tabbable: 6.2.0 '@floating-ui/utils@0.2.2': {} @@ -18123,23 +18123,23 @@ snapshots: dependencies: call-bind: 1.0.7 - '@mantine/core@7.10.1(@mantine/hooks@7.11.1(react@19.0.0-rc-a26e3f403e-20240611))(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0)': + '@mantine/core@7.10.1(@mantine/hooks@7.11.1(react@19.0.0-rc-f3e09d6328-20240612))(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0)': dependencies: - '@floating-ui/react': 0.26.16(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611) - '@mantine/hooks': 7.11.1(react@19.0.0-rc-a26e3f403e-20240611) + '@floating-ui/react': 0.26.16(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612) + '@mantine/hooks': 7.11.1(react@19.0.0-rc-f3e09d6328-20240612) clsx: 2.1.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) - react-number-format: 5.4.0(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611) - react-remove-scroll: 2.5.10(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) - react-textarea-autosize: 8.5.3(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) + react-number-format: 5.4.0(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612) + react-remove-scroll: 2.5.10(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) + react-textarea-autosize: 8.5.3(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) type-fest: 4.18.3 transitivePeerDependencies: - '@types/react' - '@mantine/hooks@7.11.1(react@19.0.0-rc-a26e3f403e-20240611)': + '@mantine/hooks@7.11.1(react@19.0.0-rc-f3e09d6328-20240612)': dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 '@mapbox/node-pre-gyp@1.0.5(encoding@0.1.13)': dependencies: @@ -18186,11 +18186,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@mdx-js/react@2.2.1(react@19.0.0-rc-a26e3f403e-20240611)': + '@mdx-js/react@2.2.1(react@19.0.0-rc-f3e09d6328-20240612)': dependencies: '@types/mdx': 2.0.3 '@types/react': types-react@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 '@mswjs/cookies@1.1.0': {} @@ -18990,13 +18990,13 @@ snapshots: '@types/jest': 29.5.5 jest: 29.7.0(@types/node@20.12.3)(babel-plugin-macros@3.1.0) - '@testing-library/react@15.0.7(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0)': + '@testing-library/react@15.0.7(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0)': dependencies: '@babel/runtime': 7.22.5 '@testing-library/dom': 10.1.0 '@types/react-dom': types-react-dom@19.0.0-rc.0 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) optionalDependencies: '@types/react': types-react@19.0.0-rc.0 @@ -23907,7 +23907,7 @@ snapshots: hoist-non-react-statics@3.3.2: dependencies: - react-is: 19.0.0-rc-a26e3f403e-20240611 + react-is: 19.0.0-rc-f3e09d6328-20240612 homedir-polyfill@1.0.3: dependencies: @@ -25862,9 +25862,9 @@ snapshots: lru-cache@7.18.3: {} - lucide-react@0.383.0(react@19.0.0-rc-a26e3f403e-20240611): + lucide-react@0.383.0(react@19.0.0-rc-f3e09d6328-20240612): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 lz-string@1.5.0: {} @@ -26773,7 +26773,7 @@ snapshots: next-tick@1.0.0: {} - next@14.3.0-canary.15(@babel/core@7.22.5)(@opentelemetry/api@1.6.0)(@playwright/test@1.45.0)(babel-plugin-macros@3.1.0)(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611)(sass@1.77.6): + next@14.3.0-canary.15(@babel/core@7.22.5)(@opentelemetry/api@1.6.0)(@playwright/test@1.45.0)(babel-plugin-macros@3.1.0)(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612)(sass@1.77.6): dependencies: '@next/env': 14.3.0-canary.15 '@swc/helpers': 0.5.5 @@ -26781,9 +26781,9 @@ snapshots: caniuse-lite: 1.0.30001579 graceful-fs: 4.2.11 postcss: 8.4.31 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) - styled-jsx: 5.1.1(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) + styled-jsx: 5.1.1(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-f3e09d6328-20240612) optionalDependencies: '@next/swc-darwin-arm64': 14.3.0-canary.15 '@next/swc-darwin-x64': 14.3.0-canary.15 @@ -28345,25 +28345,25 @@ snapshots: '@jest/types': 24.9.0 ansi-regex: 4.1.0 ansi-styles: 3.2.1 - react-is: 19.0.0-rc-a26e3f403e-20240611 + react-is: 19.0.0-rc-f3e09d6328-20240612 pretty-format@27.5.1: dependencies: ansi-regex: 5.0.1 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-a26e3f403e-20240611 + react-is: 19.0.0-rc-f3e09d6328-20240612 pretty-format@29.5.0: dependencies: '@jest/schemas': 29.4.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-a26e3f403e-20240611 + react-is: 19.0.0-rc-f3e09d6328-20240612 pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-a26e3f403e-20240611 + react-is: 19.0.0-rc-f3e09d6328-20240612 pretty-ms@7.0.0: dependencies: @@ -28420,7 +28420,7 @@ snapshots: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react-is: 19.0.0-rc-a26e3f403e-20240611 + react-is: 19.0.0-rc-f3e09d6328-20240612 property-information@5.6.0: dependencies: @@ -28592,127 +28592,127 @@ snapshots: minimist: 1.2.6 strip-json-comments: 2.0.1 - react-dom@0.0.0-experimental-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611): + react-dom@0.0.0-experimental-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - scheduler: 0.25.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + scheduler: 0.25.0-rc-f3e09d6328-20240612 - react-dom@17.0.2(react@19.0.0-rc-a26e3f403e-20240611): + react-dom@17.0.2(react@19.0.0-rc-f3e09d6328-20240612): dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react: 19.0.0-rc-a26e3f403e-20240611 - scheduler: 0.25.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + scheduler: 0.25.0-rc-f3e09d6328-20240612 - react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611): + react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - scheduler: 0.25.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + scheduler: 0.25.0-rc-f3e09d6328-20240612 - react-is@19.0.0-rc-a26e3f403e-20240611: {} + react-is@19.0.0-rc-f3e09d6328-20240612: {} react-lifecycles-compat@3.0.4: {} - react-number-format@5.4.0(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611): + react-number-format@5.4.0(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612): dependencies: prop-types: 15.8.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) react-refresh@0.12.0: {} - react-remove-scroll-bar@2.3.6(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + react-remove-scroll-bar@2.3.6(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-style-singleton: 2.2.1(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) + react: 19.0.0-rc-f3e09d6328-20240612 + react-style-singleton: 2.2.1(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) tslib: 2.6.2 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - react-remove-scroll@2.5.10(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + react-remove-scroll@2.5.10(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - react-remove-scroll-bar: 2.3.6(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) - react-style-singleton: 2.2.1(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) + react: 19.0.0-rc-f3e09d6328-20240612 + react-remove-scroll-bar: 2.3.6(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) + react-style-singleton: 2.2.1(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) tslib: 2.6.2 - use-callback-ref: 1.3.2(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) - use-sidecar: 1.1.2(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) + use-callback-ref: 1.3.2(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) + use-sidecar: 1.1.2(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - react-server-dom-turbopack@0.0.0-experimental-a26e3f403e-20240611(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611): + react-server-dom-turbopack@0.0.0-experimental-f3e09d6328-20240612(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) - react-server-dom-turbopack@19.0.0-rc-a26e3f403e-20240611(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611): + react-server-dom-turbopack@19.0.0-rc-f3e09d6328-20240612(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) - react-server-dom-webpack@0.0.0-experimental-a26e3f403e-20240611(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611)(webpack@5.90.0(@swc/core@1.6.6(@swc/helpers@0.5.11))): + react-server-dom-webpack@0.0.0-experimental-f3e09d6328-20240612(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612)(webpack@5.90.0(@swc/core@1.6.6(@swc/helpers@0.5.11))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) webpack: 5.90.0(@swc/core@1.6.6(@swc/helpers@0.5.11)) - react-server-dom-webpack@19.0.0-rc-a26e3f403e-20240611(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611)(webpack@5.90.0(@swc/core@1.6.6(@swc/helpers@0.5.11))): + react-server-dom-webpack@19.0.0-rc-f3e09d6328-20240612(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612)(webpack@5.90.0(@swc/core@1.6.6(@swc/helpers@0.5.11))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) webpack: 5.90.0(@swc/core@1.6.6(@swc/helpers@0.5.11)) - react-ssr-prepass@1.0.8(react-is@19.0.0-rc-a26e3f403e-20240611)(react@19.0.0-rc-a26e3f403e-20240611): + react-ssr-prepass@1.0.8(react-is@19.0.0-rc-f3e09d6328-20240612)(react@19.0.0-rc-f3e09d6328-20240612): dependencies: object-is: 1.0.2 - react: 19.0.0-rc-a26e3f403e-20240611 - react-is: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 + react-is: 19.0.0-rc-f3e09d6328-20240612 - react-style-singleton@2.2.1(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + react-style-singleton@2.2.1(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: get-nonce: 1.0.1 invariant: 2.2.4 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 tslib: 2.6.2 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - react-textarea-autosize@8.5.3(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + react-textarea-autosize@8.5.3(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: '@babel/runtime': 7.22.5 - react: 19.0.0-rc-a26e3f403e-20240611 - use-composed-ref: 1.3.0(react@19.0.0-rc-a26e3f403e-20240611) - use-latest: 1.2.1(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) + react: 19.0.0-rc-f3e09d6328-20240612 + use-composed-ref: 1.3.0(react@19.0.0-rc-f3e09d6328-20240612) + use-latest: 1.2.1(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) transitivePeerDependencies: - '@types/react' - react-virtualized@9.22.3(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611): + react-virtualized@9.22.3(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612): dependencies: '@babel/runtime': 7.22.5 clsx: 1.1.1 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) react-lifecycles-compat: 3.0.4 - react@0.0.0-experimental-a26e3f403e-20240611: {} + react@0.0.0-experimental-f3e09d6328-20240612: {} react@17.0.2: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react@19.0.0-rc-a26e3f403e-20240611: {} + react@19.0.0-rc-f3e09d6328-20240612: {} read-cache@1.0.0: dependencies: @@ -29400,9 +29400,9 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.0.0-experimental-a26e3f403e-20240611: {} + scheduler@0.0.0-experimental-f3e09d6328-20240612: {} - scheduler@0.25.0-rc-a26e3f403e-20240611: {} + scheduler@0.25.0-rc-f3e09d6328-20240612: {} schema-utils@2.7.1: dependencies: @@ -30051,7 +30051,7 @@ snapshots: dependencies: inline-style-parser: 0.1.1 - styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611))(react@19.0.0-rc-a26e3f403e-20240611): + styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612))(react@19.0.0-rc-f3e09d6328-20240612): dependencies: '@babel/cli': 7.21.5(@babel/core@7.22.5) '@babel/core': 7.22.5 @@ -30066,8 +30066,8 @@ snapshots: '@emotion/unitless': 0.8.1 css-to-react-native: 3.2.0 postcss: 8.4.31 - react: 19.0.0-rc-a26e3f403e-20240611 - react-dom: 19.0.0-rc-a26e3f403e-20240611(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + react-dom: 19.0.0-rc-f3e09d6328-20240612(react@19.0.0-rc-f3e09d6328-20240612) shallowequal: 1.1.0 stylis: 4.2.0 tslib: 2.5.3 @@ -30079,18 +30079,18 @@ snapshots: postcss: 7.0.32 postcss-load-plugins: 2.3.0 - styled-jsx@5.1.1(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-a26e3f403e-20240611): + styled-jsx@5.1.1(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-f3e09d6328-20240612): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 optionalDependencies: '@babel/core': 7.22.5 babel-plugin-macros: 3.1.0 - styled-jsx@5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-a26e3f403e-20240611): + styled-jsx@5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-f3e09d6328-20240612): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 optionalDependencies: '@babel/core': 7.22.5 babel-plugin-macros: 3.1.0 @@ -30180,11 +30180,11 @@ snapshots: picocolors: 1.0.0 stable: 0.1.8 - swr@2.2.4(react@19.0.0-rc-a26e3f403e-20240611): + swr@2.2.4(react@19.0.0-rc-f3e09d6328-20240612): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-a26e3f403e-20240611 - use-sync-external-store: 1.2.0(react@19.0.0-rc-a26e3f403e-20240611) + react: 19.0.0-rc-f3e09d6328-20240612 + use-sync-external-store: 1.2.0(react@19.0.0-rc-f3e09d6328-20240612) symbol-observable@1.0.1: {} @@ -30856,9 +30856,9 @@ snapshots: unist-util-is: 5.2.0 unist-util-visit-parents: 5.1.3 - unistore@3.4.1(react@19.0.0-rc-a26e3f403e-20240611): + unistore@3.4.1(react@19.0.0-rc-f3e09d6328-20240612): optionalDependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 universal-github-app-jwt@1.1.1: dependencies: @@ -30951,41 +30951,41 @@ snapshots: url-to-options@1.0.1: {} - use-callback-ref@1.3.2(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + use-callback-ref@1.3.2(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 tslib: 2.6.2 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - use-composed-ref@1.3.0(react@19.0.0-rc-a26e3f403e-20240611): + use-composed-ref@1.3.0(react@19.0.0-rc-f3e09d6328-20240612): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 - use-isomorphic-layout-effect@1.1.2(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + use-isomorphic-layout-effect@1.1.2(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - use-latest@1.2.1(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + use-latest@1.2.1(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 - use-isomorphic-layout-effect: 1.1.2(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0) + react: 19.0.0-rc-f3e09d6328-20240612 + use-isomorphic-layout-effect: 1.1.2(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0) optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - use-sidecar@1.1.2(react@19.0.0-rc-a26e3f403e-20240611)(types-react@19.0.0-rc.0): + use-sidecar@1.1.2(react@19.0.0-rc-f3e09d6328-20240612)(types-react@19.0.0-rc.0): dependencies: detect-node-es: 1.1.0 - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 tslib: 2.6.2 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - use-sync-external-store@1.2.0(react@19.0.0-rc-a26e3f403e-20240611): + use-sync-external-store@1.2.0(react@19.0.0-rc-f3e09d6328-20240612): dependencies: - react: 19.0.0-rc-a26e3f403e-20240611 + react: 19.0.0-rc-f3e09d6328-20240612 use@3.1.1: {}