From b9fb6572c7a670ec40e42da1a21ef673f771e008 Mon Sep 17 00:00:00 2001 From: Sebastian Sebbie Silbermann Date: Tue, 15 Jul 2025 12:30:33 +0200 Subject: [PATCH] Use local React --- .../cjs/react-dom-client.development.js | 10 +- .../cjs/react-dom-client.production.js | 10 +- .../cjs/react-dom-profiling.development.js | 10 +- .../cjs/react-dom-profiling.profiling.js | 10 +- ...t-dom-server-legacy.browser.development.js | 2 +- ...ct-dom-server-legacy.browser.production.js | 2 +- ...eact-dom-server-legacy.node.development.js | 2 +- ...react-dom-server-legacy.node.production.js | 2 +- .../react-dom-server.browser.development.js | 20 +- .../react-dom-server.browser.production.js | 20 +- .../cjs/react-dom-server.bun.production.js | 6 +- .../cjs/react-dom-server.edge.development.js | 20 +- .../cjs/react-dom-server.edge.production.js | 20 +- .../cjs/react-dom-server.node.development.js | 20 +- .../cjs/react-dom-server.node.production.js | 20 +- .../react-dom-unstable_testing.development.js | 10 +- .../react-dom-unstable_testing.production.js | 10 +- .../cjs/react-dom.development.js | 2 +- .../cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 2 +- .../cjs/react-dom.react-server.production.js | 2 +- .../react-dom-experimental/package.json | 4 +- .../cjs/react-dom-client.development.js | 10 +- .../cjs/react-dom-client.production.js | 10 +- .../cjs/react-dom-profiling.development.js | 10 +- .../cjs/react-dom-profiling.profiling.js | 10 +- ...t-dom-server-legacy.browser.development.js | 2 +- ...ct-dom-server-legacy.browser.production.js | 2 +- ...eact-dom-server-legacy.node.development.js | 2 +- ...react-dom-server-legacy.node.production.js | 2 +- .../react-dom-server.browser.development.js | 6 +- .../react-dom-server.browser.production.js | 6 +- .../cjs/react-dom-server.bun.production.js | 6 +- .../cjs/react-dom-server.edge.development.js | 6 +- .../cjs/react-dom-server.edge.production.js | 6 +- .../cjs/react-dom-server.node.development.js | 6 +- .../cjs/react-dom-server.node.production.js | 6 +- .../react-dom/cjs/react-dom.development.js | 2 +- .../react-dom/cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 2 +- .../cjs/react-dom.react-server.production.js | 2 +- .../next/src/compiled/react-dom/package.json | 4 +- .../cjs/react.development.js | 2 +- .../cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 2 +- .../cjs/react.react-server.production.js | 2 +- .../next/src/compiled/react-is/package.json | 2 +- ...om-turbopack-client.browser.development.js | 362 +++------ ...dom-turbopack-client.browser.production.js | 70 +- ...r-dom-turbopack-client.edge.development.js | 61 +- ...er-dom-turbopack-client.edge.production.js | 48 +- ...r-dom-turbopack-client.node.development.js | 203 ++--- ...er-dom-turbopack-client.node.production.js | 234 ++---- ...om-turbopack-server.browser.development.js | 620 ++++++---------- ...dom-turbopack-server.browser.production.js | 168 ++--- ...r-dom-turbopack-server.edge.development.js | 620 ++++++---------- ...er-dom-turbopack-server.edge.production.js | 168 ++--- ...r-dom-turbopack-server.node.development.js | 699 ++++++------------ ...er-dom-turbopack-server.node.production.js | 221 +++--- .../package.json | 4 +- ...om-turbopack-client.browser.development.js | 362 +++------ ...dom-turbopack-client.browser.production.js | 70 +- ...r-dom-turbopack-client.edge.development.js | 61 +- ...er-dom-turbopack-client.edge.production.js | 48 +- ...r-dom-turbopack-client.node.development.js | 203 ++--- ...er-dom-turbopack-client.node.production.js | 224 ++---- ...om-turbopack-server.browser.development.js | 587 ++++++--------- ...dom-turbopack-server.browser.production.js | 133 ++-- ...r-dom-turbopack-server.edge.development.js | 587 ++++++--------- ...er-dom-turbopack-server.edge.production.js | 133 ++-- ...r-dom-turbopack-server.node.development.js | 650 ++++++---------- ...er-dom-turbopack-server.node.production.js | 186 ++--- .../react-server-dom-turbopack/package.json | 4 +- ...-dom-webpack-client.browser.development.js | 341 +++------ ...r-dom-webpack-client.browser.production.js | 51 +- ...ver-dom-webpack-client.edge.development.js | 40 +- ...rver-dom-webpack-client.edge.production.js | 29 +- ...ver-dom-webpack-client.node.development.js | 102 ++- ...rver-dom-webpack-client.node.production.js | 73 +- ...bpack-client.node.unbundled.development.js | 102 ++- ...ebpack-client.node.unbundled.production.js | 73 +- ...-dom-webpack-server.browser.development.js | 599 ++++++--------- ...r-dom-webpack-server.browser.production.js | 149 ++-- ...ver-dom-webpack-server.edge.development.js | 599 ++++++--------- ...rver-dom-webpack-server.edge.production.js | 149 ++-- ...ver-dom-webpack-server.node.development.js | 681 ++++++----------- ...rver-dom-webpack-server.node.production.js | 202 +++-- ...bpack-server.node.unbundled.development.js | 681 ++++++----------- ...ebpack-server.node.unbundled.production.js | 202 +++-- .../package.json | 4 +- ...-dom-webpack-client.browser.development.js | 341 +++------ ...r-dom-webpack-client.browser.production.js | 51 +- ...ver-dom-webpack-client.edge.development.js | 40 +- ...rver-dom-webpack-client.edge.production.js | 29 +- ...ver-dom-webpack-client.node.development.js | 102 ++- ...rver-dom-webpack-client.node.production.js | 73 +- ...bpack-client.node.unbundled.development.js | 102 ++- ...ebpack-client.node.unbundled.production.js | 73 +- ...-dom-webpack-server.browser.development.js | 566 +++++--------- ...r-dom-webpack-server.browser.production.js | 114 +-- ...ver-dom-webpack-server.edge.development.js | 566 +++++--------- ...rver-dom-webpack-server.edge.production.js | 114 +-- ...ver-dom-webpack-server.node.development.js | 632 ++++++---------- ...rver-dom-webpack-server.node.production.js | 167 ++--- ...bpack-server.node.unbundled.development.js | 632 ++++++---------- ...ebpack-server.node.unbundled.production.js | 167 ++--- .../react-server-dom-webpack/package.json | 4 +- .../compiled/react/cjs/react.development.js | 2 +- .../compiled/react/cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 2 +- .../cjs/react.react-server.production.js | 2 +- pnpm-lock.yaml | 135 ++-- 112 files changed, 5578 insertions(+), 9459 deletions(-) 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 7fe2e0573c6c7..d748980ad89fd 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 @@ -31109,11 +31109,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -31150,10 +31150,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -31299,7 +31299,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; "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 d364475252241..18da38287e7f6 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 @@ -19257,14 +19257,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2169 = React.version; if ( - "19.2.0-experimental-97cdd5d3-20250710" !== + "19.2.0-experimental-e6ed827a-20250715" !== isomorphicReactPackageVersion$jscomp$inline_2169 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2169, - "19.2.0-experimental-97cdd5d3-20250710" + "19.2.0-experimental-e6ed827a-20250715" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19286,10 +19286,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2854 = { bundleType: 0, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2855 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -19396,4 +19396,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 a9800c212434a..12a5f078019d5 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 @@ -31161,11 +31161,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -31202,10 +31202,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -31681,7 +31681,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; "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 a1e0c45f8b159..9373585ce2b98 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 @@ -20939,14 +20939,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2391 = React.version; if ( - "19.2.0-experimental-97cdd5d3-20250710" !== + "19.2.0-experimental-e6ed827a-20250715" !== isomorphicReactPackageVersion$jscomp$inline_2391 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2391, - "19.2.0-experimental-97cdd5d3-20250710" + "19.2.0-experimental-e6ed827a-20250715" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -20968,10 +20968,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_3078 = { bundleType: 0, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_3079 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -21238,7 +21238,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; "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 5bf452a58ff35..23da14ab600a8 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 @@ -10502,5 +10502,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.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 a99af3323e882..1641281eb6e4d 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 @@ -7118,4 +7118,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.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 d12a49e74c26a..add778d059d17 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 @@ -10502,5 +10502,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.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 5c17d4aef618f..9750d4bad7395 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 @@ -7221,4 +7221,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.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 d6a67b02d7ddd..41cd2cab26e7b 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 @@ -5018,7 +5018,8 @@ renderState.nextSegmentId = postponedState.nextSegmentId; if ("number" === typeof postponedState.replaySlots) return ( - (onError = createPendingSegment( + (onError = postponedState.replaySlots), + (onAllReady = createPendingSegment( renderState, 0, null, @@ -5026,14 +5027,15 @@ !1, !1 )), - (onError.parentFlushed = !0), + (onAllReady.id = onError), + (onAllReady.parentFlushed = !0), (children = createRenderTask( renderState, null, children, -1, null, - onError, + onAllReady, null, null, renderState.abortableTasks, @@ -9456,15 +9458,13 @@ (request.completedRootSegment.status !== POSTPONED && null !== request.completedPreambleSegments) ) { - var nextSegmentId = request.nextSegmentId; var replaySlots = trackedPostpones.rootSlots; var resumableState = request.resumableState; resumableState.bootstrapScriptContent = void 0; resumableState.bootstrapScripts = void 0; resumableState.bootstrapModules = void 0; } else { - nextSegmentId = 0; - replaySlots = -1; + replaySlots = request.completedRootSegment.id; resumableState = request.resumableState; var renderState = request.renderState; resumableState.nextFormID = 0; @@ -9481,7 +9481,7 @@ resumableState.instructions = NothingSent; } return { - nextSegmentId: nextSegmentId, + nextSegmentId: request.nextSegmentId, rootFormatContext: request.rootFormatContext, progressiveChunkSize: request.progressiveChunkSize, resumableState: request.resumableState, @@ -9491,11 +9491,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -11314,5 +11314,5 @@ startWork(request); }); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 3399c52ed915e..cb82538ac2003 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 @@ -4488,7 +4488,8 @@ function resumeRequest( renderState.nextSegmentId = postponedState.nextSegmentId; if ("number" === typeof postponedState.replaySlots) return ( - (onError = createPendingSegment( + (onError = postponedState.replaySlots), + (onAllReady = createPendingSegment( renderState, 0, null, @@ -4496,14 +4497,15 @@ function resumeRequest( !1, !1 )), - (onError.parentFlushed = !0), + (onAllReady.id = onError), + (onAllReady.parentFlushed = !0), (children = createRenderTask( renderState, null, children, -1, null, - onError, + onAllReady, null, null, renderState.abortableTasks, @@ -7746,15 +7748,13 @@ function getPostponedState(request) { (5 !== request.completedRootSegment.status && null !== request.completedPreambleSegments) ) { - var nextSegmentId = request.nextSegmentId; var replaySlots = trackedPostpones.rootSlots; var resumableState = request.resumableState; resumableState.bootstrapScriptContent = void 0; resumableState.bootstrapScripts = void 0; resumableState.bootstrapModules = void 0; } else { - nextSegmentId = 0; - replaySlots = -1; + replaySlots = request.completedRootSegment.id; resumableState = request.resumableState; var renderState = request.renderState; resumableState.nextFormID = 0; @@ -7771,7 +7771,7 @@ function getPostponedState(request) { resumableState.instructions = 0; } return { - nextSegmentId: nextSegmentId, + nextSegmentId: request.nextSegmentId, rootFormatContext: request.rootFormatContext, progressiveChunkSize: request.progressiveChunkSize, resumableState: request.resumableState, @@ -7781,12 +7781,12 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.2.0-experimental-97cdd5d3-20250710" + "19.2.0-experimental-e6ed827a-20250715" ) ); } @@ -8041,4 +8041,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 a16a39e57c7d0..40feff3e52516 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 @@ -7269,13 +7269,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_869 = React.version; if ( - "19.2.0-experimental-97cdd5d3-20250710" !== + "19.2.0-experimental-e6ed827a-20250715" !== isomorphicReactPackageVersion$jscomp$inline_869 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_869 + - "\n - react-dom: 19.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -7366,4 +7366,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 dcd138d0fded0..59ea5acda0602 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 @@ -5026,7 +5026,8 @@ renderState.nextSegmentId = postponedState.nextSegmentId; if ("number" === typeof postponedState.replaySlots) return ( - (onError = createPendingSegment( + (onError = postponedState.replaySlots), + (onAllReady = createPendingSegment( renderState, 0, null, @@ -5034,14 +5035,15 @@ !1, !1 )), - (onError.parentFlushed = !0), + (onAllReady.id = onError), + (onAllReady.parentFlushed = !0), (children = createRenderTask( renderState, null, children, -1, null, - onError, + onAllReady, null, null, renderState.abortableTasks, @@ -9485,15 +9487,13 @@ (request.completedRootSegment.status !== POSTPONED && null !== request.completedPreambleSegments) ) { - var nextSegmentId = request.nextSegmentId; var replaySlots = trackedPostpones.rootSlots; var resumableState = request.resumableState; resumableState.bootstrapScriptContent = void 0; resumableState.bootstrapScripts = void 0; resumableState.bootstrapModules = void 0; } else { - nextSegmentId = 0; - replaySlots = -1; + replaySlots = request.completedRootSegment.id; resumableState = request.resumableState; var renderState = request.renderState; resumableState.nextFormID = 0; @@ -9510,7 +9510,7 @@ resumableState.instructions = NothingSent; } return { - nextSegmentId: nextSegmentId, + nextSegmentId: request.nextSegmentId, rootFormatContext: request.rootFormatContext, progressiveChunkSize: request.progressiveChunkSize, resumableState: request.resumableState, @@ -9520,11 +9520,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -11339,5 +11339,5 @@ startWork(request); }); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 83541553207f2..85567a59ffe6c 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 @@ -4540,7 +4540,8 @@ function resumeRequest( renderState.nextSegmentId = postponedState.nextSegmentId; if ("number" === typeof postponedState.replaySlots) return ( - (onError = createPendingSegment( + (onError = postponedState.replaySlots), + (onAllReady = createPendingSegment( renderState, 0, null, @@ -4548,14 +4549,15 @@ function resumeRequest( !1, !1 )), - (onError.parentFlushed = !0), + (onAllReady.id = onError), + (onAllReady.parentFlushed = !0), (children = createRenderTask( renderState, null, children, -1, null, - onError, + onAllReady, null, null, renderState.abortableTasks, @@ -7864,15 +7866,13 @@ function getPostponedState(request) { (5 !== request.completedRootSegment.status && null !== request.completedPreambleSegments) ) { - var nextSegmentId = request.nextSegmentId; var replaySlots = trackedPostpones.rootSlots; var resumableState = request.resumableState; resumableState.bootstrapScriptContent = void 0; resumableState.bootstrapScripts = void 0; resumableState.bootstrapModules = void 0; } else { - nextSegmentId = 0; - replaySlots = -1; + replaySlots = request.completedRootSegment.id; resumableState = request.resumableState; var renderState = request.renderState; resumableState.nextFormID = 0; @@ -7889,7 +7889,7 @@ function getPostponedState(request) { resumableState.instructions = 0; } return { - nextSegmentId: nextSegmentId, + nextSegmentId: request.nextSegmentId, rootFormatContext: request.rootFormatContext, progressiveChunkSize: request.progressiveChunkSize, resumableState: request.resumableState, @@ -7899,11 +7899,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -8157,4 +8157,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 56679ddbb878a..95837c2265c28 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 @@ -4915,7 +4915,8 @@ renderState.nextSegmentId = postponedState.nextSegmentId; if ("number" === typeof postponedState.replaySlots) return ( - (onError = createPendingSegment( + (onError = postponedState.replaySlots), + (onAllReady = createPendingSegment( renderState, 0, null, @@ -4923,14 +4924,15 @@ !1, !1 )), - (onError.parentFlushed = !0), + (onAllReady.id = onError), + (onAllReady.parentFlushed = !0), (children = createRenderTask( renderState, null, children, -1, null, - onError, + onAllReady, null, null, renderState.abortableTasks, @@ -9346,15 +9348,13 @@ (request.completedRootSegment.status !== POSTPONED && null !== request.completedPreambleSegments) ) { - var nextSegmentId = request.nextSegmentId; var replaySlots = trackedPostpones.rootSlots; var resumableState = request.resumableState; resumableState.bootstrapScriptContent = void 0; resumableState.bootstrapScripts = void 0; resumableState.bootstrapModules = void 0; } else { - nextSegmentId = 0; - replaySlots = -1; + replaySlots = request.completedRootSegment.id; resumableState = request.resumableState; var renderState = request.renderState; resumableState.nextFormID = 0; @@ -9371,7 +9371,7 @@ resumableState.instructions = NothingSent; } return { - nextSegmentId: nextSegmentId, + nextSegmentId: request.nextSegmentId, rootFormatContext: request.rootFormatContext, progressiveChunkSize: request.progressiveChunkSize, resumableState: request.resumableState, @@ -9381,11 +9381,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -11510,5 +11510,5 @@ } }; }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 f8bf8870a29c6..d5cb5fdc6b7b6 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 @@ -4428,7 +4428,8 @@ function resumeRequest( renderState.nextSegmentId = postponedState.nextSegmentId; if ("number" === typeof postponedState.replaySlots) return ( - (onError = createPendingSegment( + (onError = postponedState.replaySlots), + (onAllReady = createPendingSegment( renderState, 0, null, @@ -4436,14 +4437,15 @@ function resumeRequest( !1, !1 )), - (onError.parentFlushed = !0), + (onAllReady.id = onError), + (onAllReady.parentFlushed = !0), (children = createRenderTask( renderState, null, children, -1, null, - onError, + onAllReady, null, null, renderState.abortableTasks, @@ -7744,15 +7746,13 @@ function getPostponedState(request) { (5 !== request.completedRootSegment.status && null !== request.completedPreambleSegments) ) { - var nextSegmentId = request.nextSegmentId; var replaySlots = trackedPostpones.rootSlots; var resumableState = request.resumableState; resumableState.bootstrapScriptContent = void 0; resumableState.bootstrapScripts = void 0; resumableState.bootstrapModules = void 0; } else { - nextSegmentId = 0; - replaySlots = -1; + replaySlots = request.completedRootSegment.id; resumableState = request.resumableState; var renderState = request.renderState; resumableState.nextFormID = 0; @@ -7769,7 +7769,7 @@ function getPostponedState(request) { resumableState.instructions = 0; } return { - nextSegmentId: nextSegmentId, + nextSegmentId: request.nextSegmentId, rootFormatContext: request.rootFormatContext, progressiveChunkSize: request.progressiveChunkSize, resumableState: request.resumableState, @@ -7779,11 +7779,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -8341,4 +8341,4 @@ exports.resumeToPipeableStream = function (children, postponedState, options) { } }; }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 3536c1c116442..9127c9971db8b 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 @@ -31430,11 +31430,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-e6ed827a-20250715" !== 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.2.0-experimental-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -31471,10 +31471,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -31786,5 +31786,5 @@ } }; }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 ba34ac7b434bc..ada316b587bb5 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 @@ -19573,14 +19573,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2198 = React.version; if ( - "19.2.0-experimental-97cdd5d3-20250710" !== + "19.2.0-experimental-e6ed827a-20250715" !== isomorphicReactPackageVersion$jscomp$inline_2198 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2198, - "19.2.0-experimental-97cdd5d3-20250710" + "19.2.0-experimental-e6ed827a-20250715" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19602,10 +19602,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2888 = { bundleType: 0, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2889 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -19863,4 +19863,4 @@ exports.observeVisibleRects = function ( } }; }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 aa1229017f518..20b50bffd33bd 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 @@ -416,7 +416,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; "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 8a47bea3c095e..26582be3e89c9 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 @@ -207,4 +207,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 c9de880a0df98..785066a4e8c39 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 @@ -336,5 +336,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 9e8b462e05675..9957cb5ee93ad 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 @@ -149,4 +149,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; diff --git a/packages/next/src/compiled/react-dom-experimental/package.json b/packages/next/src/compiled/react-dom-experimental/package.json index b6b6680b305e4..a316eb9f29f10 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-97cdd5d3-20250710" + "scheduler": "0.0.0-experimental-e6ed827a-20250715" }, "peerDependencies": { - "react": "0.0.0-experimental-97cdd5d3-20250710" + "react": "0.0.0-experimental-e6ed827a-20250715" }, "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 3941173e49433..3eb86925fa268 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 @@ -25507,11 +25507,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== 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.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25548,10 +25548,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-canary-97cdd5d3-20250710", + version: "19.2.0-canary-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-canary-e6ed827a-20250715" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25689,7 +25689,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; "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 85e05e705636a..19fbe1f9397a7 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 @@ -15716,14 +15716,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1838 = React.version; if ( - "19.2.0-canary-97cdd5d3-20250710" !== + "19.2.0-canary-e6ed827a-20250715" !== isomorphicReactPackageVersion$jscomp$inline_1838 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1838, - "19.2.0-canary-97cdd5d3-20250710" + "19.2.0-canary-e6ed827a-20250715" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15745,10 +15745,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2331 = { bundleType: 0, - version: "19.2.0-canary-97cdd5d3-20250710", + version: "19.2.0-canary-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-canary-e6ed827a-20250715" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2332 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15846,4 +15846,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 3bd88ec5715e9..4835774721816 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 @@ -25559,11 +25559,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== 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.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25600,10 +25600,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-canary-97cdd5d3-20250710", + version: "19.2.0-canary-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-97cdd5d3-20250710" + reconcilerVersion: "19.2.0-canary-e6ed827a-20250715" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -26071,7 +26071,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; "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 8f931af85af1e..44820075b66e4 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 @@ -16417,14 +16417,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1942 = React.version; if ( - "19.2.0-canary-97cdd5d3-20250710" !== + "19.2.0-canary-e6ed827a-20250715" !== isomorphicReactPackageVersion$jscomp$inline_1942 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1942, - "19.2.0-canary-97cdd5d3-20250710" + "19.2.0-canary-e6ed827a-20250715" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -16446,10 +16446,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_1949 = { bundleType: 0, - version: "19.2.0-canary-97cdd5d3-20250710", + version: "19.2.0-canary-e6ed827a-20250715", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-97cdd5d3-20250710", + reconcilerVersion: "19.2.0-canary-e6ed827a-20250715", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$281 = 0; @@ -16722,7 +16722,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; "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 ce9b76c2a3b74..47408569973ec 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 @@ -9701,5 +9701,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.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; })(); 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 6302414fc8999..fcc9b597cf340 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 @@ -6467,4 +6467,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.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 99ec0fa9571db..3a79faf27f493 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 @@ -9701,5 +9701,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.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; })(); 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 60343343f5ba5..1ed69ced9d011 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 @@ -6550,4 +6550,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.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 66123d851ba83..e7c1cb6bdb094 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 @@ -8448,11 +8448,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== 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.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -10142,5 +10142,5 @@ startWork(request); }); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; })(); 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 407c54c65228e..53f9210aa1b04 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 @@ -6851,12 +6851,12 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.2.0-canary-97cdd5d3-20250710" + "19.2.0-canary-e6ed827a-20250715" ) ); } @@ -7003,4 +7003,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 b45ff91f4eff5..a62e8eebfaecc 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 @@ -6499,13 +6499,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_816 = React.version; if ( - "19.2.0-canary-97cdd5d3-20250710" !== + "19.2.0-canary-e6ed827a-20250715" !== isomorphicReactPackageVersion$jscomp$inline_816 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_816 + - "\n - react-dom: 19.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -6596,4 +6596,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 cd1471d08b22e..ac22e3f734cd4 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 @@ -8471,11 +8471,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== 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.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -10161,5 +10161,5 @@ startWork(request); }); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; })(); 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 b0f9d86b9636f..403c6824896d1 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 @@ -6949,11 +6949,11 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== 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.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -7099,4 +7099,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 ad5349042ce95..a82e5e8c5d36c 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 @@ -8346,11 +8346,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== 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.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -10221,5 +10221,5 @@ startWork(request); }); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; })(); 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 4c34745d133fa..442a263de21b0 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 @@ -6841,11 +6841,11 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-97cdd5d3-20250710" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-e6ed827a-20250715" !== 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.2.0-canary-97cdd5d3-20250710\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-e6ed827a-20250715\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -7183,4 +7183,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 a8f00753b278d..ef7e450aeec67 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 @@ -416,7 +416,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; "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 f74f572e48aa9..2e04c0d85cf3c 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 @@ -207,4 +207,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 35c6846598c84..5994178cbe2e6 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 @@ -336,5 +336,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; })(); 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 e57c8259f0c01..0a2933fdfd405 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 @@ -149,4 +149,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; diff --git a/packages/next/src/compiled/react-dom/package.json b/packages/next/src/compiled/react-dom/package.json index bf9b8127e8c12..4a85a9a444a20 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.27.0-canary-97cdd5d3-20250710" + "scheduler": "0.27.0-canary-e6ed827a-20250715" }, "peerDependencies": { - "react": "19.2.0-canary-97cdd5d3-20250710" + "react": "19.2.0-canary-e6ed827a-20250715" }, "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 601bc436c12e7..34802237b0c8f 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.development.js @@ -1328,7 +1328,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; "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 95f6070245123..51bb48575941e 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.production.js @@ -605,4 +605,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; 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 69e35c7d3b18d..760b34db0a97b 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 @@ -996,5 +996,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.2.0-experimental-97cdd5d3-20250710"; + exports.version = "19.2.0-experimental-e6ed827a-20250715"; })(); 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 89c760e1f2d41..e32f17d20dee7 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 @@ -572,4 +572,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.2.0-experimental-97cdd5d3-20250710"; +exports.version = "19.2.0-experimental-e6ed827a-20250715"; diff --git a/packages/next/src/compiled/react-is/package.json b/packages/next/src/compiled/react-is/package.json index 1a77a7774aefe..84bb0dc196fe2 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.2.0-canary-97cdd5d3-20250710", + "version": "19.2.0-canary-e6ed827a-20250715", "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 386858aa06374..fdd3586be7b85 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 @@ -73,15 +73,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load_by_url__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load_by_url__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2252,13 +2252,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2312,6 +2305,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2342,15 +2337,6 @@ replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -3721,96 +3707,6 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { - if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; - for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk[i]; - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 35 === rowState || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk[i++]; - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf(10, i); - break; - case 4: - (lastIdx = i + rowLength), - lastIdx > chunk.length && (lastIdx = -1); - } - var offset = chunk.byteOffset + i; - if (-1 < lastIdx) - (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - weakResponse, - rowTag, - buffer, - rowLength - ), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; - } - } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } - } function createFromJSONCallback(response) { return function (key, value) { if ("string" === typeof value) @@ -3891,9 +3787,6 @@ return value; }; } - function close(weakResponse) { - reportGlobalError(weakResponse, Error("Connection closed.")); - } function createDebugCallbackFromWritableStream(debugWritable) { var textEncoder = new TextEncoder(), writer = debugWritable.getWriter(); @@ -3928,145 +3821,112 @@ debugChannel )._weakResponse; } - function startReadingFromUniversalStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) close(response$jscomp$0); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - if (value instanceof ArrayBuffer) - processBinaryChunk( - response$jscomp$0, - streamState, - new Uint8Array(value) - ); - else if ("string" === typeof value) { - if ( - ((_ref = streamState), void 0 !== response$jscomp$0.weak.deref()) - ) { - for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, - rowState = _ref._rowState, - rowID = _ref._rowID, - rowTag = _ref._rowTag, - rowLength = _ref._rowLength, - buffer = _ref._buffer, - chunkLength = value.length; - i < chunkLength; + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); + for ( + var i = 0, + rowState = _ref._rowState, + rowID = _ref._rowID, + rowTag = _ref._rowTag, + rowLength = _ref._rowLength, + buffer = _ref._buffer, + chunkLength = value.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = value.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = value.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = value.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = value.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if ( - rowLength < value.length || - value.length > 3 * rowLength - ) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = value.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = value.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (value.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = value[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 1: + rowState = value[i]; + 84 === rowState || + 65 === rowState || + 79 === rowState || + 111 === rowState || + 85 === rowState || + 83 === rowState || + 115 === rowState || + 76 === rowState || + 108 === rowState || + 71 === rowState || + 103 === rowState || + 77 === rowState || + 109 === rowState || + 86 === rowState + ? ((rowTag = rowState), (rowState = 2), i++) + : (64 < rowState && 91 > rowState) || + 35 === rowState || + 114 === rowState || + 120 === rowState + ? ((rowTag = rowState), (rowState = 3), i++) + : ((rowTag = 0), (rowState = 3)); + continue; + case 2: + lastIdx = value[i++]; + 44 === lastIdx + ? (rowState = 4) + : (rowLength = + (rowLength << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 3: + lastIdx = value.indexOf(10, i); + break; + case 4: + (lastIdx = i + rowLength), + lastIdx > value.length && (lastIdx = -1); + } + var offset = value.byteOffset + i; + if (-1 < lastIdx) + (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + value = new Uint8Array( + value.buffer, + offset, + value.byteLength - i + ); + buffer.push(value); + rowLength -= value.byteLength; + break; } - _ref._rowState = rowState; - _ref._rowID = rowID; - _ref._rowTag = rowTag; - _ref._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, value); + _ref._rowState = rowState; + _ref._rowID = rowID; + _ref._rowTag = rowTag; + _ref._rowLength = rowLength; + } return reader.read().then(progress).catch(error); } } - function error(e) { - reportGlobalError(response$jscomp$0, e); - } - var streamState = createStreamState(), - reader = stream.getReader(); - reader.read().then(progress).catch(error); - } - function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) isSecondaryStream || close(response); - else - return ( - processBinaryChunk(response, streamState, value), - reader.read().then(progress).catch(error) - ); - } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var React = require("react"), ReactDOM = require("react-dom"), decoderOptions = { stream: !0 }, bind = Function.prototype.bind, - chunkCache = new Map(), + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(), ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), @@ -4274,10 +4134,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710", + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -4286,13 +4146,7 @@ var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, r.body, !0)) - : startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -4301,15 +4155,9 @@ return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { - var response = createResponseFromOptions(options); - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, stream, !0)) - : startReadingFromStream(response, stream, !1); - return getRoot(response); + options = createResponseFromOptions(options); + startReadingFromStream(options, stream); + return getRoot(options); }; exports.createServerReference = function ( id, 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 6d6b2d1c7aa91..6331aa3a63fa1 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 @@ -50,7 +50,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = __turbopack_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -67,18 +66,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load_by_url__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load_by_url__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -1192,6 +1191,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1667,20 +1668,18 @@ function createResponseFromOptions(options) { : void 0 ); } -function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) - isSecondaryStream || - reportGlobalError(response, Error("Connection closed.")); +function startReadingFromStream(response, stream) { + function progress(_ref) { + var value = _ref.value; + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref2 = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1691,8 +1690,8 @@ function startReadingFromStream(response, stream, isSecondaryStream) { lastIdx = value[i++]; 58 === lastIdx ? (rowState = 1) - : (_ref2 = - (_ref2 << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + : (_ref = + (_ref << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: rowState = value[i]; @@ -1735,10 +1734,10 @@ function startReadingFromStream(response, stream, isSecondaryStream) { var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, _ref2, rowTag, buffer, rowLength), + processFullBinaryRow(response, _ref, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, - (rowLength = _ref2 = rowTag = rowState = 0), + (rowLength = _ref = rowTag = rowState = 0), (buffer.length = 0); else { value = new Uint8Array(value.buffer, offset, value.byteLength - i); @@ -1747,31 +1746,24 @@ function startReadingFromStream(response, stream, isSecondaryStream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref2; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -1781,7 +1773,7 @@ exports.createFromFetch = function (promiseForResponse, options) { }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); - startReadingFromStream(options, stream, !1); + startReadingFromStream(options, stream); return getChunk(options, 0); }; exports.createServerReference = function (id, callServer) { 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 c3506e16b8dda..e7a9fcd472be2 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 @@ -73,15 +73,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2470,13 +2470,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2530,6 +2523,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -4037,17 +4032,15 @@ void 0 )._weakResponse; } - function startReadingFromStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) - reportGlobalError(response$jscomp$0, Error("Connection closed.")); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - _ref = streamState; - if (void 0 !== response$jscomp$0.weak.deref()) { + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, + var i = 0, rowState = _ref._rowState, rowID = _ref._rowID, rowTag = _ref._rowTag, @@ -4109,13 +4102,7 @@ var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - rowID, - rowTag, - buffer, - rowLength - ), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -4140,23 +4127,17 @@ } } function error(e) { - reportGlobalError(response$jscomp$0, e); + reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var ReactDOM = require("react-dom"), React = require("react"), decoderOptions = { stream: !0 }, bind$1 = Function.prototype.bind, - chunkCache = new Map(), + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(), ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), 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 854242a138a1f..645c8b873e415 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 @@ -50,7 +50,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -67,18 +66,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -1376,6 +1375,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1867,12 +1868,12 @@ function startReadingFromStream(response, stream) { if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1939,24 +1940,17 @@ function startReadingFromStream(response, stream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { 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 2a30e84aebf69..4615635406ff6 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 @@ -73,15 +73,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2470,13 +2470,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2530,6 +2523,8 @@ this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2560,15 +2555,6 @@ replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -3944,16 +3930,16 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { + function processBinaryChunk(weakResponse, chunk) { if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; + weakResponse = unwrapWeakResponse(weakResponse); for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -3964,8 +3950,8 @@ lastIdx = chunk[i++]; 58 === lastIdx ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | + : (rowID = + (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: @@ -4011,15 +3997,15 @@ if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), processFullBinaryRow( - response, weakResponse, + rowID, rowTag, buffer, rowLength ), (i = lastIdx), 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), + (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); @@ -4028,10 +4014,10 @@ break; } } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } } function createFromJSONCallback(response) { @@ -4145,15 +4131,14 @@ if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -4166,7 +4151,8 @@ React = require("react"), decoderOptions = { stream: !0 }, bind$1 = Function.prototype.bind, - chunkCache = new Map(), + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(), ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), @@ -4382,122 +4368,29 @@ serverConsumerManifest, options ) { - var response$jscomp$0 = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0, - options && options.findSourceMapURL - ? options.findSourceMapURL - : void 0, - options ? !0 === options.replayConsoleLogs : !1, - options && options.environmentName ? options.environmentName : void 0, - void 0 - )._weakResponse, - streamState = createStreamState(); + var response = new ResponseInstance( + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0, + options && options.findSourceMapURL ? options.findSourceMapURL : void 0, + options ? !0 === options.replayConsoleLogs : !1, + options && options.environmentName ? options.environmentName : void 0, + void 0 + )._weakResponse; stream.on("data", function (chunk) { - if ("string" === typeof chunk) { - if (void 0 !== response$jscomp$0.weak.deref()) { - for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if (rowLength < chunk.length || chunk.length > 3 * rowLength) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = chunk.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (chunk.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } - } else processBinaryChunk(response$jscomp$0, streamState, chunk); + processBinaryChunk(response, chunk); }); stream.on("error", function (error) { - reportGlobalError(response$jscomp$0, error); + reportGlobalError(response, error); }); stream.on("end", function () { - return close(response$jscomp$0); + return close(response); }); - return getRoot(response$jscomp$0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); 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 df1c30440760f..aaabac434bc59 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 @@ -51,7 +51,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -68,18 +67,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -1377,14 +1376,13 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; this._fromJSON = createFromJSONCallback(this); } -function createStreamState() { - return { _rowState: 0, _rowID: 0, _rowTag: 0, _rowLength: 0, _buffer: [] }; -} function resolveBuffer(response, id, buffer) { response = response._chunks; var chunk = response.get(id); @@ -1704,47 +1702,46 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - row += stringDecoder.decode(chunk); - processFullStringRow(response, id, tag, row); -} -function processFullStringRow(response, id, tag, row) { + buffer = row += stringDecoder.decode(chunk); switch (tag) { case 73: - resolveModule(response, id, row); + resolveModule(response, id, buffer); break; case 72: - id = row[0]; - row = row.slice(1); - response = JSON.parse(row, response._fromJSON); - row = ReactDOMSharedInternals.d; + id = buffer[0]; + buffer = buffer.slice(1); + response = JSON.parse(buffer, response._fromJSON); + buffer = ReactDOMSharedInternals.d; switch (id) { case "D": - row.D(response); + buffer.D(response); break; case "C": "string" === typeof response - ? row.C(response) - : row.C(response[0], response[1]); + ? buffer.C(response) + : buffer.C(response[0], response[1]); break; case "L": id = response[0]; tag = response[1]; - 3 === response.length ? row.L(id, tag, response[2]) : row.L(id, tag); + 3 === response.length + ? buffer.L(id, tag, response[2]) + : buffer.L(id, tag); break; case "m": "string" === typeof response - ? row.m(response) - : row.m(response[0], response[1]); + ? buffer.m(response) + : buffer.m(response[0], response[1]); break; case "X": "string" === typeof response - ? row.X(response) - : row.X(response[0], response[1]); + ? buffer.X(response) + : buffer.X(response[0], response[1]); break; case "S": "string" === typeof response - ? row.S(response) - : row.S( + ? buffer.S(response) + : buffer.S( response[0], 0 === response[1] ? void 0 : response[1], 3 === response.length ? response[2] : void 0 @@ -1752,25 +1749,24 @@ function processFullStringRow(response, id, tag, row) { break; case "M": "string" === typeof response - ? row.M(response) - : row.M(response[0], response[1]); + ? buffer.M(response) + : buffer.M(response[0], response[1]); } break; case 69: - tag = JSON.parse(row); - row = resolveErrorProd(); - row.digest = tag.digest; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; - var chunk = tag.get(id); - chunk - ? triggerErrorOnChunk(response, chunk, row) - : tag.set(id, createErrorChunk(response, row)); + (chunk = tag.get(id)) + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, createErrorChunk(response, buffer)); break; case 84: response = response._chunks; (tag = response.get(id)) && "pending" !== tag.status - ? tag.reason.enqueueValue(row) - : response.set(id, new ReactPromise("fulfilled", row, null)); + ? tag.reason.enqueueValue(buffer) + : response.set(id, new ReactPromise("fulfilled", buffer, null)); break; case 78: case 68: @@ -1794,34 +1790,34 @@ function processFullStringRow(response, id, tag, row) { case 67: (response = response._chunks.get(id)) && "fulfilled" === response.status && - response.reason.close("" === row ? '"$undefined"' : row); + response.reason.close("" === buffer ? '"$undefined"' : buffer); break; case 80: - row = Error( + buffer = Error( "A Server Component was postponed. The reason is omitted in production builds to avoid leaking sensitive details." ); - row.$$typeof = REACT_POSTPONE_TYPE; - row.stack = "Error: " + row.message; + buffer.$$typeof = REACT_POSTPONE_TYPE; + buffer.stack = "Error: " + buffer.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(response, chunk, row) - : tag.set(id, createErrorChunk(response, row)); + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, createErrorChunk(response, buffer)); break; default: (tag = response._chunks), (chunk = tag.get(id)) - ? resolveModelChunk(response, chunk, row) - : tag.set(id, new ReactPromise("resolved_model", row, response)); + ? resolveModelChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("resolved_model", buffer, response)); } } -function processBinaryChunk(weakResponse, streamState, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1881,16 +1877,16 @@ function processBinaryChunk(weakResponse, streamState, chunk) { (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { - weakResponse = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(weakResponse); - rowLength -= weakResponse.byteLength; + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; break; } } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1954,15 +1950,14 @@ function startReadingFromStream(response, stream) { if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -1988,103 +1983,16 @@ exports.createFromNodeStream = function ( options ) { var response = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0 - ), - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0 + ); stream.on("data", function (chunk) { - if ("string" === typeof chunk) { - for ( - var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if (rowLength < chunk.length || chunk.length > 3 * rowLength) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = chunk.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (chunk.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } else processBinaryChunk(response, streamState, chunk); + processBinaryChunk(response, chunk); }); stream.on("error", function (error) { reportGlobalError(response, error); 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 2df70bcaadb61..f69f3b4a8b120 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 @@ -70,15 +70,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -235,77 +226,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -322,10 +308,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -336,12 +322,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -350,8 +332,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -692,29 +673,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -727,44 +692,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("%c%s%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(7)), + ? (args.splice(env, 4, format.slice(7)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -906,7 +864,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1017,14 +974,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1053,22 +1002,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1188,9 +1121,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1277,9 +1208,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1451,7 +1380,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2066,9 +1995,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2627,16 +2554,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2753,8 +2674,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2771,12 +2690,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3084,7 +3002,7 @@ markOperationEndTime(request$jscomp$1, task, info.time); else if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3143,11 +3061,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, id, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); } } @@ -3167,17 +3085,11 @@ forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; - var json = '{"time":' + (timestamp - request.timeOrigin) + "}"; - null !== request.debugDestination - ? ((timestamp = request.nextChunkId++), - (json = timestamp.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + request.pendingDebugChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function markOperationEndTime(request, task, timestamp) { (request.status === ABORTING && timestamp > request.abortTime) || @@ -3271,7 +3183,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); task.timed && markOperationEndTime(request, task, performance.now()); if ("object" === typeof resolvedModel && null !== resolvedModel) @@ -3343,7 +3255,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3371,131 +3284,87 @@ (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - cleanupTaintQueue(request), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (cleanupTaintQueue(request), + request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3507,13 +3376,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3527,7 +3397,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3540,7 +3410,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3552,7 +3423,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3616,7 +3488,8 @@ else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3680,15 +3553,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -4402,55 +4275,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -4934,7 +4791,8 @@ debugNoOutline = null, emptyRoot = {}, decoderOptions = { stream: !0 }, - chunkCache = new Map(); + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -5053,10 +4911,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, turbopackMap, @@ -5079,30 +4933,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 a93f1e6ba8a85..3100a50b176f6 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 @@ -819,7 +819,8 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? (haltTask(newTask), finishHaltedTask(newTask, request)) + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) : ((task = request.fatalError), abortTask(newTask), finishAbortedTask(newTask, request, task)), @@ -872,8 +873,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -889,9 +890,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -952,8 +951,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -973,9 +972,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1377,9 +1374,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1880,7 +1875,7 @@ function retryTask(request, task) { (task.status = 0), 21 === request.type) ) - haltTask(task), finishHaltedTask(task, request); + haltTask(task), 3 === task.status && request.pendingChunks--; else { var errorId = request.fatalError; abortTask(task); @@ -1925,7 +1920,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1946,47 +1942,40 @@ function finishAbortedTask(task, request, errorId) { function haltTask(task) { 0 === task.status && (task.status = 3); } -function finishHaltedTask(task, request) { - 3 === task.status && request.pendingChunks--; -} -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (cleanupTaintQueue(request), @@ -1997,8 +1986,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -2016,7 +2005,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -2029,7 +2019,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2038,11 +2028,12 @@ function startFlowing(request, destination) { function finishHalt(request, abortedTasks) { try { abortedTasks.forEach(function (task) { - return finishHaltedTask(task, request); + 3 === task.status && request.pendingChunks--; }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2054,7 +2045,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2103,25 +2095,26 @@ function abort(request, reason) { ) : reason, digest = logRecoverableError(request, error, null), - errorId$26 = request.nextChunkId++; - request.fatalError = errorId$26; + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; request.pendingChunks++; - emitErrorChunk(request, errorId$26, digest, error, !1); + emitErrorChunk(request, errorId$27, digest, error, !1); abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$26); + return abortTask(task, request, errorId$27); }); scheduleWork(function () { - return finishAbort(request, abortableTasks, errorId$26); + return finishAbort(request, abortableTasks, errorId$27); }); } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$27) { - logRecoverableError(request, error$27, null), - fatalError(request, error$27); + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); } } function resolveServerReference(bundlerConfig, id) { @@ -2142,7 +2135,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = __turbopack_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -2159,18 +2151,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2566,8 +2558,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$30 = createPendingChunk(response); - chunk$30.then( + var chunk$31 = createPendingChunk(response); + chunk$31.then( function (v) { return controller.enqueue(v); }, @@ -2575,10 +2567,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$30; + previousBlockedChunk = chunk$31; chunk.then(function () { - previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); - resolveModelChunk(chunk$30, json, -1); + previousBlockedChunk === chunk$31 && (previousBlockedChunk = null); + resolveModelChunk(chunk$31, json, -1); }); } }, 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 0bfc012479a34..f15f91387f5ea 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 @@ -74,15 +74,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -239,77 +230,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -326,10 +312,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -340,12 +326,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -354,8 +336,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -699,29 +680,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -734,44 +699,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(19)), + ? (args.splice(env, 4, format.slice(19)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -913,7 +871,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1029,14 +986,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1065,22 +1014,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1200,9 +1133,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1289,9 +1220,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1463,7 +1392,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2126,9 +2055,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2709,16 +2636,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2835,8 +2756,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2853,12 +2772,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3166,7 +3084,7 @@ markOperationEndTime(request$jscomp$1, task, info.time); else if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3225,11 +3143,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, id, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); } } @@ -3249,17 +3167,11 @@ forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; - var json = '{"time":' + (timestamp - request.timeOrigin) + "}"; - null !== request.debugDestination - ? ((timestamp = request.nextChunkId++), - (json = timestamp.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + request.pendingDebugChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function markOperationEndTime(request, task, timestamp) { (request.status === ABORTING && timestamp > request.abortTime) || @@ -3353,7 +3265,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); task.timed && markOperationEndTime(request, task, performance.now()); if ("object" === typeof resolvedModel && null !== resolvedModel) @@ -3425,7 +3337,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3453,131 +3366,87 @@ (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - cleanupTaintQueue(request), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (cleanupTaintQueue(request), + request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3593,13 +3462,14 @@ }, 0); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -3613,7 +3483,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3626,7 +3496,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3638,7 +3509,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3702,7 +3574,8 @@ else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3766,15 +3639,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -4488,55 +4361,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -5020,7 +4877,8 @@ debugNoOutline = null, emptyRoot = {}, decoderOptions = { stream: !0 }, - chunkCache = new Map(); + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -5177,10 +5035,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, turbopackMap, @@ -5203,30 +5057,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 3beec50e5efd4..7d057e5500d59 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 @@ -818,7 +818,8 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? (haltTask(newTask), finishHaltedTask(newTask, request)) + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) : ((task = request.fatalError), abortTask(newTask), finishAbortedTask(newTask, request, task)), @@ -871,8 +872,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -888,9 +889,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -951,8 +950,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -972,9 +971,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1376,9 +1373,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1883,7 +1878,7 @@ function retryTask(request, task) { (task.status = 0), 21 === request.type) ) - haltTask(task), finishHaltedTask(task, request); + haltTask(task), 3 === task.status && request.pendingChunks--; else { var errorId = request.fatalError; abortTask(task); @@ -1928,7 +1923,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1949,47 +1945,40 @@ function finishAbortedTask(task, request, errorId) { function haltTask(task) { 0 === task.status && (task.status = 3); } -function finishHaltedTask(task, request) { - 3 === task.status && request.pendingChunks--; -} -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (cleanupTaintQueue(request), @@ -2000,8 +1989,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -2023,7 +2012,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -2036,7 +2026,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2045,11 +2035,12 @@ function startFlowing(request, destination) { function finishHalt(request, abortedTasks) { try { abortedTasks.forEach(function (task) { - return finishHaltedTask(task, request); + 3 === task.status && request.pendingChunks--; }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2061,7 +2052,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2110,25 +2102,26 @@ function abort(request, reason) { ) : reason, digest = logRecoverableError(request, error, null), - errorId$26 = request.nextChunkId++; - request.fatalError = errorId$26; + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; request.pendingChunks++; - emitErrorChunk(request, errorId$26, digest, error, !1); + emitErrorChunk(request, errorId$27, digest, error, !1); abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$26); + return abortTask(task, request, errorId$27); }); setTimeout(function () { - return finishAbort(request, abortableTasks, errorId$26); + return finishAbort(request, abortableTasks, errorId$27); }, 0); } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$27) { - logRecoverableError(request, error$27, null), - fatalError(request, error$27); + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); } } function resolveServerReference(bundlerConfig, id) { @@ -2149,7 +2142,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -2166,18 +2158,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2573,8 +2565,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$30 = createPendingChunk(response); - chunk$30.then( + var chunk$31 = createPendingChunk(response); + chunk$31.then( function (v) { return controller.enqueue(v); }, @@ -2582,10 +2574,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$30; + previousBlockedChunk = chunk$31; chunk.then(function () { - previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); - resolveModelChunk(chunk$30, json, -1); + previousBlockedChunk === chunk$31 && (previousBlockedChunk = null); + resolveModelChunk(chunk$31, json, -1); }); } }, 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 4ab5c608360f5..9a0780b1f6c1a 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 @@ -41,9 +41,6 @@ : (obj[key] = value); return obj; } - function flushBuffered(destination) { - "function" === typeof destination.flush && destination.flush(); - } function writeToDestination(destination, view) { destination = destination.write(view); destinationHasCapacity = destinationHasCapacity && destination; @@ -110,14 +107,6 @@ (writtenBytes = 0)))); return destinationHasCapacity; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)); - currentView = null; - writtenBytes = 0; - destinationHasCapacity = !0; - } function byteLengthOfChunk(chunk) { return "string" === typeof chunk ? Buffer.byteLength(chunk, "utf8") @@ -286,91 +275,74 @@ promise = pendingOperations.get(asyncId); return void 0 === promise ? null : promise; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } - function parseStackTracePrivate(error, skipFrames) { - collectedStackTrace = null; - framesToSkip = skipFrames; - skipFrames = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) return null; - } finally { - Error.prepareStackTrace = skipFrames; - } - return collectedStackTrace; - } function parseStackTrace(error, skipFrames) { var existing = stackTraceCache.get(error); if (void 0 !== existing) return existing; @@ -385,10 +357,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -399,12 +371,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -413,8 +381,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -745,14 +712,8 @@ for (var i = 0; i < stack.length; i++) { var callsite = stack[i], functionName = callsite[0], - url = devirtualizeURL(callsite[1]), - lineNumber = callsite[2], - columnNumber = callsite[3]; - if ( - !callsite[6] && - request(url, functionName, lineNumber, columnNumber) - ) - return !0; + url = devirtualizeURL(callsite[1]); + if (request(url, functionName, callsite[2], callsite[3])) return !0; } return !1; } @@ -786,7 +747,7 @@ if (("assert" !== methodName || !arguments[0]) && null !== request) { var stack = filterStackTrace( request, - parseStackTracePrivate(Error("react-stack-top-frame"), 1) || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; var owner = resolveOwner(), @@ -974,7 +935,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1087,14 +1047,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1123,22 +1075,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1258,9 +1194,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1347,9 +1281,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1520,7 +1452,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1915,7 +1847,7 @@ (serializeIONode(request, _ioNode, awaited.promise), (cutOff = (0, request.environmentName)()), advanceTaskTime(request, task, startTime), - request.pendingChunks++, + request.pendingDebugChunks++, emitDebugChunk(request, task.id, { awaited: _ioNode, env: cutOff, @@ -1955,7 +1887,7 @@ void 0 !== node && null !== node && (serializeIONode(request, node, node.promise), - request.pendingChunks++, + request.pendingDebugChunks++, (alreadyForwardedDebugInfo = (0, request.environmentName)()), (alreadyForwardedDebugInfo = { awaited: node, @@ -2286,9 +2218,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2851,16 +2781,9 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -3062,8 +2985,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -3080,12 +3001,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3391,7 +3311,7 @@ markOperationEndTime(request$jscomp$0, task, info.time); else if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$0, info), - request$jscomp$0.pendingChunks++, + request$jscomp$0.pendingDebugChunks++, emitDebugChunk(request$jscomp$0, id, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3438,11 +3358,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != debugStack && (ioInfo.stack = debugStack); - request$jscomp$0.pendingChunks++; + request$jscomp$0.pendingDebugChunks++; emitDebugChunk(request$jscomp$0, id, ioInfo); } } else - request$jscomp$0.pendingChunks++, + request$jscomp$0.pendingDebugChunks++, emitDebugChunk(request$jscomp$0, id, info); } } @@ -3492,7 +3412,7 @@ thenable = thenable.awaited; 3 === thenable.tag ? (serializeIONode(request, thenable, null), - request.pendingChunks++, + request.pendingDebugChunks++, (debugInfo = (0, request.environmentName)()), (debugInfo = { awaited: thenable, env: debugInfo }), advanceTaskTime(request, task, task.time), @@ -3502,17 +3422,10 @@ } } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; - var json = '{"time":' + (timestamp - request.timeOrigin) + "}"; - null !== request.debugDestination - ? ((timestamp = request.nextChunkId++), - (json = timestamp.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + request.pendingDebugChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + request.completedDebugChunks.push(id); } function advanceTaskTime(request, task, timestamp) { timestamp > task.time @@ -3618,7 +3531,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); task.timed && markOperationEndTime(request, task, performance.now()); if ("object" === typeof resolvedModel && null !== resolvedModel) @@ -3692,7 +3605,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3720,135 +3634,88 @@ (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - flushBuffered(debugDestination); - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } - flushBuffered(debugDestination); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.end(), (request.debugDestination = null)), - cleanupTaintQueue(request), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.end(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.end(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.end(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (cleanupTaintQueue(request), + request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3860,13 +3727,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3879,19 +3747,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), fatalError(request, error); - } - } - } - function startFlowingDebug(request, debugDestination) { - if (13 === request.status) - (request.status = CLOSED), debugDestination.destroy(request.fatalError); - else if (request.status !== CLOSED && null === request.debugDestination) { - request.debugDestination = debugDestination; - try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3904,7 +3760,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3916,7 +3773,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3980,7 +3838,8 @@ else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3996,55 +3855,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } function closeDebugChannel(request) { @@ -4101,15 +3944,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -4871,25 +4714,6 @@ stream.on("error", onError), stream.on("end", onClose)); } - function createFakeWritableFromWebSocket(webSocket) { - return { - write: function (chunk) { - webSocket.send(chunk); - return !0; - }, - end: function () { - webSocket.close(); - }, - destroy: function (reason) { - "object" === typeof reason && - null !== reason && - (reason = reason.message); - "string" === typeof reason - ? webSocket.close(1011, reason) - : webSocket.close(1011); - } - }; - } function createFakeWritableFromReadableStreamController(controller) { return { write: function (chunk) { @@ -5172,6 +4996,8 @@ var currentOwner = null, getAsyncId = async_hooks.AsyncResource.prototype.asyncId, pendingOperations = new Map(), + awaitedPromise = new WeakMap(), + previousPromise = new WeakMap(), lastRanAwait = null, emptyStack = [], framesToSkip = 0, @@ -5382,46 +5208,48 @@ var trigger = pendingOperations.get(triggerAsyncId); if ("PROMISE" === type) if ( - ((type = async_hooks.executionAsyncId()), + (void 0 !== trigger && + null !== trigger.promise && + ((type = trigger.promise.deref()), + void 0 !== type && awaitedPromise.set(resource, type)), + (type = async_hooks.executionAsyncId()), type !== triggerAsyncId) ) { if (void 0 === trigger) return; - triggerAsyncId = null; + triggerAsyncId = pendingOperations.get(type); + void 0 !== triggerAsyncId && + null !== triggerAsyncId.promise && + ((type = triggerAsyncId.promise.deref()), + void 0 !== type && previousPromise.set(resource, type)); + type = null; if ( null === trigger.stack || (2 !== trigger.tag && 4 !== trigger.tag) ) { - resource = new WeakRef(resource); var request = resolveRequest(); null !== request && - ((triggerAsyncId = parseStackTracePrivate(Error(), 5)), - null === triggerAsyncId || - isAwaitInUserspace(request, triggerAsyncId) || - (triggerAsyncId = null)); - } else - (triggerAsyncId = emptyStack), - (resource = - void 0 !== resource._debugInfo - ? new WeakRef(resource) - : trigger.promise); - type = pendingOperations.get(type); + ((type = parseStackTrace(Error(), 5)), + isAwaitInUserspace(request, type) || (type = null)); + } else type = emptyStack; trigger = { tag: 4, owner: resolveOwner(), - stack: triggerAsyncId, + stack: type, start: performance.now(), end: -1.1, - promise: resource, + promise: new WeakRef(resource), awaited: trigger, - previous: void 0 === type ? null : type + previous: void 0 === triggerAsyncId ? null : triggerAsyncId }; } else - (type = resolveOwner()), + (triggerAsyncId = resolveOwner()), (trigger = { tag: 3, - owner: type, + owner: triggerAsyncId, stack: - null === type ? null : parseStackTracePrivate(Error(), 5), + null === triggerAsyncId + ? null + : parseStackTrace(Error(), 5), start: performance.now(), end: -1.1, promise: new WeakRef(resource), @@ -5439,9 +5267,7 @@ tag: 0, owner: trigger, stack: - null === trigger - ? parseStackTracePrivate(Error(), 3) - : null, + null === trigger ? parseStackTrace(Error(), 3) : null, start: performance.now(), end: -1.1, promise: null, @@ -5455,9 +5281,7 @@ tag: 0, owner: resource, stack: - null === resource - ? parseStackTracePrivate(Error(), 3) - : null, + null === resource ? parseStackTrace(Error(), 3) : null, start: performance.now(), end: -1.1, promise: null, @@ -5576,7 +5400,8 @@ debugNoOutline = null, emptyRoot = {}, decoderOptions = { stream: !0 }, - chunkCache = new Map(); + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -5723,12 +5548,12 @@ "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_237 = []; + var JSCompiler_object_inline_chunks_230 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_237.push(chunk); + JSCompiler_object_inline_chunks_230.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_237, { + var blob = new Blob(JSCompiler_object_inline_chunks_230, { type: mimeType }); response._formData.append(name, blob, filename); @@ -5777,20 +5602,6 @@ }; exports.renderToPipeableStream = function (model, turbopackMap, options) { var debugChannel = options ? options.debugChannel : void 0, - debugChannelReadable = - void 0 === debugChannel || - ("function" !== typeof debugChannel.read && - "number" !== typeof debugChannel.readyState) - ? void 0 - : debugChannel, - debugChannelWritable = - void 0 !== debugChannel - ? "function" === typeof debugChannel.write - ? debugChannel - : "function" === typeof debugChannel.send - ? createFakeWritableFromWebSocket(debugChannel) - : void 0 - : void 0, request = createRequest( model, turbopackMap, @@ -5804,10 +5615,8 @@ ), hasStartedFlowing = !1; startWork(request); - void 0 !== debugChannelWritable && - startFlowingDebug(request, debugChannelWritable); - void 0 !== debugChannelReadable && - startReadingFromDebugChannelReadable(request, debugChannelReadable); + void 0 !== debugChannel && + startReadingFromDebugChannelReadable(request, debugChannel); return { pipe: function (destination) { if (hasStartedFlowing) @@ -5824,14 +5633,10 @@ "The destination stream errored while writing data." ) ); - if (void 0 === debugChannelReadable) - destination.on( - "close", - createCancelHandler( - request, - "The destination stream closed early." - ) - ); + destination.on( + "close", + createCancelHandler(request, "The destination stream closed early.") + ); return destination; }, abort: function (reason) { @@ -5844,10 +5649,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, turbopackMap, @@ -5870,22 +5671,6 @@ signal.addEventListener("abort", listener); } } - if (void 0 !== debugChannelWritable) { - var debugWritable; - new ReadableStream( - { - type: "bytes", - start: function (controller) { - debugWritable = - createFakeWritableFromReadableStreamController(controller); - }, - pull: function () { - startFlowingDebug(request, debugWritable); - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); - } void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 86127d31598dd..220cc6b826464 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 @@ -841,7 +841,8 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? (haltTask(newTask), finishHaltedTask(newTask, request)) + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) : ((task = request.fatalError), abortTask(newTask), finishAbortedTask(newTask, request, task)), @@ -894,8 +895,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -911,9 +912,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -974,8 +973,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -995,9 +994,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1396,9 +1393,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1889,7 +1884,7 @@ function retryTask(request, task) { (task.status = 0), 21 === request.type) ) - haltTask(task), finishHaltedTask(task, request); + haltTask(task), 3 === task.status && request.pendingChunks--; else { var errorId = request.fatalError; abortTask(task); @@ -1934,7 +1929,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1955,71 +1951,65 @@ function finishAbortedTask(task, request, errorId) { function haltTask(task) { 0 === task.status && (task.status = 3); } -function finishHaltedTask(task, request) { - 3 === task.status && request.pendingChunks--; -} -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, importsChunks[i])) - ) { - request.destination = null; - i++; - break; - } - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - if (!writeChunkAndReturn(destination, hintChunks[i])) { - request.destination = null; - i++; - break; - } - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, regularChunks[i])) - ) { - request.destination = null; - i++; - break; - } - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, errorChunks[i])) - ) { - request.destination = null; - i++; - break; - } - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)), - (currentView = null), - (writtenBytes = 0), - (destinationHasCapacity = !0); - } - "function" === typeof destination.flush && destination.flush(); +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; + } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && (cleanupTaintQueue(request), 12 > request.status && @@ -2029,8 +2019,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.end(), (request.destination = null))); + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -2048,7 +2038,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -2061,7 +2052,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2070,11 +2061,12 @@ function startFlowing(request, destination) { function finishHalt(request, abortedTasks) { try { abortedTasks.forEach(function (task) { - return finishHaltedTask(task, request); + 3 === task.status && request.pendingChunks--; }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2086,7 +2078,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2135,25 +2128,26 @@ function abort(request, reason) { ) : reason, digest = logRecoverableError(request, error, null), - errorId$26 = request.nextChunkId++; - request.fatalError = errorId$26; + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; request.pendingChunks++; - emitErrorChunk(request, errorId$26, digest, error, !1); + emitErrorChunk(request, errorId$27, digest, error, !1); abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$26); + return abortTask(task, request, errorId$27); }); setImmediate(function () { - return finishAbort(request, abortableTasks, errorId$26); + return finishAbort(request, abortableTasks, errorId$27); }); } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$27) { - logRecoverableError(request, error$27, null), - fatalError(request, error$27); + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); } } function resolveServerReference(bundlerConfig, id) { @@ -2174,7 +2168,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -2191,18 +2184,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2598,8 +2591,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$30 = createPendingChunk(response); - chunk$30.then( + var chunk$31 = createPendingChunk(response); + chunk$31.then( function (v) { return controller.enqueue(v); }, @@ -2607,10 +2600,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$30; + previousBlockedChunk = chunk$31; chunk.then(function () { - previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); - resolveModelChunk(chunk$30, json, -1); + previousBlockedChunk === chunk$31 && (previousBlockedChunk = null); + resolveModelChunk(chunk$31, json, -1); }); } }, @@ -3031,12 +3024,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, turbopackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_272 = []; + var JSCompiler_object_inline_chunks_263 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_272.push(chunk); + JSCompiler_object_inline_chunks_263.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_272, { + var blob = new Blob(JSCompiler_object_inline_chunks_263, { type: mimeType }); response._formData.append(name, blob, filename); 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 893fdd61b3533..b4dd9c873adbc 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 @@ -48,7 +48,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "0.0.0-experimental-97cdd5d3-20250710", - "react-dom": "0.0.0-experimental-97cdd5d3-20250710" + "react": "0.0.0-experimental-e6ed827a-20250715", + "react-dom": "0.0.0-experimental-e6ed827a-20250715" } } \ 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 85fe025e61f17..2aaeb72fd58a9 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 @@ -73,15 +73,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load_by_url__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load_by_url__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -1786,13 +1786,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -1846,6 +1839,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1873,15 +1868,6 @@ : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -2657,96 +2643,6 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { - if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; - for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk[i]; - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 35 === rowState || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk[i++]; - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf(10, i); - break; - case 4: - (lastIdx = i + rowLength), - lastIdx > chunk.length && (lastIdx = -1); - } - var offset = chunk.byteOffset + i; - if (-1 < lastIdx) - (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - weakResponse, - rowTag, - buffer, - rowLength - ), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; - } - } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } - } function createFromJSONCallback(response) { return function (key, value) { if ("string" === typeof value) @@ -2827,9 +2723,6 @@ return value; }; } - function close(weakResponse) { - reportGlobalError(weakResponse, Error("Connection closed.")); - } function createDebugCallbackFromWritableStream(debugWritable) { var textEncoder = new TextEncoder(), writer = debugWritable.getWriter(); @@ -2864,145 +2757,112 @@ debugChannel )._weakResponse; } - function startReadingFromUniversalStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) close(response$jscomp$0); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - if (value instanceof ArrayBuffer) - processBinaryChunk( - response$jscomp$0, - streamState, - new Uint8Array(value) - ); - else if ("string" === typeof value) { - if ( - ((_ref = streamState), void 0 !== response$jscomp$0.weak.deref()) - ) { - for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, - rowState = _ref._rowState, - rowID = _ref._rowID, - rowTag = _ref._rowTag, - rowLength = _ref._rowLength, - buffer = _ref._buffer, - chunkLength = value.length; - i < chunkLength; + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); + for ( + var i = 0, + rowState = _ref._rowState, + rowID = _ref._rowID, + rowTag = _ref._rowTag, + rowLength = _ref._rowLength, + buffer = _ref._buffer, + chunkLength = value.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = value.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = value.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = value.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = value.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if ( - rowLength < value.length || - value.length > 3 * rowLength - ) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = value.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = value.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (value.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = value[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 1: + rowState = value[i]; + 84 === rowState || + 65 === rowState || + 79 === rowState || + 111 === rowState || + 85 === rowState || + 83 === rowState || + 115 === rowState || + 76 === rowState || + 108 === rowState || + 71 === rowState || + 103 === rowState || + 77 === rowState || + 109 === rowState || + 86 === rowState + ? ((rowTag = rowState), (rowState = 2), i++) + : (64 < rowState && 91 > rowState) || + 35 === rowState || + 114 === rowState || + 120 === rowState + ? ((rowTag = rowState), (rowState = 3), i++) + : ((rowTag = 0), (rowState = 3)); + continue; + case 2: + lastIdx = value[i++]; + 44 === lastIdx + ? (rowState = 4) + : (rowLength = + (rowLength << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 3: + lastIdx = value.indexOf(10, i); + break; + case 4: + (lastIdx = i + rowLength), + lastIdx > value.length && (lastIdx = -1); + } + var offset = value.byteOffset + i; + if (-1 < lastIdx) + (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + value = new Uint8Array( + value.buffer, + offset, + value.byteLength - i + ); + buffer.push(value); + rowLength -= value.byteLength; + break; } - _ref._rowState = rowState; - _ref._rowID = rowID; - _ref._rowTag = rowTag; - _ref._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, value); + _ref._rowState = rowState; + _ref._rowID = rowID; + _ref._rowTag = rowTag; + _ref._rowLength = rowLength; + } return reader.read().then(progress).catch(error); } } - function error(e) { - reportGlobalError(response$jscomp$0, e); - } - var streamState = createStreamState(), - reader = stream.getReader(); - reader.read().then(progress).catch(error); - } - function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) isSecondaryStream || close(response); - else - return ( - processBinaryChunk(response, streamState, value), - reader.read().then(progress).catch(error) - ); - } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var React = require("react"), ReactDOM = require("react-dom"), decoderOptions = { stream: !0 }, bind = Function.prototype.bind, - chunkCache = new Map(), + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(), ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), @@ -3183,10 +3043,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-canary-97cdd5d3-20250710", + version: "19.2.0-canary-e6ed827a-20250715", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-97cdd5d3-20250710", + reconcilerVersion: "19.2.0-canary-e6ed827a-20250715", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -3195,13 +3055,7 @@ var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, r.body, !0)) - : startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -3210,15 +3064,9 @@ return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { - var response = createResponseFromOptions(options); - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, stream, !0)) - : startReadingFromStream(response, stream, !1); - return getRoot(response); + options = createResponseFromOptions(options); + startReadingFromStream(options, stream); + return getRoot(options); }; exports.createServerReference = function ( id, 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 ee51c466f5a4a..9fa495c7c96b0 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 @@ -50,7 +50,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = __turbopack_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -67,18 +66,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load_by_url__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load_by_url__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -1188,6 +1187,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1652,20 +1653,18 @@ function createResponseFromOptions(options) { : void 0 ); } -function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) - isSecondaryStream || - reportGlobalError(response, Error("Connection closed.")); +function startReadingFromStream(response, stream) { + function progress(_ref) { + var value = _ref.value; + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref2 = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1676,8 +1675,8 @@ function startReadingFromStream(response, stream, isSecondaryStream) { lastIdx = value[i++]; 58 === lastIdx ? (rowState = 1) - : (_ref2 = - (_ref2 << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + : (_ref = + (_ref << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: rowState = value[i]; @@ -1720,10 +1719,10 @@ function startReadingFromStream(response, stream, isSecondaryStream) { var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, _ref2, rowTag, buffer, rowLength), + processFullBinaryRow(response, _ref, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, - (rowLength = _ref2 = rowTag = rowState = 0), + (rowLength = _ref = rowTag = rowState = 0), (buffer.length = 0); else { value = new Uint8Array(value.buffer, offset, value.byteLength - i); @@ -1732,31 +1731,24 @@ function startReadingFromStream(response, stream, isSecondaryStream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref2; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -1766,7 +1758,7 @@ exports.createFromFetch = function (promiseForResponse, options) { }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); - startReadingFromStream(options, stream, !1); + startReadingFromStream(options, stream); return getChunk(options, 0); }; exports.createServerReference = function (id, callServer) { 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 6e69fca39efcf..3d9170395ac30 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 @@ -73,15 +73,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2004,13 +2004,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2064,6 +2057,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2973,17 +2968,15 @@ void 0 )._weakResponse; } - function startReadingFromStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) - reportGlobalError(response$jscomp$0, Error("Connection closed.")); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - _ref = streamState; - if (void 0 !== response$jscomp$0.weak.deref()) { + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, + var i = 0, rowState = _ref._rowState, rowID = _ref._rowID, rowTag = _ref._rowTag, @@ -3045,13 +3038,7 @@ var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - rowID, - rowTag, - buffer, - rowLength - ), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -3076,23 +3063,17 @@ } } function error(e) { - reportGlobalError(response$jscomp$0, e); + reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var ReactDOM = require("react-dom"), React = require("react"), decoderOptions = { stream: !0 }, bind$1 = Function.prototype.bind, - chunkCache = new Map(), + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(), ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), 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 d8bcb0224f27c..2a10aac2b8cf9 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 @@ -50,7 +50,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -67,18 +66,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -1372,6 +1371,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1852,12 +1853,12 @@ function startReadingFromStream(response, stream) { if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1924,24 +1925,17 @@ function startReadingFromStream(response, stream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { 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 f76eb10507066..51f0a261dae86 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 @@ -73,15 +73,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2004,13 +2004,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2064,6 +2057,8 @@ this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2091,15 +2086,6 @@ : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -2880,16 +2866,16 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { + function processBinaryChunk(weakResponse, chunk) { if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; + weakResponse = unwrapWeakResponse(weakResponse); for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -2900,8 +2886,8 @@ lastIdx = chunk[i++]; 58 === lastIdx ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | + : (rowID = + (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: @@ -2947,15 +2933,15 @@ if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), processFullBinaryRow( - response, weakResponse, + rowID, rowTag, buffer, rowLength ), (i = lastIdx), 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), + (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); @@ -2964,10 +2950,10 @@ break; } } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } } function createFromJSONCallback(response) { @@ -3081,15 +3067,14 @@ if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -3102,7 +3087,8 @@ React = require("react"), decoderOptions = { stream: !0 }, bind$1 = Function.prototype.bind, - chunkCache = new Map(), + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(), ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), @@ -3291,122 +3277,29 @@ serverConsumerManifest, options ) { - var response$jscomp$0 = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0, - options && options.findSourceMapURL - ? options.findSourceMapURL - : void 0, - options ? !0 === options.replayConsoleLogs : !1, - options && options.environmentName ? options.environmentName : void 0, - void 0 - )._weakResponse, - streamState = createStreamState(); + var response = new ResponseInstance( + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0, + options && options.findSourceMapURL ? options.findSourceMapURL : void 0, + options ? !0 === options.replayConsoleLogs : !1, + options && options.environmentName ? options.environmentName : void 0, + void 0 + )._weakResponse; stream.on("data", function (chunk) { - if ("string" === typeof chunk) { - if (void 0 !== response$jscomp$0.weak.deref()) { - for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if (rowLength < chunk.length || chunk.length > 3 * rowLength) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = chunk.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (chunk.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } - } else processBinaryChunk(response$jscomp$0, streamState, chunk); + processBinaryChunk(response, chunk); }); stream.on("error", function (error) { - reportGlobalError(response$jscomp$0, error); + reportGlobalError(response, error); }); stream.on("end", function () { - return close(response$jscomp$0); + return close(response); }); - return getRoot(response$jscomp$0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); 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 e52efd47e9191..d1dc52b867e52 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 @@ -51,7 +51,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -68,18 +67,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -1373,14 +1372,13 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; this._fromJSON = createFromJSONCallback(this); } -function createStreamState() { - return { _rowState: 0, _rowID: 0, _rowTag: 0, _rowLength: 0, _buffer: [] }; -} function resolveBuffer(response, id, buffer) { response = response._chunks; var chunk = response.get(id); @@ -1700,47 +1698,46 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - row += stringDecoder.decode(chunk); - processFullStringRow(response, id, tag, row); -} -function processFullStringRow(response, id, tag, row) { + buffer = row += stringDecoder.decode(chunk); switch (tag) { case 73: - resolveModule(response, id, row); + resolveModule(response, id, buffer); break; case 72: - id = row[0]; - row = row.slice(1); - response = JSON.parse(row, response._fromJSON); - row = ReactDOMSharedInternals.d; + id = buffer[0]; + buffer = buffer.slice(1); + response = JSON.parse(buffer, response._fromJSON); + buffer = ReactDOMSharedInternals.d; switch (id) { case "D": - row.D(response); + buffer.D(response); break; case "C": "string" === typeof response - ? row.C(response) - : row.C(response[0], response[1]); + ? buffer.C(response) + : buffer.C(response[0], response[1]); break; case "L": id = response[0]; tag = response[1]; - 3 === response.length ? row.L(id, tag, response[2]) : row.L(id, tag); + 3 === response.length + ? buffer.L(id, tag, response[2]) + : buffer.L(id, tag); break; case "m": "string" === typeof response - ? row.m(response) - : row.m(response[0], response[1]); + ? buffer.m(response) + : buffer.m(response[0], response[1]); break; case "X": "string" === typeof response - ? row.X(response) - : row.X(response[0], response[1]); + ? buffer.X(response) + : buffer.X(response[0], response[1]); break; case "S": "string" === typeof response - ? row.S(response) - : row.S( + ? buffer.S(response) + : buffer.S( response[0], 0 === response[1] ? void 0 : response[1], 3 === response.length ? response[2] : void 0 @@ -1748,25 +1745,24 @@ function processFullStringRow(response, id, tag, row) { break; case "M": "string" === typeof response - ? row.M(response) - : row.M(response[0], response[1]); + ? buffer.M(response) + : buffer.M(response[0], response[1]); } break; case 69: - tag = JSON.parse(row); - row = resolveErrorProd(); - row.digest = tag.digest; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; - var chunk = tag.get(id); - chunk - ? triggerErrorOnChunk(response, chunk, row) - : tag.set(id, new ReactPromise("rejected", null, row)); + (chunk = tag.get(id)) + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("rejected", null, buffer)); break; case 84: response = response._chunks; (tag = response.get(id)) && "pending" !== tag.status - ? tag.reason.enqueueValue(row) - : response.set(id, new ReactPromise("fulfilled", row, null)); + ? tag.reason.enqueueValue(buffer) + : response.set(id, new ReactPromise("fulfilled", buffer, null)); break; case 78: case 68: @@ -1790,23 +1786,23 @@ function processFullStringRow(response, id, tag, row) { case 67: (response = response._chunks.get(id)) && "fulfilled" === response.status && - response.reason.close("" === row ? '"$undefined"' : row); + response.reason.close("" === buffer ? '"$undefined"' : buffer); break; default: (tag = response._chunks), (chunk = tag.get(id)) - ? resolveModelChunk(response, chunk, row) - : tag.set(id, new ReactPromise("resolved_model", row, response)); + ? resolveModelChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("resolved_model", buffer, response)); } } -function processBinaryChunk(weakResponse, streamState, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1866,16 +1862,16 @@ function processBinaryChunk(weakResponse, streamState, chunk) { (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { - weakResponse = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(weakResponse); - rowLength -= weakResponse.byteLength; + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; break; } } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1939,15 +1935,14 @@ function startReadingFromStream(response, stream) { if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -1973,103 +1968,16 @@ exports.createFromNodeStream = function ( options ) { var response = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0 - ), - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0 + ); stream.on("data", function (chunk) { - if ("string" === typeof chunk) { - for ( - var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if (rowLength < chunk.length || chunk.length > 3 * rowLength) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = chunk.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (chunk.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } else processBinaryChunk(response, streamState, chunk); + processBinaryChunk(response, chunk); }); stream.on("error", function (error) { reportGlobalError(response, error); 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 5576dc5108c79..d79cc1b1c0a7a 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 @@ -70,15 +70,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -235,77 +226,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -322,10 +308,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -336,12 +322,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -350,8 +332,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -689,29 +670,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -724,44 +689,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("%c%s%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(7)), + ? (args.splice(env, 4, format.slice(7)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -885,7 +843,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -983,14 +940,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1019,22 +968,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1394,7 +1327,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2499,16 +2432,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2612,8 +2539,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2630,12 +2555,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -2938,7 +2862,7 @@ if ("number" !== typeof info.time) if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -2997,11 +2921,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, task, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); } } @@ -3086,7 +3010,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( @@ -3151,7 +3075,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3175,130 +3100,86 @@ request.completedErrorChunks.push(task); } } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3310,13 +3191,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3330,7 +3212,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3343,7 +3225,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3381,7 +3264,8 @@ } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3445,15 +3329,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -4167,55 +4051,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -4691,7 +4559,8 @@ debugNoOutline = null, emptyRoot = {}, decoderOptions = { stream: !0 }, - chunkCache = new Map(); + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -4810,10 +4679,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, turbopackMap, @@ -4836,30 +4701,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 3eac8971f465b..cbdcaa232706a 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 @@ -842,8 +842,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -919,8 +919,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -1818,7 +1818,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1836,44 +1837,40 @@ function finishAbortedTask(task, request, errorId) { (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (12 > request.status && @@ -1883,8 +1880,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -1902,7 +1899,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -1915,7 +1913,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1928,7 +1926,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1962,11 +1961,12 @@ function abort(request, reason) { } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$23) { - logRecoverableError(request, error$23, null), - fatalError(request, error$23); + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); } } function resolveServerReference(bundlerConfig, id) { @@ -1987,7 +1987,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = __turbopack_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -2004,18 +2003,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = __turbopack_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = __turbopack_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2411,8 +2410,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$26 = createPendingChunk(response); - chunk$26.then( + var chunk$27 = createPendingChunk(response); + chunk$27.then( function (v) { return controller.enqueue(v); }, @@ -2420,10 +2419,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$26; + previousBlockedChunk = chunk$27; chunk.then(function () { - previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); - resolveModelChunk(chunk$26, json, -1); + previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); + resolveModelChunk(chunk$27, json, -1); }); } }, 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 d9da829cdf6b8..fb85a5926da78 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 @@ -74,15 +74,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -239,77 +230,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -326,10 +312,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -340,12 +326,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -354,8 +336,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -696,29 +677,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -731,44 +696,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(19)), + ? (args.splice(env, 4, format.slice(19)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -892,7 +850,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -995,14 +952,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1031,22 +980,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1406,7 +1339,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2570,16 +2503,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2683,8 +2610,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2701,12 +2626,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3009,7 +2933,7 @@ if ("number" !== typeof info.time) if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3068,11 +2992,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, task, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); } } @@ -3157,7 +3081,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( @@ -3222,7 +3146,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3246,130 +3171,86 @@ request.completedErrorChunks.push(task); } } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3385,13 +3266,14 @@ }, 0); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -3405,7 +3287,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3418,7 +3300,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3456,7 +3339,8 @@ } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3520,15 +3404,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -4242,55 +4126,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -4766,7 +4634,8 @@ debugNoOutline = null, emptyRoot = {}, decoderOptions = { stream: !0 }, - chunkCache = new Map(); + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -4923,10 +4792,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, turbopackMap, @@ -4949,30 +4814,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 3217f5d0cc8fd..6fb1a1325d053 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 @@ -841,8 +841,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -918,8 +918,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -1819,7 +1819,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1837,44 +1838,40 @@ function finishAbortedTask(task, request, errorId) { (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (12 > request.status && @@ -1884,8 +1881,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -1907,7 +1904,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -1920,7 +1918,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1933,7 +1931,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1967,11 +1966,12 @@ function abort(request, reason) { } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$23) { - logRecoverableError(request, error$23, null), - fatalError(request, error$23); + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); } } function resolveServerReference(bundlerConfig, id) { @@ -1992,7 +1992,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -2009,18 +2008,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2416,8 +2415,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$26 = createPendingChunk(response); - chunk$26.then( + var chunk$27 = createPendingChunk(response); + chunk$27.then( function (v) { return controller.enqueue(v); }, @@ -2425,10 +2424,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$26; + previousBlockedChunk = chunk$27; chunk.then(function () { - previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); - resolveModelChunk(chunk$26, json, -1); + previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); + resolveModelChunk(chunk$27, json, -1); }); } }, 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 85110c7afc6cb..ddeb18049db0c 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 @@ -41,9 +41,6 @@ : (obj[key] = value); return obj; } - function flushBuffered(destination) { - "function" === typeof destination.flush && destination.flush(); - } function writeToDestination(destination, view) { destination = destination.write(view); destinationHasCapacity = destinationHasCapacity && destination; @@ -110,14 +107,6 @@ (writtenBytes = 0)))); return destinationHasCapacity; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)); - currentView = null; - writtenBytes = 0; - destinationHasCapacity = !0; - } function byteLengthOfChunk(chunk) { return "string" === typeof chunk ? Buffer.byteLength(chunk, "utf8") @@ -273,77 +262,72 @@ var owner = componentStorage.getStore(); return owner ? owner : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -360,10 +344,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -374,12 +358,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -388,8 +368,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -722,29 +701,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -757,41 +720,36 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(19)), + ? (args.splice(env, 4, format.slice(19)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - request.completedDebugChunks.push(":W" + previousPrepare + "\n"); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + request.completedDebugChunks.push(":W" + args + "\n"); } return originalMethod.apply(this, arguments); }; @@ -915,7 +873,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1015,14 +972,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1051,22 +1000,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1425,7 +1358,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2553,16 +2486,9 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2662,8 +2588,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2680,12 +2604,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -2987,7 +2910,7 @@ if ("number" !== typeof info.time) if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3045,11 +2968,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, task, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); } } @@ -3139,7 +3062,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( @@ -3205,7 +3128,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3229,134 +3153,87 @@ request.completedErrorChunks.push(task); } } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - flushBuffered(debugDestination); - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } - flushBuffered(debugDestination); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.end(), (request.debugDestination = null)), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.end(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.end(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.end(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3368,13 +3245,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3387,19 +3265,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), fatalError(request, error); - } - } - } - function startFlowingDebug(request, debugDestination) { - if (13 === request.status) - (request.status = CLOSED), debugDestination.destroy(request.fatalError); - else if (request.status !== CLOSED && null === request.debugDestination) { - request.debugDestination = debugDestination; - try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3412,7 +3278,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3450,7 +3317,8 @@ } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3466,55 +3334,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } function closeDebugChannel(request) { @@ -3571,15 +3423,15 @@ i < chunks.length; i++ ) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) + ? promises.push(null) + : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -4341,25 +4193,6 @@ stream.on("error", onError), stream.on("end", onClose)); } - function createFakeWritableFromWebSocket(webSocket) { - return { - write: function (chunk) { - webSocket.send(chunk); - return !0; - }, - end: function () { - webSocket.close(); - }, - destroy: function (reason) { - "object" === typeof reason && - null !== reason && - (reason = reason.message); - "string" === typeof reason - ? webSocket.close(1011, reason) - : webSocket.close(1011); - } - }; - } function createFakeWritableFromReadableStreamController(controller) { return { write: function (chunk) { @@ -4869,7 +4702,8 @@ debugNoOutline = null, emptyRoot = {}, decoderOptions = { stream: !0 }, - chunkCache = new Map(); + instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); Chunk.prototype = Object.create(Promise.prototype); Chunk.prototype.then = function (resolve, reject) { switch (this.status) { @@ -5016,12 +4850,12 @@ "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_226 = []; + var JSCompiler_object_inline_chunks_214 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_226.push(chunk); + JSCompiler_object_inline_chunks_214.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_226, { + var blob = new Blob(JSCompiler_object_inline_chunks_214, { type: mimeType }); response._formData.append(name, blob, filename); @@ -5070,20 +4904,6 @@ }; exports.renderToPipeableStream = function (model, turbopackMap, options) { var debugChannel = options ? options.debugChannel : void 0, - debugChannelReadable = - void 0 === debugChannel || - ("function" !== typeof debugChannel.read && - "number" !== typeof debugChannel.readyState) - ? void 0 - : debugChannel, - debugChannelWritable = - void 0 !== debugChannel - ? "function" === typeof debugChannel.write - ? debugChannel - : "function" === typeof debugChannel.send - ? createFakeWritableFromWebSocket(debugChannel) - : void 0 - : void 0, request = createRequest( model, turbopackMap, @@ -5097,10 +4917,8 @@ ), hasStartedFlowing = !1; startWork(request); - void 0 !== debugChannelWritable && - startFlowingDebug(request, debugChannelWritable); - void 0 !== debugChannelReadable && - startReadingFromDebugChannelReadable(request, debugChannelReadable); + void 0 !== debugChannel && + startReadingFromDebugChannelReadable(request, debugChannel); return { pipe: function (destination) { if (hasStartedFlowing) @@ -5117,14 +4935,10 @@ "The destination stream errored while writing data." ) ); - if (void 0 === debugChannelReadable) - destination.on( - "close", - createCancelHandler( - request, - "The destination stream closed early." - ) - ); + destination.on( + "close", + createCancelHandler(request, "The destination stream closed early.") + ); return destination; }, abort: function (reason) { @@ -5137,10 +4951,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, turbopackMap, @@ -5163,22 +4973,6 @@ signal.addEventListener("abort", listener); } } - if (void 0 !== debugChannelWritable) { - var debugWritable; - new ReadableStream( - { - type: "bytes", - start: function (controller) { - debugWritable = - createFakeWritableFromReadableStreamController(controller); - }, - pull: function () { - startFlowingDebug(request, debugWritable); - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); - } void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 33763731749e1..256e148aacc60 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 @@ -864,8 +864,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -941,8 +941,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -1829,7 +1829,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1847,68 +1848,65 @@ function finishAbortedTask(task, request, errorId) { (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, importsChunks[i])) - ) { - request.destination = null; - i++; - break; - } - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - if (!writeChunkAndReturn(destination, hintChunks[i])) { - request.destination = null; - i++; - break; - } - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, regularChunks[i])) - ) { - request.destination = null; - i++; - break; - } - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, errorChunks[i])) - ) { - request.destination = null; - i++; - break; - } - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)), - (currentView = null), - (writtenBytes = 0), - (destinationHasCapacity = !0); - } - "function" === typeof destination.flush && destination.flush(); +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; + } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && (12 > request.status && request.cacheController.abort( @@ -1917,8 +1915,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.end(), (request.destination = null))); + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -1936,7 +1934,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -1949,7 +1948,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1962,7 +1961,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1996,11 +1996,12 @@ function abort(request, reason) { } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$23) { - logRecoverableError(request, error$23, null), - fatalError(request, error$23); + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); } } function resolveServerReference(bundlerConfig, id) { @@ -2021,7 +2022,6 @@ function resolveServerReference(bundlerConfig, id) { } return [resolvedModuleData.id, resolvedModuleData.chunks, name]; } -var chunkCache = new Map(); function requireAsyncModule(id) { var promise = globalThis.__next_require__(id); if ("function" !== typeof promise.then || "fulfilled" === promise.status) @@ -2038,18 +2038,18 @@ function requireAsyncModule(id) { ); return promise; } +var instrumentedChunks = new WeakSet(), + loadedChunks = new WeakSet(); function ignoreReject() {} function preloadModule(metadata) { for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) { - var chunkFilename = chunks[i], - entry = chunkCache.get(chunkFilename); - if (void 0 === entry) { - entry = globalThis.__next_chunk_load__(chunkFilename); - promises.push(entry); - var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null); - entry.then(resolve, ignoreReject); - chunkCache.set(chunkFilename, entry); - } else null !== entry && promises.push(entry); + var thenable = globalThis.__next_chunk_load__(chunks[i]); + loadedChunks.has(thenable) ? promises.push(null) : promises.push(thenable); + if (!instrumentedChunks.has(thenable)) { + var resolve = loadedChunks.add.bind(loadedChunks, thenable); + thenable.then(resolve, ignoreReject); + instrumentedChunks.add(thenable); + } } return 4 === metadata.length ? 0 === promises.length @@ -2445,8 +2445,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$26 = createPendingChunk(response); - chunk$26.then( + var chunk$27 = createPendingChunk(response); + chunk$27.then( function (v) { return controller.enqueue(v); }, @@ -2454,10 +2454,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$26; + previousBlockedChunk = chunk$27; chunk.then(function () { - previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); - resolveModelChunk(chunk$26, json, -1); + previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); + resolveModelChunk(chunk$27, json, -1); }); } }, @@ -2878,12 +2878,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, turbopackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_262 = []; + var JSCompiler_object_inline_chunks_253 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_262.push(chunk); + JSCompiler_object_inline_chunks_253.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_262, { + var blob = new Blob(JSCompiler_object_inline_chunks_253, { type: mimeType }); response._formData.append(name, blob, filename); 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 cda8dea5a7a95..769bac5da14d5 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/package.json +++ b/packages/next/src/compiled/react-server-dom-turbopack/package.json @@ -48,7 +48,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "19.2.0-canary-97cdd5d3-20250710", - "react-dom": "19.2.0-canary-97cdd5d3-20250710" + "react": "19.2.0-canary-e6ed827a-20250715", + "react-dom": "19.2.0-canary-e6ed827a-20250715" } } \ 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 0e4ea8a19f038..ba752ebc50276 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 @@ -2259,13 +2259,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2319,6 +2312,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2349,15 +2344,6 @@ replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -3728,96 +3714,6 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { - if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; - for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk[i]; - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 35 === rowState || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk[i++]; - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf(10, i); - break; - case 4: - (lastIdx = i + rowLength), - lastIdx > chunk.length && (lastIdx = -1); - } - var offset = chunk.byteOffset + i; - if (-1 < lastIdx) - (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - weakResponse, - rowTag, - buffer, - rowLength - ), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; - } - } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } - } function createFromJSONCallback(response) { return function (key, value) { if ("string" === typeof value) @@ -3898,9 +3794,6 @@ return value; }; } - function close(weakResponse) { - reportGlobalError(weakResponse, Error("Connection closed.")); - } function createDebugCallbackFromWritableStream(debugWritable) { var textEncoder = new TextEncoder(), writer = debugWritable.getWriter(); @@ -3935,138 +3828,104 @@ debugChannel )._weakResponse; } - function startReadingFromUniversalStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) close(response$jscomp$0); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - if (value instanceof ArrayBuffer) - processBinaryChunk( - response$jscomp$0, - streamState, - new Uint8Array(value) - ); - else if ("string" === typeof value) { - if ( - ((_ref = streamState), void 0 !== response$jscomp$0.weak.deref()) - ) { - for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, - rowState = _ref._rowState, - rowID = _ref._rowID, - rowTag = _ref._rowTag, - rowLength = _ref._rowLength, - buffer = _ref._buffer, - chunkLength = value.length; - i < chunkLength; + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); + for ( + var i = 0, + rowState = _ref._rowState, + rowID = _ref._rowID, + rowTag = _ref._rowTag, + rowLength = _ref._rowLength, + buffer = _ref._buffer, + chunkLength = value.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = value.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = value.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = value.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = value.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if ( - rowLength < value.length || - value.length > 3 * rowLength - ) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = value.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = value.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (value.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = value[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 1: + rowState = value[i]; + 84 === rowState || + 65 === rowState || + 79 === rowState || + 111 === rowState || + 85 === rowState || + 83 === rowState || + 115 === rowState || + 76 === rowState || + 108 === rowState || + 71 === rowState || + 103 === rowState || + 77 === rowState || + 109 === rowState || + 86 === rowState + ? ((rowTag = rowState), (rowState = 2), i++) + : (64 < rowState && 91 > rowState) || + 35 === rowState || + 114 === rowState || + 120 === rowState + ? ((rowTag = rowState), (rowState = 3), i++) + : ((rowTag = 0), (rowState = 3)); + continue; + case 2: + lastIdx = value[i++]; + 44 === lastIdx + ? (rowState = 4) + : (rowLength = + (rowLength << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 3: + lastIdx = value.indexOf(10, i); + break; + case 4: + (lastIdx = i + rowLength), + lastIdx > value.length && (lastIdx = -1); + } + var offset = value.byteOffset + i; + if (-1 < lastIdx) + (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + value = new Uint8Array( + value.buffer, + offset, + value.byteLength - i + ); + buffer.push(value); + rowLength -= value.byteLength; + break; } - _ref._rowState = rowState; - _ref._rowID = rowID; - _ref._rowTag = rowTag; - _ref._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, value); + _ref._rowState = rowState; + _ref._rowID = rowID; + _ref._rowTag = rowTag; + _ref._rowLength = rowLength; + } return reader.read().then(progress).catch(error); } } - function error(e) { - reportGlobalError(response$jscomp$0, e); - } - var streamState = createStreamState(), - reader = stream.getReader(); - reader.read().then(progress).catch(error); - } - function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) isSecondaryStream || close(response); - else - return ( - processBinaryChunk(response, streamState, value), - reader.read().then(progress).catch(error) - ); - } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var React = require("react"), @@ -4289,10 +4148,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-experimental-97cdd5d3-20250710", + version: "19.2.0-experimental-e6ed827a-20250715", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-97cdd5d3-20250710", + reconcilerVersion: "19.2.0-experimental-e6ed827a-20250715", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -4301,13 +4160,7 @@ var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, r.body, !0)) - : startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -4316,15 +4169,9 @@ return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { - var response = createResponseFromOptions(options); - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, stream, !0)) - : startReadingFromStream(response, stream, !1); - return getRoot(response); + options = createResponseFromOptions(options); + startReadingFromStream(options, stream); + return getRoot(options); }; exports.createServerReference = function ( id, 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 0ff0c37df1f30..794a22ebbeb96 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 @@ -1204,6 +1204,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1679,20 +1681,18 @@ function createResponseFromOptions(options) { : void 0 ); } -function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) - isSecondaryStream || - reportGlobalError(response, Error("Connection closed.")); +function startReadingFromStream(response, stream) { + function progress(_ref) { + var value = _ref.value; + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref2 = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1703,8 +1703,8 @@ function startReadingFromStream(response, stream, isSecondaryStream) { lastIdx = value[i++]; 58 === lastIdx ? (rowState = 1) - : (_ref2 = - (_ref2 << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + : (_ref = + (_ref << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: rowState = value[i]; @@ -1747,10 +1747,10 @@ function startReadingFromStream(response, stream, isSecondaryStream) { var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, _ref2, rowTag, buffer, rowLength), + processFullBinaryRow(response, _ref, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, - (rowLength = _ref2 = rowTag = rowState = 0), + (rowLength = _ref = rowTag = rowState = 0), (buffer.length = 0); else { value = new Uint8Array(value.buffer, offset, value.byteLength - i); @@ -1759,31 +1759,24 @@ function startReadingFromStream(response, stream, isSecondaryStream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref2; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -1793,7 +1786,7 @@ exports.createFromFetch = function (promiseForResponse, options) { }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); - startReadingFromStream(options, stream, !1); + startReadingFromStream(options, stream); return getChunk(options, 0); }; exports.createServerReference = function (id, callServer) { 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 073de3d538261..230e22106dafd 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 @@ -2473,13 +2473,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2533,6 +2526,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -4040,17 +4035,15 @@ void 0 )._weakResponse; } - function startReadingFromStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) - reportGlobalError(response$jscomp$0, Error("Connection closed.")); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - _ref = streamState; - if (void 0 !== response$jscomp$0.weak.deref()) { + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, + var i = 0, rowState = _ref._rowState, rowID = _ref._rowID, rowTag = _ref._rowTag, @@ -4112,13 +4105,7 @@ var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - rowID, - rowTag, - buffer, - rowLength - ), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -4143,16 +4130,9 @@ } } function error(e) { - reportGlobalError(response$jscomp$0, e); + reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var ReactDOM = require("react-dom"), 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 e77e20b8d990a..c41d69a662451 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 @@ -1379,6 +1379,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1870,12 +1872,12 @@ function startReadingFromStream(response, stream) { if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1942,24 +1944,17 @@ function startReadingFromStream(response, stream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { 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 c502d4235ff64..065c0c75cdf58 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 @@ -2473,13 +2473,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2533,6 +2526,8 @@ this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2563,15 +2558,6 @@ replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -3947,16 +3933,16 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { + function processBinaryChunk(weakResponse, chunk) { if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; + weakResponse = unwrapWeakResponse(weakResponse); for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -3967,8 +3953,8 @@ lastIdx = chunk[i++]; 58 === lastIdx ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | + : (rowID = + (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: @@ -4014,15 +4000,15 @@ if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), processFullBinaryRow( - response, weakResponse, + rowID, rowTag, buffer, rowLength ), (i = lastIdx), 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), + (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); @@ -4031,10 +4017,10 @@ break; } } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } } function createFromJSONCallback(response) { @@ -4148,15 +4134,14 @@ if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -4386,32 +4371,29 @@ options ) { var response$jscomp$0 = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0, - options && options.findSourceMapURL - ? options.findSourceMapURL - : void 0, - options ? !0 === options.replayConsoleLogs : !1, - options && options.environmentName ? options.environmentName : void 0, - void 0 - )._weakResponse, - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0, + options && options.findSourceMapURL ? options.findSourceMapURL : void 0, + options ? !0 === options.replayConsoleLogs : !1, + options && options.environmentName ? options.environmentName : void 0, + void 0 + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { if (void 0 !== response$jscomp$0.weak.deref()) { for ( var response = unwrapWeakResponse(response$jscomp$0), i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -4487,12 +4469,12 @@ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { reportGlobalError(response$jscomp$0, error); 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 53672a3f2fb1e..bcd33d814cc02 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 @@ -1380,14 +1380,13 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; this._fromJSON = createFromJSONCallback(this); } -function createStreamState() { - return { _rowState: 0, _rowID: 0, _rowTag: 0, _rowLength: 0, _buffer: [] }; -} function resolveBuffer(response, id, buffer) { response = response._chunks; var chunk = response.get(id); @@ -1817,14 +1816,14 @@ function processFullStringRow(response, id, tag, row) { : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(weakResponse, streamState, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1884,16 +1883,16 @@ function processBinaryChunk(weakResponse, streamState, chunk) { (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { - weakResponse = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(weakResponse); - rowLength -= weakResponse.byteLength; + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; break; } } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1957,15 +1956,14 @@ function startReadingFromStream(response, stream) { if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -1991,24 +1989,23 @@ exports.createFromNodeStream = function ( options ) { var response = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0 - ), - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0 + ); stream.on("data", function (chunk) { if ("string" === typeof chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -2083,11 +2080,11 @@ exports.createFromNodeStream = function ( "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } else processBinaryChunk(response, streamState, chunk); + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; + } else processBinaryChunk(response, chunk); }); stream.on("error", function (error) { reportGlobalError(response, error); 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 c0fa3b82fe796..e2bdfb5078b59 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 @@ -2435,13 +2435,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2495,6 +2488,8 @@ this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2525,15 +2520,6 @@ replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -3909,16 +3895,16 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { + function processBinaryChunk(weakResponse, chunk) { if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; + weakResponse = unwrapWeakResponse(weakResponse); for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -3929,8 +3915,8 @@ lastIdx = chunk[i++]; 58 === lastIdx ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | + : (rowID = + (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: @@ -3976,15 +3962,15 @@ if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), processFullBinaryRow( - response, weakResponse, + rowID, rowTag, buffer, rowLength ), (i = lastIdx), 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), + (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); @@ -3993,10 +3979,10 @@ break; } } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } } function createFromJSONCallback(response) { @@ -4110,15 +4096,14 @@ if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -4348,32 +4333,29 @@ options ) { var response$jscomp$0 = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0, - options && options.findSourceMapURL - ? options.findSourceMapURL - : void 0, - options ? !0 === options.replayConsoleLogs : !1, - options && options.environmentName ? options.environmentName : void 0, - void 0 - )._weakResponse, - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0, + options && options.findSourceMapURL ? options.findSourceMapURL : void 0, + options ? !0 === options.replayConsoleLogs : !1, + options && options.environmentName ? options.environmentName : void 0, + void 0 + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { if (void 0 !== response$jscomp$0.weak.deref()) { for ( var response = unwrapWeakResponse(response$jscomp$0), i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -4449,12 +4431,12 @@ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { reportGlobalError(response$jscomp$0, error); 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 f69d75416d50e..1549691d8567a 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 @@ -1345,14 +1345,13 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; this._fromJSON = createFromJSONCallback(this); } -function createStreamState() { - return { _rowState: 0, _rowID: 0, _rowTag: 0, _rowLength: 0, _buffer: [] }; -} function resolveBuffer(response, id, buffer) { response = response._chunks; var chunk = response.get(id); @@ -1782,14 +1781,14 @@ function processFullStringRow(response, id, tag, row) { : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(weakResponse, streamState, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1849,16 +1848,16 @@ function processBinaryChunk(weakResponse, streamState, chunk) { (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { - weakResponse = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(weakResponse); - rowLength -= weakResponse.byteLength; + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; break; } } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1922,15 +1921,14 @@ function startReadingFromStream(response, stream) { if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -1956,24 +1954,23 @@ exports.createFromNodeStream = function ( options ) { var response = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0 - ), - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0 + ); stream.on("data", function (chunk) { if ("string" === typeof chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -2048,11 +2045,11 @@ exports.createFromNodeStream = function ( "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } else processBinaryChunk(response, streamState, chunk); + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; + } else processBinaryChunk(response, chunk); }); stream.on("error", function (error) { reportGlobalError(response, error); 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 30a9d398c264c..99173eccd75d9 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 @@ -70,15 +70,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -235,77 +226,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -322,10 +308,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -336,12 +322,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -350,8 +332,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -692,29 +673,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -727,44 +692,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("%c%s%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(7)), + ? (args.splice(env, 4, format.slice(7)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -906,7 +864,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1017,14 +974,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1053,22 +1002,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1188,9 +1121,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1277,9 +1208,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1451,7 +1380,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2066,9 +1995,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2627,16 +2554,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2753,8 +2674,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2771,12 +2690,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3084,7 +3002,7 @@ markOperationEndTime(request$jscomp$1, task, info.time); else if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3143,11 +3061,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, id, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); } } @@ -3167,17 +3085,11 @@ forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; - var json = '{"time":' + (timestamp - request.timeOrigin) + "}"; - null !== request.debugDestination - ? ((timestamp = request.nextChunkId++), - (json = timestamp.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + request.pendingDebugChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function markOperationEndTime(request, task, timestamp) { (request.status === ABORTING && timestamp > request.abortTime) || @@ -3271,7 +3183,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); task.timed && markOperationEndTime(request, task, performance.now()); if ("object" === typeof resolvedModel && null !== resolvedModel) @@ -3343,7 +3255,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3371,131 +3284,87 @@ (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - cleanupTaintQueue(request), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (cleanupTaintQueue(request), + request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3507,13 +3376,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3527,7 +3397,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3540,7 +3410,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3552,7 +3423,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3616,7 +3488,8 @@ else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -4409,55 +4282,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -5068,10 +4925,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -5094,30 +4947,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 c1f01972e519c..80baa43e289c8 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 @@ -819,7 +819,8 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? (haltTask(newTask), finishHaltedTask(newTask, request)) + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) : ((task = request.fatalError), abortTask(newTask), finishAbortedTask(newTask, request, task)), @@ -872,8 +873,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -889,9 +890,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -952,8 +951,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -973,9 +972,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1377,9 +1374,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1880,7 +1875,7 @@ function retryTask(request, task) { (task.status = 0), 21 === request.type) ) - haltTask(task), finishHaltedTask(task, request); + haltTask(task), 3 === task.status && request.pendingChunks--; else { var errorId = request.fatalError; abortTask(task); @@ -1925,7 +1920,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1946,47 +1942,40 @@ function finishAbortedTask(task, request, errorId) { function haltTask(task) { 0 === task.status && (task.status = 3); } -function finishHaltedTask(task, request) { - 3 === task.status && request.pendingChunks--; -} -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (cleanupTaintQueue(request), @@ -1997,8 +1986,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -2016,7 +2005,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -2029,7 +2019,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2038,11 +2028,12 @@ function startFlowing(request, destination) { function finishHalt(request, abortedTasks) { try { abortedTasks.forEach(function (task) { - return finishHaltedTask(task, request); + 3 === task.status && request.pendingChunks--; }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2054,7 +2045,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2103,25 +2095,26 @@ function abort(request, reason) { ) : reason, digest = logRecoverableError(request, error, null), - errorId$26 = request.nextChunkId++; - request.fatalError = errorId$26; + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; request.pendingChunks++; - emitErrorChunk(request, errorId$26, digest, error, !1); + emitErrorChunk(request, errorId$27, digest, error, !1); abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$26); + return abortTask(task, request, errorId$27); }); scheduleWork(function () { - return finishAbort(request, abortableTasks, errorId$26); + return finishAbort(request, abortableTasks, errorId$27); }); } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$27) { - logRecoverableError(request, error$27, null), - fatalError(request, error$27); + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); } } function resolveServerReference(bundlerConfig, id) { @@ -2578,8 +2571,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$30 = createPendingChunk(response); - chunk$30.then( + var chunk$31 = createPendingChunk(response); + chunk$31.then( function (v) { return controller.enqueue(v); }, @@ -2587,10 +2580,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$30; + previousBlockedChunk = chunk$31; chunk.then(function () { - previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); - resolveModelChunk(chunk$30, json, -1); + previousBlockedChunk === chunk$31 && (previousBlockedChunk = null); + resolveModelChunk(chunk$31, json, -1); }); } }, 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 ab2c77929ecd5..025faa765fcd3 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 @@ -74,15 +74,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -239,77 +230,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -326,10 +312,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -340,12 +326,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -354,8 +336,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -699,29 +680,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -734,44 +699,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(19)), + ? (args.splice(env, 4, format.slice(19)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -913,7 +871,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1029,14 +986,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1065,22 +1014,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1200,9 +1133,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1289,9 +1220,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1463,7 +1392,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2126,9 +2055,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2709,16 +2636,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2835,8 +2756,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2853,12 +2772,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3166,7 +3084,7 @@ markOperationEndTime(request$jscomp$1, task, info.time); else if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3225,11 +3143,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, id, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, id, info); } } @@ -3249,17 +3167,11 @@ forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; - var json = '{"time":' + (timestamp - request.timeOrigin) + "}"; - null !== request.debugDestination - ? ((timestamp = request.nextChunkId++), - (json = timestamp.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + request.pendingDebugChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function markOperationEndTime(request, task, timestamp) { (request.status === ABORTING && timestamp > request.abortTime) || @@ -3353,7 +3265,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); task.timed && markOperationEndTime(request, task, performance.now()); if ("object" === typeof resolvedModel && null !== resolvedModel) @@ -3425,7 +3337,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3453,131 +3366,87 @@ (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - cleanupTaintQueue(request), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (cleanupTaintQueue(request), + request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3593,13 +3462,14 @@ }, 0); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -3613,7 +3483,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3626,7 +3496,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3638,7 +3509,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3702,7 +3574,8 @@ else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -4491,55 +4364,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -5180,10 +5037,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -5206,30 +5059,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 15e6da2c14bd1..7197da06009e5 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 @@ -818,7 +818,8 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? (haltTask(newTask), finishHaltedTask(newTask, request)) + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) : ((task = request.fatalError), abortTask(newTask), finishAbortedTask(newTask, request, task)), @@ -871,8 +872,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -888,9 +889,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -951,8 +950,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -972,9 +971,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1376,9 +1373,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1883,7 +1878,7 @@ function retryTask(request, task) { (task.status = 0), 21 === request.type) ) - haltTask(task), finishHaltedTask(task, request); + haltTask(task), 3 === task.status && request.pendingChunks--; else { var errorId = request.fatalError; abortTask(task); @@ -1928,7 +1923,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1949,47 +1945,40 @@ function finishAbortedTask(task, request, errorId) { function haltTask(task) { 0 === task.status && (task.status = 3); } -function finishHaltedTask(task, request) { - 3 === task.status && request.pendingChunks--; -} -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (cleanupTaintQueue(request), @@ -2000,8 +1989,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -2023,7 +2012,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -2036,7 +2026,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2045,11 +2035,12 @@ function startFlowing(request, destination) { function finishHalt(request, abortedTasks) { try { abortedTasks.forEach(function (task) { - return finishHaltedTask(task, request); + 3 === task.status && request.pendingChunks--; }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2061,7 +2052,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2110,25 +2102,26 @@ function abort(request, reason) { ) : reason, digest = logRecoverableError(request, error, null), - errorId$26 = request.nextChunkId++; - request.fatalError = errorId$26; + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; request.pendingChunks++; - emitErrorChunk(request, errorId$26, digest, error, !1); + emitErrorChunk(request, errorId$27, digest, error, !1); abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$26); + return abortTask(task, request, errorId$27); }); setTimeout(function () { - return finishAbort(request, abortableTasks, errorId$26); + return finishAbort(request, abortableTasks, errorId$27); }, 0); } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$27) { - logRecoverableError(request, error$27, null), - fatalError(request, error$27); + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); } } function resolveServerReference(bundlerConfig, id) { @@ -2576,8 +2569,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$30 = createPendingChunk(response); - chunk$30.then( + var chunk$31 = createPendingChunk(response); + chunk$31.then( function (v) { return controller.enqueue(v); }, @@ -2585,10 +2578,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$30; + previousBlockedChunk = chunk$31; chunk.then(function () { - previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); - resolveModelChunk(chunk$30, json, -1); + previousBlockedChunk === chunk$31 && (previousBlockedChunk = null); + resolveModelChunk(chunk$31, json, -1); }); } }, 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 72786e856f5fa..81d1f429384a8 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 @@ -41,9 +41,6 @@ : (obj[key] = value); return obj; } - function flushBuffered(destination) { - "function" === typeof destination.flush && destination.flush(); - } function writeToDestination(destination, view) { destination = destination.write(view); destinationHasCapacity = destinationHasCapacity && destination; @@ -110,14 +107,6 @@ (writtenBytes = 0)))); return destinationHasCapacity; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)); - currentView = null; - writtenBytes = 0; - destinationHasCapacity = !0; - } function byteLengthOfChunk(chunk) { return "string" === typeof chunk ? Buffer.byteLength(chunk, "utf8") @@ -286,91 +275,74 @@ promise = pendingOperations.get(asyncId); return void 0 === promise ? null : promise; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } - function parseStackTracePrivate(error, skipFrames) { - collectedStackTrace = null; - framesToSkip = skipFrames; - skipFrames = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) return null; - } finally { - Error.prepareStackTrace = skipFrames; - } - return collectedStackTrace; - } function parseStackTrace(error, skipFrames) { var existing = stackTraceCache.get(error); if (void 0 !== existing) return existing; @@ -385,10 +357,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -399,12 +371,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -413,8 +381,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -745,14 +712,8 @@ for (var i = 0; i < stack.length; i++) { var callsite = stack[i], functionName = callsite[0], - url = devirtualizeURL(callsite[1]), - lineNumber = callsite[2], - columnNumber = callsite[3]; - if ( - !callsite[6] && - request(url, functionName, lineNumber, columnNumber) - ) - return !0; + url = devirtualizeURL(callsite[1]); + if (request(url, functionName, callsite[2], callsite[3])) return !0; } return !1; } @@ -786,7 +747,7 @@ if (("assert" !== methodName || !arguments[0]) && null !== request) { var stack = filterStackTrace( request, - parseStackTracePrivate(Error("react-stack-top-frame"), 1) || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; var owner = resolveOwner(), @@ -974,7 +935,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1087,14 +1047,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1123,22 +1075,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1258,9 +1194,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1347,9 +1281,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1520,7 +1452,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1915,7 +1847,7 @@ (serializeIONode(request, _ioNode, awaited.promise), (cutOff = (0, request.environmentName)()), advanceTaskTime(request, task, startTime), - request.pendingChunks++, + request.pendingDebugChunks++, emitDebugChunk(request, task.id, { awaited: _ioNode, env: cutOff, @@ -1955,7 +1887,7 @@ void 0 !== node && null !== node && (serializeIONode(request, node, node.promise), - request.pendingChunks++, + request.pendingDebugChunks++, (alreadyForwardedDebugInfo = (0, request.environmentName)()), (alreadyForwardedDebugInfo = { awaited: node, @@ -2286,9 +2218,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2851,16 +2781,9 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -3062,8 +2985,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -3080,12 +3001,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3391,7 +3311,7 @@ markOperationEndTime(request$jscomp$0, task, info.time); else if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$0, info), - request$jscomp$0.pendingChunks++, + request$jscomp$0.pendingDebugChunks++, emitDebugChunk(request$jscomp$0, id, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3438,11 +3358,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != debugStack && (ioInfo.stack = debugStack); - request$jscomp$0.pendingChunks++; + request$jscomp$0.pendingDebugChunks++; emitDebugChunk(request$jscomp$0, id, ioInfo); } } else - request$jscomp$0.pendingChunks++, + request$jscomp$0.pendingDebugChunks++, emitDebugChunk(request$jscomp$0, id, info); } } @@ -3492,7 +3412,7 @@ thenable = thenable.awaited; 3 === thenable.tag ? (serializeIONode(request, thenable, null), - request.pendingChunks++, + request.pendingDebugChunks++, (debugInfo = (0, request.environmentName)()), (debugInfo = { awaited: thenable, env: debugInfo }), advanceTaskTime(request, task, task.time), @@ -3502,17 +3422,10 @@ } } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; - var json = '{"time":' + (timestamp - request.timeOrigin) + "}"; - null !== request.debugDestination - ? ((timestamp = request.nextChunkId++), - (json = timestamp.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + request.pendingDebugChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + request.completedDebugChunks.push(id); } function advanceTaskTime(request, task, timestamp) { timestamp > task.time @@ -3618,7 +3531,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); task.timed && markOperationEndTime(request, task, performance.now()); if ("object" === typeof resolvedModel && null !== resolvedModel) @@ -3692,7 +3605,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3720,135 +3634,88 @@ (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - flushBuffered(debugDestination); - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } - flushBuffered(debugDestination); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.end(), (request.debugDestination = null)), - cleanupTaintQueue(request), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.end(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.end(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.end(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (cleanupTaintQueue(request), + request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3860,13 +3727,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3879,19 +3747,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), fatalError(request, error); - } - } - } - function startFlowingDebug(request, debugDestination) { - if (13 === request.status) - (request.status = CLOSED), debugDestination.destroy(request.fatalError); - else if (request.status !== CLOSED && null === request.debugDestination) { - request.debugDestination = debugDestination; - try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3904,7 +3760,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3916,7 +3773,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3980,7 +3838,8 @@ else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3996,55 +3855,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } function closeDebugChannel(request) { @@ -4874,25 +4717,6 @@ stream.on("error", onError), stream.on("end", onClose)); } - function createFakeWritableFromWebSocket(webSocket) { - return { - write: function (chunk) { - webSocket.send(chunk); - return !0; - }, - end: function () { - webSocket.close(); - }, - destroy: function (reason) { - "object" === typeof reason && - null !== reason && - (reason = reason.message); - "string" === typeof reason - ? webSocket.close(1011, reason) - : webSocket.close(1011); - } - }; - } function createFakeWritableFromReadableStreamController(controller) { return { write: function (chunk) { @@ -5175,6 +4999,8 @@ var currentOwner = null, getAsyncId = async_hooks.AsyncResource.prototype.asyncId, pendingOperations = new Map(), + awaitedPromise = new WeakMap(), + previousPromise = new WeakMap(), lastRanAwait = null, emptyStack = [], framesToSkip = 0, @@ -5385,46 +5211,48 @@ var trigger = pendingOperations.get(triggerAsyncId); if ("PROMISE" === type) if ( - ((type = async_hooks.executionAsyncId()), + (void 0 !== trigger && + null !== trigger.promise && + ((type = trigger.promise.deref()), + void 0 !== type && awaitedPromise.set(resource, type)), + (type = async_hooks.executionAsyncId()), type !== triggerAsyncId) ) { if (void 0 === trigger) return; - triggerAsyncId = null; + triggerAsyncId = pendingOperations.get(type); + void 0 !== triggerAsyncId && + null !== triggerAsyncId.promise && + ((type = triggerAsyncId.promise.deref()), + void 0 !== type && previousPromise.set(resource, type)); + type = null; if ( null === trigger.stack || (2 !== trigger.tag && 4 !== trigger.tag) ) { - resource = new WeakRef(resource); var request = resolveRequest(); null !== request && - ((triggerAsyncId = parseStackTracePrivate(Error(), 5)), - null === triggerAsyncId || - isAwaitInUserspace(request, triggerAsyncId) || - (triggerAsyncId = null)); - } else - (triggerAsyncId = emptyStack), - (resource = - void 0 !== resource._debugInfo - ? new WeakRef(resource) - : trigger.promise); - type = pendingOperations.get(type); + ((type = parseStackTrace(Error(), 5)), + isAwaitInUserspace(request, type) || (type = null)); + } else type = emptyStack; trigger = { tag: 4, owner: resolveOwner(), - stack: triggerAsyncId, + stack: type, start: performance.now(), end: -1.1, - promise: resource, + promise: new WeakRef(resource), awaited: trigger, - previous: void 0 === type ? null : type + previous: void 0 === triggerAsyncId ? null : triggerAsyncId }; } else - (type = resolveOwner()), + (triggerAsyncId = resolveOwner()), (trigger = { tag: 3, - owner: type, + owner: triggerAsyncId, stack: - null === type ? null : parseStackTracePrivate(Error(), 5), + null === triggerAsyncId + ? null + : parseStackTrace(Error(), 5), start: performance.now(), end: -1.1, promise: new WeakRef(resource), @@ -5442,9 +5270,7 @@ tag: 0, owner: trigger, stack: - null === trigger - ? parseStackTracePrivate(Error(), 3) - : null, + null === trigger ? parseStackTrace(Error(), 3) : null, start: performance.now(), end: -1.1, promise: null, @@ -5458,9 +5284,7 @@ tag: 0, owner: resource, stack: - null === resource - ? parseStackTracePrivate(Error(), 3) - : null, + null === resource ? parseStackTrace(Error(), 3) : null, start: performance.now(), end: -1.1, promise: null, @@ -5726,12 +5550,12 @@ "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_237 = []; + var JSCompiler_object_inline_chunks_230 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_237.push(chunk); + JSCompiler_object_inline_chunks_230.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_237, { + var blob = new Blob(JSCompiler_object_inline_chunks_230, { type: mimeType }); response._formData.append(name, blob, filename); @@ -5780,21 +5604,7 @@ }; exports.renderToPipeableStream = function (model, webpackMap, options) { var debugChannel = options ? options.debugChannel : void 0, - debugChannelReadable = - void 0 === debugChannel || - ("function" !== typeof debugChannel.read && - "number" !== typeof debugChannel.readyState) - ? void 0 - : debugChannel; - debugChannel = - void 0 !== debugChannel - ? "function" === typeof debugChannel.write - ? debugChannel - : "function" === typeof debugChannel.send - ? createFakeWritableFromWebSocket(debugChannel) - : void 0 - : void 0; - var request = createRequest( + request = createRequest( model, webpackMap, options ? options.onError : void 0, @@ -5803,13 +5613,12 @@ options ? options.temporaryReferences : void 0, options ? options.environmentName : void 0, options ? options.filterStackFrame : void 0, - void 0 !== debugChannelReadable + void 0 !== debugChannel ), hasStartedFlowing = !1; startWork(request); - void 0 !== debugChannel && startFlowingDebug(request, debugChannel); - void 0 !== debugChannelReadable && - startReadingFromDebugChannelReadable(request, debugChannelReadable); + void 0 !== debugChannel && + startReadingFromDebugChannelReadable(request, debugChannel); return { pipe: function (destination) { if (hasStartedFlowing) @@ -5826,14 +5635,10 @@ "The destination stream errored while writing data." ) ); - if (void 0 === debugChannelReadable) - destination.on( - "close", - createCancelHandler( - request, - "The destination stream closed early." - ) - ); + destination.on( + "close", + createCancelHandler(request, "The destination stream closed early.") + ); return destination; }, abort: function (reason) { @@ -5846,10 +5651,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -5872,22 +5673,6 @@ signal.addEventListener("abort", listener); } } - if (void 0 !== debugChannelWritable) { - var debugWritable; - new ReadableStream( - { - type: "bytes", - start: function (controller) { - debugWritable = - createFakeWritableFromReadableStreamController(controller); - }, - pull: function () { - startFlowingDebug(request, debugWritable); - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); - } void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 92ce802ce8f75..3c2a3dccdcf39 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 @@ -841,7 +841,8 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? (haltTask(newTask), finishHaltedTask(newTask, request)) + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) : ((task = request.fatalError), abortTask(newTask), finishAbortedTask(newTask, request, task)), @@ -894,8 +895,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -911,9 +912,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -974,8 +973,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -995,9 +994,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1396,9 +1393,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1889,7 +1884,7 @@ function retryTask(request, task) { (task.status = 0), 21 === request.type) ) - haltTask(task), finishHaltedTask(task, request); + haltTask(task), 3 === task.status && request.pendingChunks--; else { var errorId = request.fatalError; abortTask(task); @@ -1934,7 +1929,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1955,71 +1951,65 @@ function finishAbortedTask(task, request, errorId) { function haltTask(task) { 0 === task.status && (task.status = 3); } -function finishHaltedTask(task, request) { - 3 === task.status && request.pendingChunks--; -} -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, importsChunks[i])) - ) { - request.destination = null; - i++; - break; - } - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - if (!writeChunkAndReturn(destination, hintChunks[i])) { - request.destination = null; - i++; - break; - } - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, regularChunks[i])) - ) { - request.destination = null; - i++; - break; - } - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, errorChunks[i])) - ) { - request.destination = null; - i++; - break; - } - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)), - (currentView = null), - (writtenBytes = 0), - (destinationHasCapacity = !0); - } - "function" === typeof destination.flush && destination.flush(); +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; + } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && (cleanupTaintQueue(request), 12 > request.status && @@ -2029,8 +2019,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.end(), (request.destination = null))); + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -2048,7 +2038,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -2061,7 +2052,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2070,11 +2061,12 @@ function startFlowing(request, destination) { function finishHalt(request, abortedTasks) { try { abortedTasks.forEach(function (task) { - return finishHaltedTask(task, request); + 3 === task.status && request.pendingChunks--; }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2086,7 +2078,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2135,25 +2128,26 @@ function abort(request, reason) { ) : reason, digest = logRecoverableError(request, error, null), - errorId$26 = request.nextChunkId++; - request.fatalError = errorId$26; + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; request.pendingChunks++; - emitErrorChunk(request, errorId$26, digest, error, !1); + emitErrorChunk(request, errorId$27, digest, error, !1); abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$26); + return abortTask(task, request, errorId$27); }); setImmediate(function () { - return finishAbort(request, abortableTasks, errorId$26); + return finishAbort(request, abortableTasks, errorId$27); }); } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$27) { - logRecoverableError(request, error$27, null), - fatalError(request, error$27); + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); } } function resolveServerReference(bundlerConfig, id) { @@ -2601,8 +2595,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$30 = createPendingChunk(response); - chunk$30.then( + var chunk$31 = createPendingChunk(response); + chunk$31.then( function (v) { return controller.enqueue(v); }, @@ -2610,10 +2604,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$30; + previousBlockedChunk = chunk$31; chunk.then(function () { - previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); - resolveModelChunk(chunk$30, json, -1); + previousBlockedChunk === chunk$31 && (previousBlockedChunk = null); + resolveModelChunk(chunk$31, json, -1); }); } }, @@ -3034,12 +3028,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_272 = []; + var JSCompiler_object_inline_chunks_263 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_272.push(chunk); + JSCompiler_object_inline_chunks_263.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_272, { + var blob = new Blob(JSCompiler_object_inline_chunks_263, { type: mimeType }); response._formData.append(name, blob, filename); 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 6a4b4af670b54..4bda0670ef8c5 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 @@ -41,9 +41,6 @@ : (obj[key] = value); return obj; } - function flushBuffered(destination) { - "function" === typeof destination.flush && destination.flush(); - } function writeToDestination(destination, view) { destination = destination.write(view); destinationHasCapacity = destinationHasCapacity && destination; @@ -110,14 +107,6 @@ (writtenBytes = 0)))); return destinationHasCapacity; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)); - currentView = null; - writtenBytes = 0; - destinationHasCapacity = !0; - } function byteLengthOfChunk(chunk) { return "string" === typeof chunk ? Buffer.byteLength(chunk, "utf8") @@ -286,91 +275,74 @@ promise = pendingOperations.get(asyncId); return void 0 === promise ? null : promise; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } - function parseStackTracePrivate(error, skipFrames) { - collectedStackTrace = null; - framesToSkip = skipFrames; - skipFrames = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) return null; - } finally { - Error.prepareStackTrace = skipFrames; - } - return collectedStackTrace; - } function parseStackTrace(error, skipFrames) { var existing = stackTraceCache.get(error); if (void 0 !== existing) return existing; @@ -385,10 +357,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -399,12 +371,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -413,8 +381,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -745,14 +712,8 @@ for (var i = 0; i < stack.length; i++) { var callsite = stack[i], functionName = callsite[0], - url = devirtualizeURL(callsite[1]), - lineNumber = callsite[2], - columnNumber = callsite[3]; - if ( - !callsite[6] && - request(url, functionName, lineNumber, columnNumber) - ) - return !0; + url = devirtualizeURL(callsite[1]); + if (request(url, functionName, callsite[2], callsite[3])) return !0; } return !1; } @@ -786,7 +747,7 @@ if (("assert" !== methodName || !arguments[0]) && null !== request) { var stack = filterStackTrace( request, - parseStackTracePrivate(Error("react-stack-top-frame"), 1) || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; var owner = resolveOwner(), @@ -974,7 +935,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1087,14 +1047,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1123,22 +1075,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1258,9 +1194,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1347,9 +1281,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1520,7 +1452,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1915,7 +1847,7 @@ (serializeIONode(request, _ioNode, awaited.promise), (cutOff = (0, request.environmentName)()), advanceTaskTime(request, task, startTime), - request.pendingChunks++, + request.pendingDebugChunks++, emitDebugChunk(request, task.id, { awaited: _ioNode, env: cutOff, @@ -1955,7 +1887,7 @@ void 0 !== node && null !== node && (serializeIONode(request, node, node.promise), - request.pendingChunks++, + request.pendingDebugChunks++, (alreadyForwardedDebugInfo = (0, request.environmentName)()), (alreadyForwardedDebugInfo = { awaited: node, @@ -2286,9 +2218,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2851,16 +2781,9 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -3062,8 +2985,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -3080,12 +3001,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3391,7 +3311,7 @@ markOperationEndTime(request$jscomp$0, task, info.time); else if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$0, info), - request$jscomp$0.pendingChunks++, + request$jscomp$0.pendingDebugChunks++, emitDebugChunk(request$jscomp$0, id, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3438,11 +3358,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != debugStack && (ioInfo.stack = debugStack); - request$jscomp$0.pendingChunks++; + request$jscomp$0.pendingDebugChunks++; emitDebugChunk(request$jscomp$0, id, ioInfo); } } else - request$jscomp$0.pendingChunks++, + request$jscomp$0.pendingDebugChunks++, emitDebugChunk(request$jscomp$0, id, info); } } @@ -3492,7 +3412,7 @@ thenable = thenable.awaited; 3 === thenable.tag ? (serializeIONode(request, thenable, null), - request.pendingChunks++, + request.pendingDebugChunks++, (debugInfo = (0, request.environmentName)()), (debugInfo = { awaited: thenable, env: debugInfo }), advanceTaskTime(request, task, task.time), @@ -3502,17 +3422,10 @@ } } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; - var json = '{"time":' + (timestamp - request.timeOrigin) + "}"; - null !== request.debugDestination - ? ((timestamp = request.nextChunkId++), - (json = timestamp.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + timestamp.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + request.pendingDebugChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + request.completedDebugChunks.push(id); } function advanceTaskTime(request, task, timestamp) { timestamp > task.time @@ -3618,7 +3531,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); task.timed && markOperationEndTime(request, task, performance.now()); if ("object" === typeof resolvedModel && null !== resolvedModel) @@ -3692,7 +3605,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3720,135 +3634,88 @@ (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - flushBuffered(debugDestination); - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } - flushBuffered(debugDestination); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.end(), (request.debugDestination = null)), - cleanupTaintQueue(request), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.end(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.end(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.end(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (cleanupTaintQueue(request), + request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3860,13 +3727,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3879,19 +3747,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), fatalError(request, error); - } - } - } - function startFlowingDebug(request, debugDestination) { - if (13 === request.status) - (request.status = CLOSED), debugDestination.destroy(request.fatalError); - else if (request.status !== CLOSED && null === request.debugDestination) { - request.debugDestination = debugDestination; - try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3904,7 +3760,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3916,7 +3773,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3980,7 +3838,8 @@ else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3996,55 +3855,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } function closeDebugChannel(request) { @@ -4837,25 +4680,6 @@ stream.on("error", onError), stream.on("end", onClose)); } - function createFakeWritableFromWebSocket(webSocket) { - return { - write: function (chunk) { - webSocket.send(chunk); - return !0; - }, - end: function () { - webSocket.close(); - }, - destroy: function (reason) { - "object" === typeof reason && - null !== reason && - (reason = reason.message); - "string" === typeof reason - ? webSocket.close(1011, reason) - : webSocket.close(1011); - } - }; - } function createFakeWritableFromReadableStreamController(controller) { return { write: function (chunk) { @@ -5138,6 +4962,8 @@ var currentOwner = null, getAsyncId = async_hooks.AsyncResource.prototype.asyncId, pendingOperations = new Map(), + awaitedPromise = new WeakMap(), + previousPromise = new WeakMap(), lastRanAwait = null, emptyStack = [], framesToSkip = 0, @@ -5348,46 +5174,48 @@ var trigger = pendingOperations.get(triggerAsyncId); if ("PROMISE" === type) if ( - ((type = async_hooks.executionAsyncId()), + (void 0 !== trigger && + null !== trigger.promise && + ((type = trigger.promise.deref()), + void 0 !== type && awaitedPromise.set(resource, type)), + (type = async_hooks.executionAsyncId()), type !== triggerAsyncId) ) { if (void 0 === trigger) return; - triggerAsyncId = null; + triggerAsyncId = pendingOperations.get(type); + void 0 !== triggerAsyncId && + null !== triggerAsyncId.promise && + ((type = triggerAsyncId.promise.deref()), + void 0 !== type && previousPromise.set(resource, type)); + type = null; if ( null === trigger.stack || (2 !== trigger.tag && 4 !== trigger.tag) ) { - resource = new WeakRef(resource); var request = resolveRequest(); null !== request && - ((triggerAsyncId = parseStackTracePrivate(Error(), 5)), - null === triggerAsyncId || - isAwaitInUserspace(request, triggerAsyncId) || - (triggerAsyncId = null)); - } else - (triggerAsyncId = emptyStack), - (resource = - void 0 !== resource._debugInfo - ? new WeakRef(resource) - : trigger.promise); - type = pendingOperations.get(type); + ((type = parseStackTrace(Error(), 5)), + isAwaitInUserspace(request, type) || (type = null)); + } else type = emptyStack; trigger = { tag: 4, owner: resolveOwner(), - stack: triggerAsyncId, + stack: type, start: performance.now(), end: -1.1, - promise: resource, + promise: new WeakRef(resource), awaited: trigger, - previous: void 0 === type ? null : type + previous: void 0 === triggerAsyncId ? null : triggerAsyncId }; } else - (type = resolveOwner()), + (triggerAsyncId = resolveOwner()), (trigger = { tag: 3, - owner: type, + owner: triggerAsyncId, stack: - null === type ? null : parseStackTracePrivate(Error(), 5), + null === triggerAsyncId + ? null + : parseStackTrace(Error(), 5), start: performance.now(), end: -1.1, promise: new WeakRef(resource), @@ -5405,9 +5233,7 @@ tag: 0, owner: trigger, stack: - null === trigger - ? parseStackTracePrivate(Error(), 3) - : null, + null === trigger ? parseStackTrace(Error(), 3) : null, start: performance.now(), end: -1.1, promise: null, @@ -5421,9 +5247,7 @@ tag: 0, owner: resource, stack: - null === resource - ? parseStackTracePrivate(Error(), 3) - : null, + null === resource ? parseStackTrace(Error(), 3) : null, start: performance.now(), end: -1.1, promise: null, @@ -5689,12 +5513,12 @@ "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_237 = []; + var JSCompiler_object_inline_chunks_230 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_237.push(chunk); + JSCompiler_object_inline_chunks_230.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_237, { + var blob = new Blob(JSCompiler_object_inline_chunks_230, { type: mimeType }); response._formData.append(name, blob, filename); @@ -5743,21 +5567,7 @@ }; exports.renderToPipeableStream = function (model, webpackMap, options) { var debugChannel = options ? options.debugChannel : void 0, - debugChannelReadable = - void 0 === debugChannel || - ("function" !== typeof debugChannel.read && - "number" !== typeof debugChannel.readyState) - ? void 0 - : debugChannel; - debugChannel = - void 0 !== debugChannel - ? "function" === typeof debugChannel.write - ? debugChannel - : "function" === typeof debugChannel.send - ? createFakeWritableFromWebSocket(debugChannel) - : void 0 - : void 0; - var request = createRequest( + request = createRequest( model, webpackMap, options ? options.onError : void 0, @@ -5766,13 +5576,12 @@ options ? options.temporaryReferences : void 0, options ? options.environmentName : void 0, options ? options.filterStackFrame : void 0, - void 0 !== debugChannelReadable + void 0 !== debugChannel ), hasStartedFlowing = !1; startWork(request); - void 0 !== debugChannel && startFlowingDebug(request, debugChannel); - void 0 !== debugChannelReadable && - startReadingFromDebugChannelReadable(request, debugChannelReadable); + void 0 !== debugChannel && + startReadingFromDebugChannelReadable(request, debugChannel); return { pipe: function (destination) { if (hasStartedFlowing) @@ -5789,14 +5598,10 @@ "The destination stream errored while writing data." ) ); - if (void 0 === debugChannelReadable) - destination.on( - "close", - createCancelHandler( - request, - "The destination stream closed early." - ) - ); + destination.on( + "close", + createCancelHandler(request, "The destination stream closed early.") + ); return destination; }, abort: function (reason) { @@ -5809,10 +5614,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -5835,22 +5636,6 @@ signal.addEventListener("abort", listener); } } - if (void 0 !== debugChannelWritable) { - var debugWritable; - new ReadableStream( - { - type: "bytes", - start: function (controller) { - debugWritable = - createFakeWritableFromReadableStreamController(controller); - }, - pull: function () { - startFlowingDebug(request, debugWritable); - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); - } void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 b16a46db37ffd..cce2a21d74344 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 @@ -841,7 +841,8 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? (haltTask(newTask), finishHaltedTask(newTask, request)) + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) : ((task = request.fatalError), abortTask(newTask), finishAbortedTask(newTask, request, task)), @@ -894,8 +895,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -911,9 +912,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -974,8 +973,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -995,9 +994,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(streamTask), - haltTask(streamTask), - finishHaltedTask(streamTask, request)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1396,9 +1393,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? (request.abortableTasks.delete(newTask), - haltTask(newTask), - finishHaltedTask(newTask, request)) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1889,7 +1884,7 @@ function retryTask(request, task) { (task.status = 0), 21 === request.type) ) - haltTask(task), finishHaltedTask(task, request); + haltTask(task), 3 === task.status && request.pendingChunks--; else { var errorId = request.fatalError; abortTask(task); @@ -1934,7 +1929,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1955,71 +1951,65 @@ function finishAbortedTask(task, request, errorId) { function haltTask(task) { 0 === task.status && (task.status = 3); } -function finishHaltedTask(task, request) { - 3 === task.status && request.pendingChunks--; -} -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, importsChunks[i])) - ) { - request.destination = null; - i++; - break; - } - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - if (!writeChunkAndReturn(destination, hintChunks[i])) { - request.destination = null; - i++; - break; - } - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, regularChunks[i])) - ) { - request.destination = null; - i++; - break; - } - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, errorChunks[i])) - ) { - request.destination = null; - i++; - break; - } - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)), - (currentView = null), - (writtenBytes = 0), - (destinationHasCapacity = !0); - } - "function" === typeof destination.flush && destination.flush(); +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; + } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && (cleanupTaintQueue(request), 12 > request.status && @@ -2029,8 +2019,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.end(), (request.destination = null))); + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -2048,7 +2038,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -2061,7 +2052,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2070,11 +2061,12 @@ function startFlowing(request, destination) { function finishHalt(request, abortedTasks) { try { abortedTasks.forEach(function (task) { - return finishHaltedTask(task, request); + 3 === task.status && request.pendingChunks--; }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2086,7 +2078,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -2135,25 +2128,26 @@ function abort(request, reason) { ) : reason, digest = logRecoverableError(request, error, null), - errorId$26 = request.nextChunkId++; - request.fatalError = errorId$26; + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; request.pendingChunks++; - emitErrorChunk(request, errorId$26, digest, error, !1); + emitErrorChunk(request, errorId$27, digest, error, !1); abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$26); + return abortTask(task, request, errorId$27); }); setImmediate(function () { - return finishAbort(request, abortableTasks, errorId$26); + return finishAbort(request, abortableTasks, errorId$27); }); } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$27) { - logRecoverableError(request, error$27, null), - fatalError(request, error$27); + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); } } function resolveServerReference(bundlerConfig, id) { @@ -2567,8 +2561,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$30 = createPendingChunk(response); - chunk$30.then( + var chunk$31 = createPendingChunk(response); + chunk$31.then( function (v) { return controller.enqueue(v); }, @@ -2576,10 +2570,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$30; + previousBlockedChunk = chunk$31; chunk.then(function () { - previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); - resolveModelChunk(chunk$30, json, -1); + previousBlockedChunk === chunk$31 && (previousBlockedChunk = null); + resolveModelChunk(chunk$31, json, -1); }); } }, @@ -3000,12 +2994,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_272 = []; + var JSCompiler_object_inline_chunks_263 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_272.push(chunk); + JSCompiler_object_inline_chunks_263.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_272, { + var blob = new Blob(JSCompiler_object_inline_chunks_263, { type: mimeType }); response._formData.append(name, blob, filename); 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 5ffa5f19e6a2c..8b69b6ce14997 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 @@ -64,8 +64,8 @@ "webpack-sources": "^3.2.0" }, "peerDependencies": { - "react": "0.0.0-experimental-97cdd5d3-20250710", - "react-dom": "0.0.0-experimental-97cdd5d3-20250710", + "react": "0.0.0-experimental-e6ed827a-20250715", + "react-dom": "0.0.0-experimental-e6ed827a-20250715", "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 ae0343a7326b9..dee8ae1e9d2aa 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 @@ -1793,13 +1793,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -1853,6 +1846,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1880,15 +1875,6 @@ : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -2664,96 +2650,6 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { - if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; - for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, - chunkLength = chunk.length; - i < chunkLength; - - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = chunk[i]; - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 35 === rowState || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = chunk[i++]; - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = chunk.indexOf(10, i); - break; - case 4: - (lastIdx = i + rowLength), - lastIdx > chunk.length && (lastIdx = -1); - } - var offset = chunk.byteOffset + i; - if (-1 < lastIdx) - (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - weakResponse, - rowTag, - buffer, - rowLength - ), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; - } - } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } - } function createFromJSONCallback(response) { return function (key, value) { if ("string" === typeof value) @@ -2834,9 +2730,6 @@ return value; }; } - function close(weakResponse) { - reportGlobalError(weakResponse, Error("Connection closed.")); - } function createDebugCallbackFromWritableStream(debugWritable) { var textEncoder = new TextEncoder(), writer = debugWritable.getWriter(); @@ -2871,138 +2764,104 @@ debugChannel )._weakResponse; } - function startReadingFromUniversalStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) close(response$jscomp$0); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - if (value instanceof ArrayBuffer) - processBinaryChunk( - response$jscomp$0, - streamState, - new Uint8Array(value) - ); - else if ("string" === typeof value) { - if ( - ((_ref = streamState), void 0 !== response$jscomp$0.weak.deref()) - ) { - for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, - rowState = _ref._rowState, - rowID = _ref._rowID, - rowTag = _ref._rowTag, - rowLength = _ref._rowLength, - buffer = _ref._buffer, - chunkLength = value.length; - i < chunkLength; + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); + for ( + var i = 0, + rowState = _ref._rowState, + rowID = _ref._rowID, + rowTag = _ref._rowTag, + rowLength = _ref._rowLength, + buffer = _ref._buffer, + chunkLength = value.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = value.charCodeAt(i++); - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 1: - rowState = value.charCodeAt(i); - 84 === rowState || - 65 === rowState || - 79 === rowState || - 111 === rowState || - 85 === rowState || - 83 === rowState || - 115 === rowState || - 76 === rowState || - 108 === rowState || - 71 === rowState || - 103 === rowState || - 77 === rowState || - 109 === rowState || - 86 === rowState - ? ((rowTag = rowState), (rowState = 2), i++) - : (64 < rowState && 91 > rowState) || - 114 === rowState || - 120 === rowState - ? ((rowTag = rowState), (rowState = 3), i++) - : ((rowTag = 0), (rowState = 3)); - continue; - case 2: - lastIdx = value.charCodeAt(i++); - 44 === lastIdx - ? (rowState = 4) - : (rowLength = - (rowLength << 4) | - (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); - continue; - case 3: - lastIdx = value.indexOf("\n", i); - break; - case 4: - if (84 !== rowTag) - throw Error( - "Binary RSC chunks cannot be encoded as strings. This is a bug in the wiring of the React streams." - ); - if ( - rowLength < value.length || - value.length > 3 * rowLength - ) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - lastIdx = value.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); - i = value.slice(i, lastIdx); - processFullStringRow(response, rowID, rowTag, i); - i = lastIdx; - 3 === rowState && i++; - rowLength = rowID = rowTag = rowState = 0; - buffer.length = 0; - } else if (value.length !== i) - throw Error( - "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." - ); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = value[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 1: + rowState = value[i]; + 84 === rowState || + 65 === rowState || + 79 === rowState || + 111 === rowState || + 85 === rowState || + 83 === rowState || + 115 === rowState || + 76 === rowState || + 108 === rowState || + 71 === rowState || + 103 === rowState || + 77 === rowState || + 109 === rowState || + 86 === rowState + ? ((rowTag = rowState), (rowState = 2), i++) + : (64 < rowState && 91 > rowState) || + 35 === rowState || + 114 === rowState || + 120 === rowState + ? ((rowTag = rowState), (rowState = 3), i++) + : ((rowTag = 0), (rowState = 3)); + continue; + case 2: + lastIdx = value[i++]; + 44 === lastIdx + ? (rowState = 4) + : (rowLength = + (rowLength << 4) | + (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + continue; + case 3: + lastIdx = value.indexOf(10, i); + break; + case 4: + (lastIdx = i + rowLength), + lastIdx > value.length && (lastIdx = -1); + } + var offset = value.byteOffset + i; + if (-1 < lastIdx) + (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + value = new Uint8Array( + value.buffer, + offset, + value.byteLength - i + ); + buffer.push(value); + rowLength -= value.byteLength; + break; } - _ref._rowState = rowState; - _ref._rowID = rowID; - _ref._rowTag = rowTag; - _ref._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, value); + _ref._rowState = rowState; + _ref._rowID = rowID; + _ref._rowTag = rowTag; + _ref._rowLength = rowLength; + } return reader.read().then(progress).catch(error); } } - function error(e) { - reportGlobalError(response$jscomp$0, e); - } - var streamState = createStreamState(), - reader = stream.getReader(); - reader.read().then(progress).catch(error); - } - function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) isSecondaryStream || close(response); - else - return ( - processBinaryChunk(response, streamState, value), - reader.read().then(progress).catch(error) - ); - } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var React = require("react"), @@ -3198,10 +3057,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-canary-97cdd5d3-20250710", + version: "19.2.0-canary-e6ed827a-20250715", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-97cdd5d3-20250710", + reconcilerVersion: "19.2.0-canary-e6ed827a-20250715", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -3210,13 +3069,7 @@ var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, r.body, !0)) - : startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -3225,15 +3078,9 @@ return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { - var response = createResponseFromOptions(options); - options && options.debugChannel && options.debugChannel.readable - ? (startReadingFromUniversalStream( - response, - options.debugChannel.readable - ), - startReadingFromStream(response, stream, !0)) - : startReadingFromStream(response, stream, !1); - return getRoot(response); + options = createResponseFromOptions(options); + startReadingFromStream(options, stream); + return getRoot(options); }; exports.createServerReference = function ( id, 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 5693b38fc4d3d..e6e6c372a0687 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 @@ -1200,6 +1200,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1664,20 +1666,18 @@ function createResponseFromOptions(options) { : void 0 ); } -function startReadingFromStream(response, stream, isSecondaryStream) { - function progress(_ref2) { - var value = _ref2.value; - if (_ref2.done) - isSecondaryStream || - reportGlobalError(response, Error("Connection closed.")); +function startReadingFromStream(response, stream) { + function progress(_ref) { + var value = _ref.value; + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref2 = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1688,8 +1688,8 @@ function startReadingFromStream(response, stream, isSecondaryStream) { lastIdx = value[i++]; 58 === lastIdx ? (rowState = 1) - : (_ref2 = - (_ref2 << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); + : (_ref = + (_ref << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: rowState = value[i]; @@ -1732,10 +1732,10 @@ function startReadingFromStream(response, stream, isSecondaryStream) { var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, _ref2, rowTag, buffer, rowLength), + processFullBinaryRow(response, _ref, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, - (rowLength = _ref2 = rowTag = rowState = 0), + (rowLength = _ref = rowTag = rowState = 0), (buffer.length = 0); else { value = new Uint8Array(value.buffer, offset, value.byteLength - i); @@ -1744,31 +1744,24 @@ function startReadingFromStream(response, stream, isSecondaryStream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref2; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { var response = createResponseFromOptions(options); promiseForResponse.then( function (r) { - startReadingFromStream(response, r.body, !1); + startReadingFromStream(response, r.body); }, function (e) { reportGlobalError(response, e); @@ -1778,7 +1771,7 @@ exports.createFromFetch = function (promiseForResponse, options) { }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); - startReadingFromStream(options, stream, !1); + startReadingFromStream(options, stream); return getChunk(options, 0); }; exports.createServerReference = function (id, callServer) { 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 49089a5fab7fe..feef0603671f2 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 @@ -2007,13 +2007,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2067,6 +2060,8 @@ this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2976,17 +2971,15 @@ void 0 )._weakResponse; } - function startReadingFromStream(response$jscomp$0, stream) { + function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; - if (_ref.done) - reportGlobalError(response$jscomp$0, Error("Connection closed.")); + if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - _ref = streamState; - if (void 0 !== response$jscomp$0.weak.deref()) { + if (void 0 !== response.weak.deref()) { + _ref = unwrapWeakResponse(response); for ( - var response = unwrapWeakResponse(response$jscomp$0), - i = 0, + var i = 0, rowState = _ref._rowState, rowID = _ref._rowID, rowTag = _ref._rowTag, @@ -3048,13 +3041,7 @@ var offset = value.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(value.buffer, offset, lastIdx - i)), - processFullBinaryRow( - response, - rowID, - rowTag, - buffer, - rowLength - ), + processFullBinaryRow(_ref, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -3079,16 +3066,9 @@ } } function error(e) { - reportGlobalError(response$jscomp$0, e); + reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } var ReactDOM = require("react-dom"), 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 7cd50a65ded1c..05f1360b97fd6 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 @@ -1375,6 +1375,8 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -1855,12 +1857,12 @@ function startReadingFromStream(response, stream) { if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { var i = 0, - rowState = streamState._rowState; - _ref = streamState._rowID; + rowState = response._rowState; + _ref = response._rowID; for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = value.length; i < chunkLength; @@ -1927,24 +1929,17 @@ function startReadingFromStream(response, stream) { break; } } - streamState._rowState = rowState; - streamState._rowID = _ref; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = _ref; + response._rowTag = rowTag; + response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } function error(e) { reportGlobalError(response, e); } - var streamState = { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }, - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } exports.createFromFetch = function (promiseForResponse, options) { 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 fc6c0df3a1178..d8c9f59f4d79b 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 @@ -2007,13 +2007,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2067,6 +2060,8 @@ this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2094,15 +2089,6 @@ : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -2883,16 +2869,16 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { + function processBinaryChunk(weakResponse, chunk) { if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; + weakResponse = unwrapWeakResponse(weakResponse); for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -2903,8 +2889,8 @@ lastIdx = chunk[i++]; 58 === lastIdx ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | + : (rowID = + (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: @@ -2950,15 +2936,15 @@ if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), processFullBinaryRow( - response, weakResponse, + rowID, rowTag, buffer, rowLength ), (i = lastIdx), 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), + (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); @@ -2967,10 +2953,10 @@ break; } } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } } function createFromJSONCallback(response) { @@ -3084,15 +3070,14 @@ if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -3295,32 +3280,29 @@ options ) { var response$jscomp$0 = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0, - options && options.findSourceMapURL - ? options.findSourceMapURL - : void 0, - options ? !0 === options.replayConsoleLogs : !1, - options && options.environmentName ? options.environmentName : void 0, - void 0 - )._weakResponse, - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0, + options && options.findSourceMapURL ? options.findSourceMapURL : void 0, + options ? !0 === options.replayConsoleLogs : !1, + options && options.environmentName ? options.environmentName : void 0, + void 0 + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { if (void 0 !== response$jscomp$0.weak.deref()) { for ( var response = unwrapWeakResponse(response$jscomp$0), i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -3396,12 +3378,12 @@ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { reportGlobalError(response$jscomp$0, error); 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 83ab8e797d5fb..1cb286911a00c 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 @@ -1376,14 +1376,13 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; this._fromJSON = createFromJSONCallback(this); } -function createStreamState() { - return { _rowState: 0, _rowID: 0, _rowTag: 0, _rowLength: 0, _buffer: [] }; -} function resolveBuffer(response, id, buffer) { response = response._chunks; var chunk = response.get(id); @@ -1802,14 +1801,14 @@ function processFullStringRow(response, id, tag, row) { : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(weakResponse, streamState, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1869,16 +1868,16 @@ function processBinaryChunk(weakResponse, streamState, chunk) { (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { - weakResponse = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(weakResponse); - rowLength -= weakResponse.byteLength; + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; break; } } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1942,15 +1941,14 @@ function startReadingFromStream(response, stream) { if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -1976,24 +1974,23 @@ exports.createFromNodeStream = function ( options ) { var response = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0 - ), - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0 + ); stream.on("data", function (chunk) { if ("string" === typeof chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -2068,11 +2065,11 @@ exports.createFromNodeStream = function ( "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } else processBinaryChunk(response, streamState, chunk); + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; + } else processBinaryChunk(response, chunk); }); stream.on("error", function (error) { reportGlobalError(response, error); 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 d0f841e8902e4..31a18779cd3f1 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 @@ -1969,13 +1969,6 @@ } case "Y": if (2 < value.length && (ref = response._debugChannel)) { - if ("@" === value[2]) - return ( - (parentObject = value.slice(3)), - (key = parseInt(parentObject, 16)), - response._chunks.has(key) || ref("P:" + parentObject), - getChunk(response, key) - ); value = value.slice(2); var _id2 = parseInt(value, 16); response._chunks.has(_id2) || ref("Q:" + value); @@ -2029,6 +2022,8 @@ this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; @@ -2056,15 +2051,6 @@ : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } - function createStreamState() { - return { - _rowState: 0, - _rowID: 0, - _rowTag: 0, - _rowLength: 0, - _buffer: [] - }; - } function resolveDebugHalt(response, id) { var chunks = response._chunks, chunk = chunks.get(id); @@ -2845,16 +2831,16 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(weakResponse, streamState, chunk) { + function processBinaryChunk(weakResponse, chunk) { if (void 0 !== weakResponse.weak.deref()) { - var response = unwrapWeakResponse(weakResponse), - i = 0, - rowState = streamState._rowState; - weakResponse = streamState._rowID; + weakResponse = unwrapWeakResponse(weakResponse); for ( - var rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -2865,8 +2851,8 @@ lastIdx = chunk[i++]; 58 === lastIdx ? (rowState = 1) - : (weakResponse = - (weakResponse << 4) | + : (rowID = + (rowID << 4) | (96 < lastIdx ? lastIdx - 87 : lastIdx - 48)); continue; case 1: @@ -2912,15 +2898,15 @@ if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), processFullBinaryRow( - response, weakResponse, + rowID, rowTag, buffer, rowLength ), (i = lastIdx), 3 === rowState && i++, - (rowLength = weakResponse = rowTag = rowState = 0), + (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); @@ -2929,10 +2915,10 @@ break; } } - streamState._rowState = rowState; - streamState._rowID = weakResponse; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } } function createFromJSONCallback(response) { @@ -3046,15 +3032,14 @@ if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -3257,32 +3242,29 @@ options ) { var response$jscomp$0 = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0, - options && options.findSourceMapURL - ? options.findSourceMapURL - : void 0, - options ? !0 === options.replayConsoleLogs : !1, - options && options.environmentName ? options.environmentName : void 0, - void 0 - )._weakResponse, - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0, + options && options.findSourceMapURL ? options.findSourceMapURL : void 0, + options ? !0 === options.replayConsoleLogs : !1, + options && options.environmentName ? options.environmentName : void 0, + void 0 + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { if (void 0 !== response$jscomp$0.weak.deref()) { for ( var response = unwrapWeakResponse(response$jscomp$0), i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -3358,12 +3340,12 @@ "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - } else processBinaryChunk(response$jscomp$0, streamState, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { reportGlobalError(response$jscomp$0, error); 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 e6f0dcd228ce0..d69fb30f2a09f 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 @@ -1341,14 +1341,13 @@ function ResponseInstance( this._chunks = chunks; this._stringDecoder = new util.TextDecoder(); this._fromJSON = null; + this._rowLength = this._rowTag = this._rowID = this._rowState = 0; + this._buffer = []; this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; this._fromJSON = createFromJSONCallback(this); } -function createStreamState() { - return { _rowState: 0, _rowID: 0, _rowTag: 0, _rowLength: 0, _buffer: [] }; -} function resolveBuffer(response, id, buffer) { response = response._chunks; var chunk = response.get(id); @@ -1767,14 +1766,14 @@ function processFullStringRow(response, id, tag, row) { : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(weakResponse, streamState, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1834,16 +1833,16 @@ function processBinaryChunk(weakResponse, streamState, chunk) { (rowLength = rowID = rowTag = rowState = 0), (buffer.length = 0); else { - weakResponse = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(weakResponse); - rowLength -= weakResponse.byteLength; + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; break; } } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1907,15 +1906,14 @@ function startReadingFromStream(response, stream) { if (_ref.done) close(response); else return ( - processBinaryChunk(response, streamState, value), + processBinaryChunk(response, value), reader.read().then(progress).catch(error) ); } function error(e) { reportGlobalError(response, e); } - var streamState = createStreamState(), - reader = stream.getReader(); + var reader = stream.getReader(); reader.read().then(progress).catch(error); } function noServerCall() { @@ -1941,24 +1939,23 @@ exports.createFromNodeStream = function ( options ) { var response = new ResponseInstance( - serverConsumerManifest.moduleMap, - serverConsumerManifest.serverModuleMap, - serverConsumerManifest.moduleLoading, - noServerCall, - options ? options.encodeFormAction : void 0, - options && "string" === typeof options.nonce ? options.nonce : void 0, - void 0 - ), - streamState = createStreamState(); + serverConsumerManifest.moduleMap, + serverConsumerManifest.serverModuleMap, + serverConsumerManifest.moduleLoading, + noServerCall, + options ? options.encodeFormAction : void 0, + options && "string" === typeof options.nonce ? options.nonce : void 0, + void 0 + ); stream.on("data", function (chunk) { if ("string" === typeof chunk) { for ( var i = 0, - rowState = streamState._rowState, - rowID = streamState._rowID, - rowTag = streamState._rowTag, - rowLength = streamState._rowLength, - buffer = streamState._buffer, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._buffer, chunkLength = chunk.length; i < chunkLength; @@ -2033,11 +2030,11 @@ exports.createFromNodeStream = function ( "String chunks need to be passed in their original shape. Not split into smaller string chunks. This is a bug in the wiring of the React streams." ); } - streamState._rowState = rowState; - streamState._rowID = rowID; - streamState._rowTag = rowTag; - streamState._rowLength = rowLength; - } else processBinaryChunk(response, streamState, chunk); + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; + } else processBinaryChunk(response, chunk); }); stream.on("error", function (error) { reportGlobalError(response, error); 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 cd00a4137bcad..ac19719c4837f 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 @@ -70,15 +70,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -235,77 +226,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -322,10 +308,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -336,12 +322,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -350,8 +332,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -689,29 +670,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -724,44 +689,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("%c%s%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(7)), + ? (args.splice(env, 4, format.slice(7)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -885,7 +843,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -983,14 +940,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1019,22 +968,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1394,7 +1327,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2499,16 +2432,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2612,8 +2539,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2630,12 +2555,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -2938,7 +2862,7 @@ if ("number" !== typeof info.time) if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -2997,11 +2921,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, task, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); } } @@ -3086,7 +3010,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( @@ -3151,7 +3075,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3175,130 +3100,86 @@ request.completedErrorChunks.push(task); } } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3310,13 +3191,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3330,7 +3212,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3343,7 +3225,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3381,7 +3264,8 @@ } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -4174,55 +4058,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -4825,10 +4693,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -4851,30 +4715,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 9dfe551f0a7f8..89599515bf7dc 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 @@ -842,8 +842,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -919,8 +919,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -1818,7 +1818,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1836,44 +1837,40 @@ function finishAbortedTask(task, request, errorId) { (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (12 > request.status && @@ -1883,8 +1880,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -1902,7 +1899,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), scheduleWork(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -1915,7 +1913,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1928,7 +1926,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1962,11 +1961,12 @@ function abort(request, reason) { } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$23) { - logRecoverableError(request, error$23, null), - fatalError(request, error$23); + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); } } function resolveServerReference(bundlerConfig, id) { @@ -2423,8 +2423,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$26 = createPendingChunk(response); - chunk$26.then( + var chunk$27 = createPendingChunk(response); + chunk$27.then( function (v) { return controller.enqueue(v); }, @@ -2432,10 +2432,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$26; + previousBlockedChunk = chunk$27; chunk.then(function () { - previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); - resolveModelChunk(chunk$26, json, -1); + previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); + resolveModelChunk(chunk$27, json, -1); }); } }, 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 cb36963a5e10c..2e9e9c3acd922 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 @@ -74,15 +74,6 @@ } return !0; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } function stringToChunk(content) { return textEncoder.encode(content); } @@ -239,77 +230,72 @@ ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -326,10 +312,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -340,12 +326,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -354,8 +336,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -696,29 +677,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -731,44 +696,37 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(19)), + ? (args.splice(env, 4, format.slice(19)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - JSCompiler_inline_result = stringToChunk( - ":W" + previousPrepare + "\n" - ); - request.completedDebugChunks.push(JSCompiler_inline_result); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + stack = stringToChunk(":W" + args + "\n"); + request.completedDebugChunks.push(stack); } return originalMethod.apply(this, arguments); }; @@ -892,7 +850,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -995,14 +952,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1031,22 +980,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1406,7 +1339,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2570,16 +2503,10 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(stringToChunk(json)), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(stringToChunk(id))) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(stringToChunk(id))); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + id = stringToChunk(id); + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2683,8 +2610,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2701,12 +2626,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -3009,7 +2933,7 @@ if ("number" !== typeof info.time) if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3068,11 +2992,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, task, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); } } @@ -3157,7 +3081,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( @@ -3222,7 +3146,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3246,130 +3171,86 @@ request.completedErrorChunks.push(task); } } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.close(), (request.debugDestination = null)), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.close(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.close(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.close(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3385,13 +3266,14 @@ }, 0); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -3405,7 +3287,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3418,7 +3300,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3456,7 +3339,8 @@ } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -4245,55 +4129,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } stringBuffer = _ref[_ref.length - 1]; @@ -4926,10 +4794,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -4952,30 +4816,6 @@ signal.addEventListener("abort", listener); } } - void 0 !== debugChannelWritable && - new ReadableStream( - { - type: "bytes", - pull: function (controller) { - if (13 === request.status) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.debugDestination - ) { - request.debugDestination = controller; - try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 cb83daf3a9fa8..722543c30f1f9 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 @@ -841,8 +841,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -918,8 +918,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -1819,7 +1819,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1837,44 +1838,40 @@ function finishAbortedTask(task, request, errorId) { (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - request.pendingChunks--, - writeChunkAndReturn(destination, importsChunks[i]); - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - writeChunkAndReturn(destination, hintChunks[i]); - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, regularChunks[i]); - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - request.pendingChunks--, - writeChunkAndReturn(destination, errorChunks[i]); - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - (destination.enqueue( - new Uint8Array(currentView.buffer, 0, writtenBytes) - ), - (currentView = null), - (writtenBytes = 0)); - } +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + request.pendingChunks--, + writeChunkAndReturn(destination, importsChunks[i]); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + writeChunkAndReturn(destination, hintChunks[i]); + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + request.pendingChunks--, + writeChunkAndReturn(destination, regularChunks[i]); + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + request.pendingChunks--, writeChunkAndReturn(destination, errorChunks[i]); + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + (destination.enqueue( + new Uint8Array(currentView.buffer, 0, writtenBytes) + ), + (currentView = null), + (writtenBytes = 0)); } 0 === request.pendingChunks && (12 > request.status && @@ -1884,8 +1881,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.close(), (request.destination = null))); + destination.close(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -1907,7 +1904,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setTimeout(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); }, 0)); } function callOnAllReadyIfReady(request) { @@ -1920,7 +1918,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1933,7 +1931,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1967,11 +1966,12 @@ function abort(request, reason) { } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$23) { - logRecoverableError(request, error$23, null), - fatalError(request, error$23); + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); } } function resolveServerReference(bundlerConfig, id) { @@ -2419,8 +2419,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$26 = createPendingChunk(response); - chunk$26.then( + var chunk$27 = createPendingChunk(response); + chunk$27.then( function (v) { return controller.enqueue(v); }, @@ -2428,10 +2428,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$26; + previousBlockedChunk = chunk$27; chunk.then(function () { - previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); - resolveModelChunk(chunk$26, json, -1); + previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); + resolveModelChunk(chunk$27, json, -1); }); } }, 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 48bb3b1200a3f..471463a0aa0cf 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 @@ -41,9 +41,6 @@ : (obj[key] = value); return obj; } - function flushBuffered(destination) { - "function" === typeof destination.flush && destination.flush(); - } function writeToDestination(destination, view) { destination = destination.write(view); destinationHasCapacity = destinationHasCapacity && destination; @@ -110,14 +107,6 @@ (writtenBytes = 0)))); return destinationHasCapacity; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)); - currentView = null; - writtenBytes = 0; - destinationHasCapacity = !0; - } function byteLengthOfChunk(chunk) { return "string" === typeof chunk ? Buffer.byteLength(chunk, "utf8") @@ -273,77 +262,72 @@ var owner = componentStorage.getStore(); return owner ? owner : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -360,10 +344,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -374,12 +358,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -388,8 +368,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -722,29 +701,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -757,41 +720,36 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(19)), + ? (args.splice(env, 4, format.slice(19)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - request.completedDebugChunks.push(":W" + previousPrepare + "\n"); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + request.completedDebugChunks.push(":W" + args + "\n"); } return originalMethod.apply(this, arguments); }; @@ -915,7 +873,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1015,14 +972,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1051,22 +1000,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1425,7 +1358,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2553,16 +2486,9 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2662,8 +2588,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2680,12 +2604,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -2987,7 +2910,7 @@ if ("number" !== typeof info.time) if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3045,11 +2968,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, task, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); } } @@ -3139,7 +3062,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( @@ -3205,7 +3128,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3229,134 +3153,87 @@ request.completedErrorChunks.push(task); } } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - flushBuffered(debugDestination); - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } - flushBuffered(debugDestination); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.end(), (request.debugDestination = null)), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.end(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.end(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.end(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3368,13 +3245,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3387,19 +3265,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), fatalError(request, error); - } - } - } - function startFlowingDebug(request, debugDestination) { - if (13 === request.status) - (request.status = CLOSED), debugDestination.destroy(request.fatalError); - else if (request.status !== CLOSED && null === request.debugDestination) { - request.debugDestination = debugDestination; - try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3412,7 +3278,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3450,7 +3317,8 @@ } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3466,55 +3334,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } function closeDebugChannel(request) { @@ -4344,25 +4196,6 @@ stream.on("error", onError), stream.on("end", onClose)); } - function createFakeWritableFromWebSocket(webSocket) { - return { - write: function (chunk) { - webSocket.send(chunk); - return !0; - }, - end: function () { - webSocket.close(); - }, - destroy: function (reason) { - "object" === typeof reason && - null !== reason && - (reason = reason.message); - "string" === typeof reason - ? webSocket.close(1011, reason) - : webSocket.close(1011); - } - }; - } function createFakeWritableFromReadableStreamController(controller) { return { write: function (chunk) { @@ -5019,12 +4852,12 @@ "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_226 = []; + var JSCompiler_object_inline_chunks_214 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_226.push(chunk); + JSCompiler_object_inline_chunks_214.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_226, { + var blob = new Blob(JSCompiler_object_inline_chunks_214, { type: mimeType }); response._formData.append(name, blob, filename); @@ -5073,21 +4906,7 @@ }; exports.renderToPipeableStream = function (model, webpackMap, options) { var debugChannel = options ? options.debugChannel : void 0, - debugChannelReadable = - void 0 === debugChannel || - ("function" !== typeof debugChannel.read && - "number" !== typeof debugChannel.readyState) - ? void 0 - : debugChannel; - debugChannel = - void 0 !== debugChannel - ? "function" === typeof debugChannel.write - ? debugChannel - : "function" === typeof debugChannel.send - ? createFakeWritableFromWebSocket(debugChannel) - : void 0 - : void 0; - var request = createRequest( + request = createRequest( model, webpackMap, options ? options.onError : void 0, @@ -5096,13 +4915,12 @@ options ? options.temporaryReferences : void 0, options ? options.environmentName : void 0, options ? options.filterStackFrame : void 0, - void 0 !== debugChannelReadable + void 0 !== debugChannel ), hasStartedFlowing = !1; startWork(request); - void 0 !== debugChannel && startFlowingDebug(request, debugChannel); - void 0 !== debugChannelReadable && - startReadingFromDebugChannelReadable(request, debugChannelReadable); + void 0 !== debugChannel && + startReadingFromDebugChannelReadable(request, debugChannel); return { pipe: function (destination) { if (hasStartedFlowing) @@ -5119,14 +4937,10 @@ "The destination stream errored while writing data." ) ); - if (void 0 === debugChannelReadable) - destination.on( - "close", - createCancelHandler( - request, - "The destination stream closed early." - ) - ); + destination.on( + "close", + createCancelHandler(request, "The destination stream closed early.") + ); return destination; }, abort: function (reason) { @@ -5139,10 +4953,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -5165,22 +4975,6 @@ signal.addEventListener("abort", listener); } } - if (void 0 !== debugChannelWritable) { - var debugWritable; - new ReadableStream( - { - type: "bytes", - start: function (controller) { - debugWritable = - createFakeWritableFromReadableStreamController(controller); - }, - pull: function () { - startFlowingDebug(request, debugWritable); - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); - } void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 7dbdde39bbd74..b4c903487ee92 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 @@ -864,8 +864,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -941,8 +941,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -1829,7 +1829,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1847,68 +1848,65 @@ function finishAbortedTask(task, request, errorId) { (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, importsChunks[i])) - ) { - request.destination = null; - i++; - break; - } - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - if (!writeChunkAndReturn(destination, hintChunks[i])) { - request.destination = null; - i++; - break; - } - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, regularChunks[i])) - ) { - request.destination = null; - i++; - break; - } - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, errorChunks[i])) - ) { - request.destination = null; - i++; - break; - } - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)), - (currentView = null), - (writtenBytes = 0), - (destinationHasCapacity = !0); - } - "function" === typeof destination.flush && destination.flush(); +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; + } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && (12 > request.status && request.cacheController.abort( @@ -1917,8 +1915,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.end(), (request.destination = null))); + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -1936,7 +1934,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -1949,7 +1948,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1962,7 +1961,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1996,11 +1996,12 @@ function abort(request, reason) { } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$23) { - logRecoverableError(request, error$23, null), - fatalError(request, error$23); + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); } } function resolveServerReference(bundlerConfig, id) { @@ -2448,8 +2449,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$26 = createPendingChunk(response); - chunk$26.then( + var chunk$27 = createPendingChunk(response); + chunk$27.then( function (v) { return controller.enqueue(v); }, @@ -2457,10 +2458,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$26; + previousBlockedChunk = chunk$27; chunk.then(function () { - previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); - resolveModelChunk(chunk$26, json, -1); + previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); + resolveModelChunk(chunk$27, json, -1); }); } }, @@ -2881,12 +2882,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_262 = []; + var JSCompiler_object_inline_chunks_253 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_262.push(chunk); + JSCompiler_object_inline_chunks_253.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_262, { + var blob = new Blob(JSCompiler_object_inline_chunks_253, { type: mimeType }); response._formData.append(name, blob, filename); 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 4f43dbb5da1ed..9bbbd5df2af34 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 @@ -41,9 +41,6 @@ : (obj[key] = value); return obj; } - function flushBuffered(destination) { - "function" === typeof destination.flush && destination.flush(); - } function writeToDestination(destination, view) { destination = destination.write(view); destinationHasCapacity = destinationHasCapacity && destination; @@ -110,14 +107,6 @@ (writtenBytes = 0)))); return destinationHasCapacity; } - function completeWriting(destination) { - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)); - currentView = null; - writtenBytes = 0; - destinationHasCapacity = !0; - } function byteLengthOfChunk(chunk) { return "string" === typeof chunk ? Buffer.byteLength(chunk, "utf8") @@ -273,77 +262,72 @@ var owner = componentStorage.getStore(); return owner ? owner : null; } - function collectStackTracePrivate(error, structuredStackTrace) { - error = []; - for (var i = framesToSkip; i < structuredStackTrace.length; i++) { + function collectStackTrace(error, structuredStackTrace) { + for ( + var result = [], i = framesToSkip; + i < structuredStackTrace.length; + i++ + ) { var callSite = structuredStackTrace[i], - name = callSite.getFunctionName() || ""; - if (name.includes("react_stack_bottom_frame")) break; - else if (callSite.isNative()) - (callSite = callSite.isAsync()), - error.push([name, "", 0, 0, 0, 0, callSite]); + _name = callSite.getFunctionName() || ""; + if (_name.includes("react_stack_bottom_frame")) break; + else if (callSite.isNative()) result.push([_name, "", 0, 0, 0, 0]); else { - if (callSite.isConstructor()) name = "new " + name; + if (callSite.isConstructor()) _name = "new " + _name; else if (!callSite.isToplevel()) { var callSite$jscomp$0 = callSite; - name = callSite$jscomp$0.getTypeName(); + _name = callSite$jscomp$0.getTypeName(); var methodName = callSite$jscomp$0.getMethodName(); callSite$jscomp$0 = callSite$jscomp$0.getFunctionName(); - var result = ""; + var result$jscomp$0 = ""; callSite$jscomp$0 - ? (name && + ? (_name && identifierRegExp.test(callSite$jscomp$0) && - callSite$jscomp$0 !== name && - (result += name + "."), - (result += callSite$jscomp$0), + callSite$jscomp$0 !== _name && + (result$jscomp$0 += _name + "."), + (result$jscomp$0 += callSite$jscomp$0), !methodName || callSite$jscomp$0 === methodName || callSite$jscomp$0.endsWith("." + methodName) || callSite$jscomp$0.endsWith(" " + methodName) || - (result += " [as " + methodName + "]")) - : (name && (result += name + "."), - (result = methodName - ? result + methodName - : result + "")); - name = result; + (result$jscomp$0 += " [as " + methodName + "]")) + : (_name && (result$jscomp$0 += _name + "."), + (result$jscomp$0 = methodName + ? result$jscomp$0 + methodName + : result$jscomp$0 + "")); + _name = result$jscomp$0; } - "" === name && (name = ""); + "" === _name && (_name = ""); methodName = callSite.getScriptNameOrSourceURL() || ""; - "" === methodName && - ((methodName = ""), - callSite.isEval() && - (callSite$jscomp$0 = callSite.getEvalOrigin()) && - (methodName = callSite$jscomp$0.toString() + ", ")); + "" === methodName && (methodName = ""); + callSite.isEval() && + !methodName && + (callSite$jscomp$0 = callSite.getEvalOrigin()) && + (methodName = callSite$jscomp$0.toString() + ", "); callSite$jscomp$0 = callSite.getLineNumber() || 0; - result = callSite.getColumnNumber() || 0; + result$jscomp$0 = callSite.getColumnNumber() || 0; var enclosingLine = - "function" === typeof callSite.getEnclosingLineNumber - ? callSite.getEnclosingLineNumber() || 0 - : 0, - enclosingCol = - "function" === typeof callSite.getEnclosingColumnNumber - ? callSite.getEnclosingColumnNumber() || 0 - : 0; - callSite = callSite.isAsync(); - error.push([ - name, + "function" === typeof callSite.getEnclosingLineNumber + ? callSite.getEnclosingLineNumber() || 0 + : 0; + callSite = + "function" === typeof callSite.getEnclosingColumnNumber + ? callSite.getEnclosingColumnNumber() || 0 + : 0; + result.push([ + _name, methodName, callSite$jscomp$0, - result, + result$jscomp$0, enclosingLine, - enclosingCol, callSite ]); } } - collectedStackTrace = error; - return ""; - } - function collectStackTrace(error, structuredStackTrace) { - collectStackTracePrivate(error, structuredStackTrace); error = (error.name || "Error") + ": " + (error.message || ""); - for (var i = 0; i < structuredStackTrace.length; i++) + for (i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); + collectedStackTrace = result; return error; } function parseStackTrace(error, skipFrames) { @@ -360,10 +344,10 @@ } if (null !== collectedStackTrace) return ( - (stack = collectedStackTrace), + (skipFrames = collectedStackTrace), (collectedStackTrace = null), - stackTraceCache.set(error, stack), - stack + stackTraceCache.set(error, skipFrames), + skipFrames ); stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); @@ -374,12 +358,8 @@ for (existing = []; skipFrames < stack.length; skipFrames++) { var parsed = frameRegExp.exec(stack[skipFrames]); if (parsed) { - var name = parsed[1] || "", - isAsync = "async " === parsed[8]; - "" === name - ? (name = "") - : name.startsWith("async ") && - ((name = name.slice(5)), (isAsync = !0)); + var name = parsed[1] || ""; + "" === name && (name = ""); var filename = parsed[2] || parsed[5] || ""; "" === filename && (filename = ""); existing.push([ @@ -388,8 +368,7 @@ +(parsed[3] || parsed[6]), +(parsed[4] || parsed[7]), 0, - 0, - isAsync + 0 ]); } } @@ -722,29 +701,13 @@ var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { - a: { - var error = Error("react-stack-top-frame"); - collectedStackTrace = null; - framesToSkip = 1; - var previousPrepare = Error.prepareStackTrace; - Error.prepareStackTrace = collectStackTracePrivate; - try { - if ("" !== error.stack) { - var JSCompiler_inline_result = null; - break a; - } - } finally { - Error.prepareStackTrace = previousPrepare; - } - JSCompiler_inline_result = collectedStackTrace; - } - JSCompiler_inline_result = filterStackTrace( + var stack = filterStackTrace( request, - JSCompiler_inline_result || [] + parseStackTrace(Error("react-stack-top-frame"), 1) ); request.pendingDebugChunks++; - error = resolveOwner(); - previousPrepare = Array.from(arguments); + var owner = resolveOwner(), + args = Array.from(arguments); a: { var env = 0; switch (methodName) { @@ -757,41 +720,36 @@ case "assert": env = 1; } - var format = previousPrepare[env], - style = previousPrepare[env + 1], - badge = previousPrepare[env + 2]; + var format = args[env], + style = args[env + 1], + badge = args[env + 2]; "string" === typeof format && format.startsWith("\u001b[0m\u001b[7m%c%s\u001b[0m%c ") && "background: #e6e6e6;background: light-dark(rgba(0,0,0,0.1), rgba(255,255,255,0.25));color: #000000;color: light-dark(#000000, #ffffff);border-radius: 2px" === style && "string" === typeof badge - ? (previousPrepare.splice(env, 4, format.slice(19)), + ? (args.splice(env, 4, format.slice(19)), (env = badge.slice(1, badge.length - 1))) : (env = null); } null === env && (env = (0, request.environmentName)()); - null != error && outlineComponentInfo(request, error); - format = [methodName, JSCompiler_inline_result, error, env]; - format.push.apply(format, previousPrepare); - previousPrepare = serializeDebugModel( + null != owner && outlineComponentInfo(request, owner); + format = [methodName, stack, owner, env]; + format.push.apply(format, args); + args = serializeDebugModel( request, - (null === request.deferredDebugObjects ? 500 : 10) + - JSCompiler_inline_result.length, + (null === request.deferredDebugObjects ? 500 : 10) + stack.length, format ); - "[" !== previousPrepare[0] && - (previousPrepare = serializeDebugModel( - request, - 10 + JSCompiler_inline_result.length, - [ - methodName, - JSCompiler_inline_result, - error, - env, - "Unknown Value: React could not send it from the server." - ] - )); - request.completedDebugChunks.push(":W" + previousPrepare + "\n"); + "[" !== args[0] && + (args = serializeDebugModel(request, 10 + stack.length, [ + methodName, + stack, + owner, + env, + "Unknown Value: React could not send it from the server." + ])); + request.completedDebugChunks.push(":W" + args + "\n"); } return originalMethod.apply(this, arguments); }; @@ -915,7 +873,6 @@ this.onFatalError = onFatalError; this.pendingDebugChunks = 0; this.completedDebugChunks = []; - this.debugDestination = null; this.environmentName = void 0 === environmentName ? function () { @@ -1015,14 +972,6 @@ } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; - var deferredDebugObjects = request.deferredDebugObjects; - if (null !== deferredDebugObjects) - return ( - deferredDebugObjects.retained.set(id, thenable), - (ref = "$Y@" + id.toString(16)), - request.writtenDebugObjects.set(thenable, ref), - ref - ); var cancelled = !1; thenable.then( function (value) { @@ -1051,22 +1000,6 @@ }); return ref; } - function emitRequestedDebugThenable(request, id, counter, thenable) { - thenable.then( - function (value) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitOutlinedDebugModelChunk(request, id, counter, value); - enqueueFlush(request); - }, - function (reason) { - request.status === ABORTING - ? emitDebugHaltChunk(request, id) - : emitErrorChunk(request, id, "", reason, !0); - enqueueFlush(request); - } - ); - } function serializeThenable(request, task, thenable) { var newTask = createTask( request, @@ -1425,7 +1358,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -2553,16 +2486,9 @@ request.completedDebugChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var json = serializeDebugModel(request, 500, debugInfo); - null !== request.debugDestination - ? ((debugInfo = request.nextChunkId++), - (json = debugInfo.toString(16) + ":" + json + "\n"), - request.pendingDebugChunks++, - request.completedDebugChunks.push(json), - (id = id.toString(16) + ':D"$' + debugInfo.toString(16) + '"\n'), - request.completedRegularChunks.push(id)) - : ((id = id.toString(16) + ":D" + json + "\n"), - request.completedRegularChunks.push(id)); + debugInfo = serializeDebugModel(request, 500, debugInfo); + id = id.toString(16) + ":D" + debugInfo + "\n"; + request.completedDebugChunks.push(id); } function outlineComponentInfo(request, componentInfo) { if (!request.writtenDebugObjects.has(componentInfo)) { @@ -2662,8 +2588,6 @@ ((existingDebugReference = tempRef.get(parent)), void 0 !== existingDebugReference) ) { - if (0 >= counter.objectLimit && !doNotLimit.has(value)) - return serializeDeferredObject(request, value); var propertyName = parentPropertyName; if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE) switch (parentPropertyName) { @@ -2680,12 +2604,11 @@ propertyName = "_owner"; } tempRef.set(value, existingDebugReference + ":" + propertyName); - } else if (debugNoOutline !== value) { - if ("function" === typeof value.then) - return serializeDebugThenable(request, counter, value); - request = outlineDebugModel(request, counter, value); - return serializeByValueID(request); - } + } else if (debugNoOutline !== value) + return ( + (request = outlineDebugModel(request, counter, value)), + serializeByValueID(request) + ); parent = request.writtenObjects.get(value); if (void 0 !== parent) return parent; if (0 >= counter.objectLimit && !doNotLimit.has(value)) @@ -2987,7 +2910,7 @@ if ("number" !== typeof info.time) if ("string" === typeof info.name) outlineComponentInfo(request$jscomp$1, info), - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); else if (info.awaited) { var ioInfo = info.awaited; @@ -3045,11 +2968,11 @@ null != info.env && (ioInfo.env = info.env); null != info.owner && (ioInfo.owner = info.owner); null != request && (ioInfo.stack = request); - request$jscomp$1.pendingChunks++; + request$jscomp$1.pendingDebugChunks++; emitDebugChunk(request$jscomp$1, task, ioInfo); } } else - request$jscomp$1.pendingChunks++, + request$jscomp$1.pendingDebugChunks++, emitDebugChunk(request$jscomp$1, task, info); } } @@ -3139,7 +3062,7 @@ task.implicitSlot = !1; var currentEnv = (0, request.environmentName)(); currentEnv !== task.environmentName && - (request.pendingChunks++, + (request.pendingDebugChunks++, emitDebugChunk(request, task.id, { env: currentEnv })); if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( @@ -3205,7 +3128,8 @@ request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -3229,134 +3153,87 @@ request.completedErrorChunks.push(task); } } - function flushCompletedChunks(request) { - if (null !== request.debugDestination) { - var debugDestination = request.debugDestination; - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var debugChunks = request.completedDebugChunks, i = 0; - i < debugChunks.length; - i++ - ) - request.pendingDebugChunks--, - writeChunkAndReturn(debugDestination, debugChunks[i]); - debugChunks.splice(0, i); - } finally { - completeWriting(debugDestination); - } - flushBuffered(debugDestination); - } - debugDestination = request.destination; - if (null !== debugDestination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - var importsChunks = request.completedImportChunks; - for ( - debugChunks = 0; - debugChunks < importsChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - importsChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - importsChunks.splice(0, debugChunks); - var hintChunks = request.completedHintChunks; - for (debugChunks = 0; debugChunks < hintChunks.length; debugChunks++) - if ( - !writeChunkAndReturn(debugDestination, hintChunks[debugChunks]) - ) { - request.destination = null; - debugChunks++; - break; - } - hintChunks.splice(0, debugChunks); - if (null === request.debugDestination) { - var _debugChunks = request.completedDebugChunks; - for ( - debugChunks = 0; - debugChunks < _debugChunks.length; - debugChunks++ - ) - if ( - (request.pendingDebugChunks--, - !writeChunkAndReturn( - debugDestination, - _debugChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - _debugChunks.splice(0, debugChunks); + function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; } - var regularChunks = request.completedRegularChunks; - for ( - debugChunks = 0; - debugChunks < regularChunks.length; - debugChunks++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn( - debugDestination, - regularChunks[debugChunks] - )) - ) { - request.destination = null; - debugChunks++; - break; - } - regularChunks.splice(0, debugChunks); - var errorChunks = request.completedErrorChunks; - for (debugChunks = 0; debugChunks < errorChunks.length; debugChunks++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(debugDestination, errorChunks[debugChunks])) - ) { - request.destination = null; - debugChunks++; - break; - } - errorChunks.splice(0, debugChunks); - } finally { - (request.flushScheduled = !1), completeWriting(debugDestination); - } - flushBuffered(debugDestination); + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var debugChunks = request.completedDebugChunks; + for (i = 0; i < debugChunks.length; i++) + if ( + (request.pendingDebugChunks--, + !writeChunkAndReturn(destination, debugChunks[i])) + ) { + request.destination = null; + i++; + break; + } + debugChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && - ((importsChunks = request.debugDestination), - 0 === request.pendingDebugChunks - ? (null !== importsChunks && - (importsChunks.end(), (request.debugDestination = null)), - request.status < ABORTING && - request.cacheController.abort( - Error( - "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." - ) - ), - (request.status = CLOSED), - null !== request.destination && - (request.destination.end(), (request.destination = null)), - null !== request.debugDestination && - (request.debugDestination.end(), - (request.debugDestination = null))) - : null !== importsChunks && - null !== request.destination && - (request.destination.end(), (request.destination = null))); + 0 === request.pendingDebugChunks && + (request.status < ABORTING && + request.cacheController.abort( + Error( + "This render completed successfully. All cacheSignals are now aborted to allow clean up of any unused resources." + ) + ), + (request.status = CLOSED), + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -3368,13 +3245,14 @@ }); } function enqueueFlush(request) { - !1 !== request.flushScheduled || - 0 !== request.pingedTasks.length || - (null === request.destination && null === request.debugDestination) || + !1 === request.flushScheduled && + 0 === request.pingedTasks.length && + null !== request.destination && ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -3387,19 +3265,7 @@ else if (request.status !== CLOSED && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); - } catch (error) { - logRecoverableError(request, error, null), fatalError(request, error); - } - } - } - function startFlowingDebug(request, debugDestination) { - if (13 === request.status) - (request.status = CLOSED), debugDestination.destroy(request.fatalError); - else if (request.status !== CLOSED && null === request.debugDestination) { - request.debugDestination = debugDestination; - try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3412,7 +3278,8 @@ }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -3450,7 +3317,8 @@ } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } } catch (error$2) { logRecoverableError(request, error$2, null), @@ -3466,55 +3334,39 @@ throw Error( "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); - if ("" === message) closeDebugChannel(request); - else { - var command = message.charCodeAt(0); - message = message.slice(2).split(",").map(fromHex); - switch (command) { - case 82: - for (command = 0; command < message.length; command++) { - var id = message[command], - retainedValue = deferredDebugObjects.retained.get(id); + var command = message.charCodeAt(0); + message = message.slice(2).split(",").map(fromHex); + switch (command) { + case 82: + for (command = 0; command < message.length; command++) { + var id = message[command], + retainedValue = deferredDebugObjects.retained.get(id); + void 0 !== retainedValue && + (request.pendingDebugChunks--, + deferredDebugObjects.retained.delete(id), + deferredDebugObjects.existing.delete(retainedValue), + enqueueFlush(request)); + } + break; + case 81: + for (command = 0; command < message.length; command++) + (id = message[command]), + (retainedValue = deferredDebugObjects.retained.get(id)), void 0 !== retainedValue && - (request.pendingDebugChunks--, - deferredDebugObjects.retained.delete(id), + (deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), + emitOutlinedDebugModelChunk( + request, + id, + { objectLimit: 10 }, + retainedValue + ), enqueueFlush(request)); - } - break; - case 81: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - deferredDebugObjects.existing.delete(retainedValue), - emitOutlinedDebugModelChunk( - request, - id, - { objectLimit: 10 }, - retainedValue - ), - enqueueFlush(request)); - break; - case 80: - for (command = 0; command < message.length; command++) - (id = message[command]), - (retainedValue = deferredDebugObjects.retained.get(id)), - void 0 !== retainedValue && - (deferredDebugObjects.retained.delete(id), - emitRequestedDebugThenable( - request, - id, - { objectLimit: 10 }, - retainedValue - )); - break; - default: - throw Error( - "Unknown command. The debugChannel was not wired up properly." - ); - } + break; + default: + throw Error( + "Unknown command. The debugChannel was not wired up properly." + ); } } function closeDebugChannel(request) { @@ -4307,25 +4159,6 @@ stream.on("error", onError), stream.on("end", onClose)); } - function createFakeWritableFromWebSocket(webSocket) { - return { - write: function (chunk) { - webSocket.send(chunk); - return !0; - }, - end: function () { - webSocket.close(); - }, - destroy: function (reason) { - "object" === typeof reason && - null !== reason && - (reason = reason.message); - "string" === typeof reason - ? webSocket.close(1011, reason) - : webSocket.close(1011); - } - }; - } function createFakeWritableFromReadableStreamController(controller) { return { write: function (chunk) { @@ -4982,12 +4815,12 @@ "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_226 = []; + var JSCompiler_object_inline_chunks_214 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_226.push(chunk); + JSCompiler_object_inline_chunks_214.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_226, { + var blob = new Blob(JSCompiler_object_inline_chunks_214, { type: mimeType }); response._formData.append(name, blob, filename); @@ -5036,21 +4869,7 @@ }; exports.renderToPipeableStream = function (model, webpackMap, options) { var debugChannel = options ? options.debugChannel : void 0, - debugChannelReadable = - void 0 === debugChannel || - ("function" !== typeof debugChannel.read && - "number" !== typeof debugChannel.readyState) - ? void 0 - : debugChannel; - debugChannel = - void 0 !== debugChannel - ? "function" === typeof debugChannel.write - ? debugChannel - : "function" === typeof debugChannel.send - ? createFakeWritableFromWebSocket(debugChannel) - : void 0 - : void 0; - var request = createRequest( + request = createRequest( model, webpackMap, options ? options.onError : void 0, @@ -5059,13 +4878,12 @@ options ? options.temporaryReferences : void 0, options ? options.environmentName : void 0, options ? options.filterStackFrame : void 0, - void 0 !== debugChannelReadable + void 0 !== debugChannel ), hasStartedFlowing = !1; startWork(request); - void 0 !== debugChannel && startFlowingDebug(request, debugChannel); - void 0 !== debugChannelReadable && - startReadingFromDebugChannelReadable(request, debugChannelReadable); + void 0 !== debugChannel && + startReadingFromDebugChannelReadable(request, debugChannel); return { pipe: function (destination) { if (hasStartedFlowing) @@ -5082,14 +4900,10 @@ "The destination stream errored while writing data." ) ); - if (void 0 === debugChannelReadable) - destination.on( - "close", - createCancelHandler( - request, - "The destination stream closed early." - ) - ); + destination.on( + "close", + createCancelHandler(request, "The destination stream closed early.") + ); return destination; }, abort: function (reason) { @@ -5102,10 +4916,6 @@ options && options.debugChannel ? options.debugChannel.readable : void 0, - debugChannelWritable = - options && options.debugChannel - ? options.debugChannel.writable - : void 0, request = createRequest( model, webpackMap, @@ -5128,22 +4938,6 @@ signal.addEventListener("abort", listener); } } - if (void 0 !== debugChannelWritable) { - var debugWritable; - new ReadableStream( - { - type: "bytes", - start: function (controller) { - debugWritable = - createFakeWritableFromReadableStreamController(controller); - }, - pull: function () { - startFlowingDebug(request, debugWritable); - } - }, - { highWaterMark: 0 } - ).pipeTo(debugChannelWritable); - } void 0 !== debugChannelReadable && startReadingFromDebugChannelReadableStream( request, 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 9ddbe3537b2a7..9aa5560c07c62 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 @@ -864,8 +864,8 @@ function serializeReadableStream(request, task, stream) { tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$9) { + error(x$9); } } function error(reason) { @@ -941,8 +941,8 @@ function serializeAsyncIterable(request, task, iterable, iterator) { tryStreamTask(request, streamTask), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$10) { + error(x$10); } } function error(reason) { @@ -1829,7 +1829,8 @@ function performWork(request) { request.pingedTasks = []; for (var i = 0; i < pingedTasks.length; i++) retryTask(request, pingedTasks[i]); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } finally { @@ -1847,68 +1848,65 @@ function finishAbortedTask(task, request, errorId) { (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function flushCompletedChunks(request) { - var destination = request.destination; - if (null !== destination) { - currentView = new Uint8Array(2048); - writtenBytes = 0; - destinationHasCapacity = !0; - try { - for ( - var importsChunks = request.completedImportChunks, i = 0; - i < importsChunks.length; - i++ - ) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, importsChunks[i])) - ) { - request.destination = null; - i++; - break; - } - importsChunks.splice(0, i); - var hintChunks = request.completedHintChunks; - for (i = 0; i < hintChunks.length; i++) - if (!writeChunkAndReturn(destination, hintChunks[i])) { - request.destination = null; - i++; - break; - } - hintChunks.splice(0, i); - var regularChunks = request.completedRegularChunks; - for (i = 0; i < regularChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, regularChunks[i])) - ) { - request.destination = null; - i++; - break; - } - regularChunks.splice(0, i); - var errorChunks = request.completedErrorChunks; - for (i = 0; i < errorChunks.length; i++) - if ( - (request.pendingChunks--, - !writeChunkAndReturn(destination, errorChunks[i])) - ) { - request.destination = null; - i++; - break; - } - errorChunks.splice(0, i); - } finally { - (request.flushScheduled = !1), - currentView && - 0 < writtenBytes && - destination.write(currentView.subarray(0, writtenBytes)), - (currentView = null), - (writtenBytes = 0), - (destinationHasCapacity = !0); - } - "function" === typeof destination.flush && destination.flush(); +function flushCompletedChunks(request, destination) { + currentView = new Uint8Array(2048); + writtenBytes = 0; + destinationHasCapacity = !0; + try { + for ( + var importsChunks = request.completedImportChunks, i = 0; + i < importsChunks.length; + i++ + ) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, importsChunks[i])) + ) { + request.destination = null; + i++; + break; + } + importsChunks.splice(0, i); + var hintChunks = request.completedHintChunks; + for (i = 0; i < hintChunks.length; i++) + if (!writeChunkAndReturn(destination, hintChunks[i])) { + request.destination = null; + i++; + break; + } + hintChunks.splice(0, i); + var regularChunks = request.completedRegularChunks; + for (i = 0; i < regularChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, regularChunks[i])) + ) { + request.destination = null; + i++; + break; + } + regularChunks.splice(0, i); + var errorChunks = request.completedErrorChunks; + for (i = 0; i < errorChunks.length; i++) + if ( + (request.pendingChunks--, + !writeChunkAndReturn(destination, errorChunks[i])) + ) { + request.destination = null; + i++; + break; + } + errorChunks.splice(0, i); + } finally { + (request.flushScheduled = !1), + currentView && + 0 < writtenBytes && + destination.write(currentView.subarray(0, writtenBytes)), + (currentView = null), + (writtenBytes = 0), + (destinationHasCapacity = !0); } + "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && (12 > request.status && request.cacheController.abort( @@ -1917,8 +1915,8 @@ function flushCompletedChunks(request) { ) ), (request.status = 14), - null !== request.destination && - (request.destination.end(), (request.destination = null))); + destination.end(), + (request.destination = null)); } function startWork(request) { request.flushScheduled = null !== request.destination; @@ -1936,7 +1934,8 @@ function enqueueFlush(request) { ((request.flushScheduled = !0), setImmediate(function () { request.flushScheduled = !1; - flushCompletedChunks(request); + var destination = request.destination; + destination && flushCompletedChunks(request, destination); })); } function callOnAllReadyIfReady(request) { @@ -1949,7 +1948,7 @@ function startFlowing(request, destination) { else if (14 !== request.status && null === request.destination) { request.destination = destination; try { - flushCompletedChunks(request); + flushCompletedChunks(request, destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1962,7 +1961,8 @@ function finishAbort(request, abortedTasks, errorId) { }); var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } catch (error) { logRecoverableError(request, error, null), fatalError(request, error); } @@ -1996,11 +1996,12 @@ function abort(request, reason) { } else { var onAllReady = request.onAllReady; onAllReady(); - flushCompletedChunks(request); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - } catch (error$23) { - logRecoverableError(request, error$23, null), - fatalError(request, error$23); + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); } } function resolveServerReference(bundlerConfig, id) { @@ -2414,8 +2415,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$26 = createPendingChunk(response); - chunk$26.then( + var chunk$27 = createPendingChunk(response); + chunk$27.then( function (v) { return controller.enqueue(v); }, @@ -2423,10 +2424,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$26; + previousBlockedChunk = chunk$27; chunk.then(function () { - previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); - resolveModelChunk(chunk$26, json, -1); + previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); + resolveModelChunk(chunk$27, json, -1); }); } }, @@ -2847,12 +2848,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_262 = []; + var JSCompiler_object_inline_chunks_253 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_262.push(chunk); + JSCompiler_object_inline_chunks_253.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_262, { + var blob = new Blob(JSCompiler_object_inline_chunks_253, { type: mimeType }); response._formData.append(name, blob, filename); 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 d3d26b01ba53c..fd279038c78cd 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/package.json +++ b/packages/next/src/compiled/react-server-dom-webpack/package.json @@ -64,8 +64,8 @@ "webpack-sources": "^3.2.0" }, "peerDependencies": { - "react": "19.2.0-canary-97cdd5d3-20250710", - "react-dom": "19.2.0-canary-97cdd5d3-20250710", + "react": "19.2.0-canary-e6ed827a-20250715", + "react-dom": "19.2.0-canary-e6ed827a-20250715", "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 5c01316dcd552..d96496f6b56b9 100644 --- a/packages/next/src/compiled/react/cjs/react.development.js +++ b/packages/next/src/compiled/react/cjs/react.development.js @@ -1244,7 +1244,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; "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 753c749f36f2d..8a525e8fd12ef 100644 --- a/packages/next/src/compiled/react/cjs/react.production.js +++ b/packages/next/src/compiled/react/cjs/react.production.js @@ -543,4 +543,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; 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 8d196c908a572..2b2203462a8d2 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 @@ -816,5 +816,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.2.0-canary-97cdd5d3-20250710"; + exports.version = "19.2.0-canary-e6ed827a-20250715"; })(); 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 5bf26c003fed9..27cdf34a72fd5 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 @@ -430,4 +430,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.2.0-canary-97cdd5d3-20250710"; +exports.version = "19.2.0-canary-e6ed827a-20250715"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0c837f4de426..a86019d63359c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -522,7 +522,7 @@ importers: version: react-server-dom-webpack@0.0.0-experimental-97cdd5d3-20250710(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))) react-ssr-prepass: specifier: 1.0.8 - version: 1.0.8(react-is@19.2.0-canary-cee7939b-20250625)(react@19.2.0-canary-97cdd5d3-20250710) + version: 1.0.8(react-is@19.2.0-canary-97cdd5d3-20250710)(react@19.2.0-canary-97cdd5d3-20250710) react-virtualized: specifier: 9.22.3 version: 9.22.3(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710) @@ -657,13 +657,13 @@ importers: dependencies: '@mantine/core': specifier: ^7.10.1 - version: 7.10.1(@mantine/hooks@7.11.2(react@19.2.0-canary-cee7939b-20250625))(@types/react@19.1.8)(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625) + version: 7.10.1(@mantine/hooks@7.11.2(react@19.2.0-canary-97cdd5d3-20250710))(@types/react@19.1.8)(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710) lodash-es: specifier: ^4.17.21 version: 4.17.21 lucide-react: specifier: ^0.383.0 - version: 0.383.0(react@19.2.0-canary-cee7939b-20250625) + version: 0.383.0(react@19.2.0-canary-97cdd5d3-20250710) mermaid: specifier: ^10.9.1 version: 10.9.1 @@ -1687,7 +1687,7 @@ importers: version: 2.2.1(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))) '@mdx-js/react': specifier: '>=0.15.0' - version: 2.2.1(react@19.2.0-canary-cee7939b-20250625) + version: 2.2.1(react@19.2.0-canary-97cdd5d3-20250710) source-map: specifier: ^0.7.0 version: 0.7.3 @@ -14093,17 +14093,9 @@ packages: peerDependencies: react: 19.2.0-canary-97cdd5d3-20250710 - react-dom@19.2.0-canary-cee7939b-20250625: - resolution: {integrity: sha512-cKXbvGw8b+t+uxJZfNBK0oboEee5wYS3f8Yeu22PlW3eECtfDnM2pqSbcB6LvOVr3fyDMM4CIWesK01d9BXj7w==} - peerDependencies: - react: 19.2.0-canary-97cdd5d3-20250710 - react-is@19.2.0-canary-97cdd5d3-20250710: resolution: {integrity: sha512-1Kdr0n+A2wNuBRB0GHhwxbFmioBupZTGuBrfxlpmu8Bke3w1fip1UTvxf6FQ0ZUmD2e/J7nt1mQSdeYi4enIUQ==} - react-is@19.2.0-canary-cee7939b-20250625: - resolution: {integrity: sha512-AsmZ5fWwYOQXykkjT/OBo2n30UH+014Jefhv9qiKxuw8AqD5QMi47Px3Fw86YLtZPOxWQOsvVMqHKwFvW35Q/w==} - react-lifecycles-compat@3.0.4: resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==} @@ -14213,10 +14205,6 @@ packages: resolution: {integrity: sha512-9StLMcfivak/J0uBvmuCMHjtuiWlEjG5ZGADq0mr5rxIQBacm+dCvFSP4lYTCvPgGKr4IgYPrszFh2A+tQwoVg==} engines: {node: '>=0.10.0'} - react@19.2.0-canary-cee7939b-20250625: - resolution: {integrity: sha512-MDouKrROK4xfih07q2fuBiofvnV1oSPs5Bm/+vulj3XCTG1FiGaG45tmWV0re0w9sRj8wi84rEXMIw1Gw3/IVg==} - engines: {node: '>=0.10.0'} - read-cache@1.0.0: resolution: {integrity: sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==} @@ -18934,11 +18922,11 @@ snapshots: '@floating-ui/core': 1.7.2 '@floating-ui/utils': 0.2.10 - '@floating-ui/react-dom@2.1.0(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625)': + '@floating-ui/react-dom@2.1.0(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710)': dependencies: '@floating-ui/dom': 1.6.5 - react: 19.2.0-canary-cee7939b-20250625 - react-dom: 19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + react-dom: 19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710) '@floating-ui/react-dom@2.1.4(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710)': dependencies: @@ -18946,12 +18934,12 @@ snapshots: react: 19.2.0-canary-97cdd5d3-20250710 react-dom: 19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710) - '@floating-ui/react@0.26.16(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625)': + '@floating-ui/react@0.26.16(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710)': dependencies: - '@floating-ui/react-dom': 2.1.0(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625) + '@floating-ui/react-dom': 2.1.0(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710) '@floating-ui/utils': 0.2.2 - react: 19.2.0-canary-cee7939b-20250625 - react-dom: 19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + react-dom: 19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710) tabbable: 6.2.0 '@floating-ui/utils@0.2.10': {} @@ -20024,23 +20012,23 @@ snapshots: dependencies: call-bind: 1.0.7 - '@mantine/core@7.10.1(@mantine/hooks@7.11.2(react@19.2.0-canary-cee7939b-20250625))(@types/react@19.1.8)(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625)': + '@mantine/core@7.10.1(@mantine/hooks@7.11.2(react@19.2.0-canary-97cdd5d3-20250710))(@types/react@19.1.8)(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710)': dependencies: - '@floating-ui/react': 0.26.16(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625) - '@mantine/hooks': 7.11.2(react@19.2.0-canary-cee7939b-20250625) + '@floating-ui/react': 0.26.16(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710) + '@mantine/hooks': 7.11.2(react@19.2.0-canary-97cdd5d3-20250710) clsx: 2.1.1 - react: 19.2.0-canary-cee7939b-20250625 - react-dom: 19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625) - react-number-format: 5.4.0(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625) - react-remove-scroll: 2.5.10(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) - react-textarea-autosize: 8.5.3(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + react-dom: 19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710) + react-number-format: 5.4.0(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710) + react-remove-scroll: 2.5.10(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) + react-textarea-autosize: 8.5.3(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) type-fest: 4.18.3 transitivePeerDependencies: - '@types/react' - '@mantine/hooks@7.11.2(react@19.2.0-canary-cee7939b-20250625)': + '@mantine/hooks@7.11.2(react@19.2.0-canary-97cdd5d3-20250710)': dependencies: - react: 19.2.0-canary-cee7939b-20250625 + react: 19.2.0-canary-97cdd5d3-20250710 '@manypkg/find-root@1.1.0': dependencies: @@ -20109,12 +20097,6 @@ snapshots: '@types/react': 19.1.8 react: 19.2.0-canary-97cdd5d3-20250710 - '@mdx-js/react@2.2.1(react@19.2.0-canary-cee7939b-20250625)': - dependencies: - '@types/mdx': 2.0.3 - '@types/react': 19.1.8 - react: 19.2.0-canary-cee7939b-20250625 - '@mdx-js/react@3.1.0(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710)': dependencies: '@types/mdx': 2.0.3 @@ -29139,9 +29121,9 @@ snapshots: lru-cache@7.18.3: {} - lucide-react@0.383.0(react@19.2.0-canary-cee7939b-20250625): + lucide-react@0.383.0(react@19.2.0-canary-97cdd5d3-20250710): dependencies: - react: 19.2.0-canary-cee7939b-20250625 + react: 19.2.0-canary-97cdd5d3-20250710 lz-string@1.5.0: {} @@ -32361,41 +32343,34 @@ snapshots: react: 19.2.0-canary-97cdd5d3-20250710 scheduler: 0.27.0-canary-97cdd5d3-20250710 - react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625): - dependencies: - react: 19.2.0-canary-cee7939b-20250625 - scheduler: 0.27.0-canary-97cdd5d3-20250710 - react-is@19.2.0-canary-97cdd5d3-20250710: {} - react-is@19.2.0-canary-cee7939b-20250625: {} - react-lifecycles-compat@3.0.4: {} - react-number-format@5.4.0(react-dom@19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625))(react@19.2.0-canary-cee7939b-20250625): + react-number-format@5.4.0(react-dom@19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710))(react@19.2.0-canary-97cdd5d3-20250710): dependencies: prop-types: 15.8.1 - react: 19.2.0-canary-cee7939b-20250625 - react-dom: 19.2.0-canary-cee7939b-20250625(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + react-dom: 19.2.0-canary-97cdd5d3-20250710(react@19.2.0-canary-97cdd5d3-20250710) react-refresh@0.12.0: {} - react-remove-scroll-bar@2.3.6(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + react-remove-scroll-bar@2.3.6(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: - react: 19.2.0-canary-cee7939b-20250625 - react-style-singleton: 2.2.1(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + react-style-singleton: 2.2.1(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) tslib: 2.8.1 optionalDependencies: '@types/react': 19.1.8 - react-remove-scroll@2.5.10(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + react-remove-scroll@2.5.10(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: - react: 19.2.0-canary-cee7939b-20250625 - react-remove-scroll-bar: 2.3.6(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) - react-style-singleton: 2.2.1(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + react-remove-scroll-bar: 2.3.6(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) + react-style-singleton: 2.2.1(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) tslib: 2.8.1 - use-callback-ref: 1.3.2(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) - use-sidecar: 1.1.2(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) + use-callback-ref: 1.3.2(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) + use-sidecar: 1.1.2(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) optionalDependencies: '@types/react': 19.1.8 @@ -32437,17 +32412,17 @@ snapshots: react: 19.2.0-canary-97cdd5d3-20250710 react-is: 19.2.0-canary-97cdd5d3-20250710 - react-ssr-prepass@1.0.8(react-is@19.2.0-canary-cee7939b-20250625)(react@19.2.0-canary-97cdd5d3-20250710): + react-ssr-prepass@1.0.8(react-is@19.2.0-canary-97cdd5d3-20250710)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: object-is: 1.0.2 react: 19.2.0-canary-97cdd5d3-20250710 - react-is: 19.2.0-canary-cee7939b-20250625 + react-is: 19.2.0-canary-97cdd5d3-20250710 - react-style-singleton@2.2.1(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + react-style-singleton@2.2.1(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: get-nonce: 1.0.1 invariant: 2.2.4 - react: 19.2.0-canary-cee7939b-20250625 + react: 19.2.0-canary-97cdd5d3-20250710 tslib: 2.8.1 optionalDependencies: '@types/react': 19.1.8 @@ -32459,12 +32434,12 @@ snapshots: react-shallow-renderer: 16.15.0(react@19.2.0-canary-97cdd5d3-20250710) scheduler: 0.27.0-canary-97cdd5d3-20250710 - react-textarea-autosize@8.5.3(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + react-textarea-autosize@8.5.3(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: '@babel/runtime': 7.27.0 - react: 19.2.0-canary-cee7939b-20250625 - use-composed-ref: 1.3.0(react@19.2.0-canary-cee7939b-20250625) - use-latest: 1.2.1(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + use-composed-ref: 1.3.0(react@19.2.0-canary-97cdd5d3-20250710) + use-latest: 1.2.1(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) transitivePeerDependencies: - '@types/react' @@ -32483,8 +32458,6 @@ snapshots: react@19.2.0-canary-97cdd5d3-20250710: {} - react@19.2.0-canary-cee7939b-20250625: {} - read-cache@1.0.0: dependencies: pify: 2.3.0 @@ -35048,34 +35021,34 @@ snapshots: punycode: 1.4.1 qs: 6.13.1 - use-callback-ref@1.3.2(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + use-callback-ref@1.3.2(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: - react: 19.2.0-canary-cee7939b-20250625 + react: 19.2.0-canary-97cdd5d3-20250710 tslib: 2.8.1 optionalDependencies: '@types/react': 19.1.8 - use-composed-ref@1.3.0(react@19.2.0-canary-cee7939b-20250625): + use-composed-ref@1.3.0(react@19.2.0-canary-97cdd5d3-20250710): dependencies: - react: 19.2.0-canary-cee7939b-20250625 + react: 19.2.0-canary-97cdd5d3-20250710 - use-isomorphic-layout-effect@1.1.2(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + use-isomorphic-layout-effect@1.1.2(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: - react: 19.2.0-canary-cee7939b-20250625 + react: 19.2.0-canary-97cdd5d3-20250710 optionalDependencies: '@types/react': 19.1.8 - use-latest@1.2.1(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + use-latest@1.2.1(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: - react: 19.2.0-canary-cee7939b-20250625 - use-isomorphic-layout-effect: 1.1.2(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625) + react: 19.2.0-canary-97cdd5d3-20250710 + use-isomorphic-layout-effect: 1.1.2(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710) optionalDependencies: '@types/react': 19.1.8 - use-sidecar@1.1.2(@types/react@19.1.8)(react@19.2.0-canary-cee7939b-20250625): + use-sidecar@1.1.2(@types/react@19.1.8)(react@19.2.0-canary-97cdd5d3-20250710): dependencies: detect-node-es: 1.1.0 - react: 19.2.0-canary-cee7939b-20250625 + react: 19.2.0-canary-97cdd5d3-20250710 tslib: 2.8.1 optionalDependencies: '@types/react': 19.1.8