diff --git a/.github/workflows/update_react.yml b/.github/workflows/update_react.yml index a7949380477d5c..672c7614548fb2 100644 --- a/.github/workflows/update_react.yml +++ b/.github/workflows/update_react.yml @@ -26,12 +26,12 @@ jobs: with: # Commits made with the default `GITHUB_TOKEN` won't trigger workflows. # See: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow - token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} + token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }} - name: Set Git author run: | - git config user.name "nextjs-bot" - git config user.email "it+nextjs-bot@vercel.com" + git config user.name "vercel-release-bot" + git config user.email "infra+release@vercel.com" - name: Setup node uses: actions/setup-node@v4 @@ -53,4 +53,4 @@ jobs: shell: bash run: pnpm sync-react --actor "${{ github.actor }}" --commit --create-pull --version "${{ inputs.version }}" env: - GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }} diff --git a/package.json b/package.json index 2ae50e4438d4c9..d55ac63da4f4a3 100644 --- a/package.json +++ b/package.json @@ -233,16 +233,16 @@ "pretty-ms": "7.0.0", "random-seed": "0.3.0", "react": "19.0.0", - "react-builtin": "npm:react@19.2.0-canary-5d87cd22-20250704", + "react-builtin": "npm:react@19.2.0-canary-223f81d8-20250707", "react-dom": "19.0.0", - "react-dom-builtin": "npm:react-dom@19.2.0-canary-5d87cd22-20250704", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-5d87cd22-20250704", - "react-experimental-builtin": "npm:react@0.0.0-experimental-5d87cd22-20250704", - "react-is-builtin": "npm:react-is@19.2.0-canary-5d87cd22-20250704", - "react-server-dom-turbopack": "19.2.0-canary-5d87cd22-20250704", - "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-5d87cd22-20250704", - "react-server-dom-webpack": "19.2.0-canary-5d87cd22-20250704", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-5d87cd22-20250704", + "react-dom-builtin": "npm:react-dom@19.2.0-canary-223f81d8-20250707", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-223f81d8-20250707", + "react-experimental-builtin": "npm:react@0.0.0-experimental-223f81d8-20250707", + "react-is-builtin": "npm:react-is@19.2.0-canary-223f81d8-20250707", + "react-server-dom-turbopack": "19.2.0-canary-223f81d8-20250707", + "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-223f81d8-20250707", + "react-server-dom-webpack": "19.2.0-canary-223f81d8-20250707", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-223f81d8-20250707", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -252,8 +252,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.12.2", - "scheduler-builtin": "npm:scheduler@0.27.0-canary-5d87cd22-20250704", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-5d87cd22-20250704", + "scheduler-builtin": "npm:scheduler@0.27.0-canary-223f81d8-20250707", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-223f81d8-20250707", "seedrandom": "3.0.5", "semver": "7.3.7", "serve-handler": "6.1.6", @@ -297,10 +297,10 @@ "@types/react-dom": "19.1.2", "@types/retry": "0.12.0", "jest-snapshot": "30.0.0-alpha.6", - "react": "19.2.0-canary-5d87cd22-20250704", - "react-dom": "19.2.0-canary-5d87cd22-20250704", - "react-is": "19.2.0-canary-5d87cd22-20250704", - "scheduler": "0.27.0-canary-5d87cd22-20250704" + "react": "19.2.0-canary-223f81d8-20250707", + "react-dom": "19.2.0-canary-223f81d8-20250707", + "react-is": "19.2.0-canary-223f81d8-20250707", + "scheduler": "0.27.0-canary-223f81d8-20250707" }, "patchedDependencies": { "webpack-sources@3.2.3": "patches/webpack-sources@3.2.3.patch", 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 8f1dec0e88527d..9e6d5bf92f721a 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 @@ -31105,11 +31105,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -31146,10 +31146,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704" + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -31295,7 +31295,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.2.0-experimental-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; "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 c5204de63a1a6d..3002e652fbc7c3 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 @@ -19253,14 +19253,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2169 = React.version; if ( - "19.2.0-experimental-5d87cd22-20250704" !== + "19.2.0-experimental-223f81d8-20250707" !== isomorphicReactPackageVersion$jscomp$inline_2169 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2169, - "19.2.0-experimental-5d87cd22-20250704" + "19.2.0-experimental-223f81d8-20250707" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19282,10 +19282,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2854 = { bundleType: 0, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704" + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2855 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -19392,4 +19392,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-experimental-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 124fc826c6dc5c..51a3820efb5064 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 @@ -31157,11 +31157,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -31198,10 +31198,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704" + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -31677,7 +31677,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-experimental-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; "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 170b6f25f90ad0..4289015a50af38 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 @@ -20935,14 +20935,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2391 = React.version; if ( - "19.2.0-experimental-5d87cd22-20250704" !== + "19.2.0-experimental-223f81d8-20250707" !== isomorphicReactPackageVersion$jscomp$inline_2391 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2391, - "19.2.0-experimental-5d87cd22-20250704" + "19.2.0-experimental-223f81d8-20250707" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -20964,10 +20964,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_3078 = { bundleType: 0, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704" + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_3079 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -21234,7 +21234,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-experimental-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; "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 24e04b79fd4376..6e376a0fe3a625 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 @@ -4955,14 +4955,16 @@ if ("number" === typeof info.time) break; if (null != info.awaited) { var bestStack = null == info.debugStack ? info.awaited : info; - void 0 !== bestStack.debugStack && - ((task.componentStack = { + if (void 0 !== bestStack.debugStack) { + task.componentStack = { parent: task.componentStack, type: info, owner: bestStack.owner, stack: bestStack.debugStack - }), - (task.debugTask = bestStack.debugTask)); + }; + task.debugTask = bestStack.debugTask; + break; + } } } } @@ -10486,5 +10488,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-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 971ac53610e583..726828713966b3 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 @@ -7107,4 +7107,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-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 a146d7ed064f1d..eb228dc956d052 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 @@ -4955,14 +4955,16 @@ if ("number" === typeof info.time) break; if (null != info.awaited) { var bestStack = null == info.debugStack ? info.awaited : info; - void 0 !== bestStack.debugStack && - ((task.componentStack = { + if (void 0 !== bestStack.debugStack) { + task.componentStack = { parent: task.componentStack, type: info, owner: bestStack.owner, stack: bestStack.debugStack - }), - (task.debugTask = bestStack.debugTask)); + }; + task.debugTask = bestStack.debugTask; + break; + } } } } @@ -10486,5 +10488,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-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 25776c40c85271..ea551cca1ea1a8 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 @@ -7210,4 +7210,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-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 55f32008be7c94..4de28e33d96bb0 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 @@ -5329,14 +5329,16 @@ if ("number" === typeof info.time) break; if (null != info.awaited) { var bestStack = null == info.debugStack ? info.awaited : info; - void 0 !== bestStack.debugStack && - ((task.componentStack = { + if (void 0 !== bestStack.debugStack) { + task.componentStack = { parent: task.componentStack, type: info, owner: bestStack.owner, stack: bestStack.debugStack - }), - (task.debugTask = bestStack.debugTask)); + }; + task.debugTask = bestStack.debugTask; + break; + } } } } @@ -9477,11 +9479,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -11300,5 +11302,5 @@ startWork(request); }); }; - exports.version = "19.2.0-experimental-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 4f85582e31f628..2f9f28028365a4 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 @@ -7772,12 +7772,12 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.2.0-experimental-5d87cd22-20250704" + "19.2.0-experimental-223f81d8-20250707" ) ); } @@ -8032,4 +8032,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.2.0-experimental-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 b67015ec843b2f..ddc1a3c1793bbe 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 @@ -7257,13 +7257,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_868 = React.version; if ( - "19.2.0-experimental-5d87cd22-20250704" !== + "19.2.0-experimental-223f81d8-20250707" !== isomorphicReactPackageVersion$jscomp$inline_868 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_868 + - "\n - react-dom: 19.2.0-experimental-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -7354,4 +7354,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-experimental-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 f83db66081de33..a8f45d37ddf9d1 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 @@ -5345,14 +5345,16 @@ if ("number" === typeof info.time) break; if (null != info.awaited) { var bestStack = null == info.debugStack ? info.awaited : info; - void 0 !== bestStack.debugStack && - ((task.componentStack = { + if (void 0 !== bestStack.debugStack) { + task.componentStack = { parent: task.componentStack, type: info, owner: bestStack.owner, stack: bestStack.debugStack - }), - (task.debugTask = bestStack.debugTask)); + }; + task.debugTask = bestStack.debugTask; + break; + } } } } @@ -9506,11 +9508,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -11325,5 +11327,5 @@ startWork(request); }); }; - exports.version = "19.2.0-experimental-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 4d5c2eb5b4384b..a2e973bfb49b7a 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 @@ -7890,11 +7890,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -8148,4 +8148,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.2.0-experimental-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 80ea7b845d39a7..c057d74d023227 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 @@ -5231,14 +5231,16 @@ if ("number" === typeof info.time) break; if (null != info.awaited) { var bestStack = null == info.debugStack ? info.awaited : info; - void 0 !== bestStack.debugStack && - ((task.componentStack = { + if (void 0 !== bestStack.debugStack) { + task.componentStack = { parent: task.componentStack, type: info, owner: bestStack.owner, stack: bestStack.debugStack - }), - (task.debugTask = bestStack.debugTask)); + }; + task.debugTask = bestStack.debugTask; + break; + } } } } @@ -9367,11 +9369,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -11496,5 +11498,5 @@ } }; }; - exports.version = "19.2.0-experimental-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 95e7c24f765a03..aa953e254c264a 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 @@ -7770,11 +7770,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -8332,4 +8332,4 @@ exports.resumeToPipeableStream = function (children, postponedState, options) { } }; }; -exports.version = "19.2.0-experimental-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 f163cfba965201..7ea7435239279d 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 @@ -31426,11 +31426,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-experimental-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-experimental-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-experimental-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -31467,10 +31467,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704" + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -31782,5 +31782,5 @@ } }; }; - exports.version = "19.2.0-experimental-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 f58ec05fe501ea..a14b22fd7e7b48 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 @@ -19569,14 +19569,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_2198 = React.version; if ( - "19.2.0-experimental-5d87cd22-20250704" !== + "19.2.0-experimental-223f81d8-20250707" !== isomorphicReactPackageVersion$jscomp$inline_2198 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_2198, - "19.2.0-experimental-5d87cd22-20250704" + "19.2.0-experimental-223f81d8-20250707" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -19598,10 +19598,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2888 = { bundleType: 0, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704" + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2889 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -19859,4 +19859,4 @@ exports.observeVisibleRects = function ( } }; }; -exports.version = "19.2.0-experimental-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 1187f354619f8d..b9be02e3c90c7d 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-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; "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 17878f91de0167..e1b9a705bb8eb4 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-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 c9ca27a72ba1f4..5206c87c1a4368 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-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 13d1c8d0c3a035..63332336880b9f 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-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; diff --git a/packages/next/src/compiled/react-dom-experimental/package.json b/packages/next/src/compiled/react-dom-experimental/package.json index 39ea95c00b3cd6..ba4df06e92dd19 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-5d87cd22-20250704" + "scheduler": "0.0.0-experimental-223f81d8-20250707" }, "peerDependencies": { - "react": "0.0.0-experimental-5d87cd22-20250704" + "react": "0.0.0-experimental-223f81d8-20250707" }, "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 d1dd34e7aa89d2..f5f3252106325a 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 @@ -25503,11 +25503,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25544,10 +25544,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-canary-5d87cd22-20250704", + version: "19.2.0-canary-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-5d87cd22-20250704" + reconcilerVersion: "19.2.0-canary-223f81d8-20250707" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25685,7 +25685,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.2.0-canary-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; "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 ad4db26322662d..8ae232ac9eba40 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 @@ -15712,14 +15712,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1838 = React.version; if ( - "19.2.0-canary-5d87cd22-20250704" !== + "19.2.0-canary-223f81d8-20250707" !== isomorphicReactPackageVersion$jscomp$inline_1838 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1838, - "19.2.0-canary-5d87cd22-20250704" + "19.2.0-canary-223f81d8-20250707" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15741,10 +15741,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2331 = { bundleType: 0, - version: "19.2.0-canary-5d87cd22-20250704", + version: "19.2.0-canary-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-5d87cd22-20250704" + reconcilerVersion: "19.2.0-canary-223f81d8-20250707" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2332 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15842,4 +15842,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.2.0-canary-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 c7f7c1765047be..56c404fe569777 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 @@ -25555,11 +25555,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25596,10 +25596,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.2.0-canary-5d87cd22-20250704", + version: "19.2.0-canary-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-5d87cd22-20250704" + reconcilerVersion: "19.2.0-canary-223f81d8-20250707" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -26067,7 +26067,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.2.0-canary-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; "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 c2ee39220524a5..a52f485ca28cfa 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 @@ -16413,14 +16413,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1942 = React.version; if ( - "19.2.0-canary-5d87cd22-20250704" !== + "19.2.0-canary-223f81d8-20250707" !== isomorphicReactPackageVersion$jscomp$inline_1942 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1942, - "19.2.0-canary-5d87cd22-20250704" + "19.2.0-canary-223f81d8-20250707" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -16442,10 +16442,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_1949 = { bundleType: 0, - version: "19.2.0-canary-5d87cd22-20250704", + version: "19.2.0-canary-223f81d8-20250707", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-5d87cd22-20250704", + reconcilerVersion: "19.2.0-canary-223f81d8-20250707", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$281 = 0; @@ -16718,7 +16718,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.2.0-canary-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; "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 0c92c5f8c706a7..8a24d7f1ca57f5 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 @@ -9687,5 +9687,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-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; })(); 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 81fe3e16e4d5ce..ec1d3b26351154 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 @@ -6456,4 +6456,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-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 a77c8fc5361d9a..3a62075d1e4693 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 @@ -9687,5 +9687,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-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; })(); 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 15f037d88e35b9..5f5bdb3fd0d7c4 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 @@ -6539,4 +6539,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-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 f28122583d49f4..dd7dd73a8e08bf 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 @@ -8436,11 +8436,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -10130,5 +10130,5 @@ startWork(request); }); }; - exports.version = "19.2.0-canary-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; })(); 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 05a0b4a3767136..49df734148c7c8 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 @@ -6842,12 +6842,12 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.2.0-canary-5d87cd22-20250704" + "19.2.0-canary-223f81d8-20250707" ) ); } @@ -6994,4 +6994,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 aa12cd73701ac9..f3f3bfd12b0e85 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 @@ -6487,13 +6487,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_815 = React.version; if ( - "19.2.0-canary-5d87cd22-20250704" !== + "19.2.0-canary-223f81d8-20250707" !== isomorphicReactPackageVersion$jscomp$inline_815 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_815 + - "\n - react-dom: 19.2.0-canary-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -6584,4 +6584,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 c5797a5c1f40a7..59faa75f4d042b 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 @@ -8459,11 +8459,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -10149,5 +10149,5 @@ startWork(request); }); }; - exports.version = "19.2.0-canary-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; })(); 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 6246e7835e5dc8..2b4e82de5f3d36 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 @@ -6940,11 +6940,11 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -7090,4 +7090,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 681b84377e042a..ccf232d738b918 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 @@ -8334,11 +8334,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -10209,5 +10209,5 @@ startWork(request); }); }; - exports.version = "19.2.0-canary-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; })(); 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 e7cf3718bdde71..524dc9d0a461d7 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 @@ -6832,11 +6832,11 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.2.0-canary-5d87cd22-20250704" !== isomorphicReactPackageVersion) + if ("19.2.0-canary-223f81d8-20250707" !== 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-5d87cd22-20250704\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.2.0-canary-223f81d8-20250707\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -7174,4 +7174,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.2.0-canary-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 e3fc68e238fb24..cf66d2c9978b3d 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-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; "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 a455e88f927b89..2ae8cb7644c2ac 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-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 70673f3ca7579f..d8165cd13f803e 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-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; })(); 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 44482c73932a32..aabecb3e80c622 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-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; diff --git a/packages/next/src/compiled/react-dom/package.json b/packages/next/src/compiled/react-dom/package.json index 328423e3cb16a9..6690d5ed63f696 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-5d87cd22-20250704" + "scheduler": "0.27.0-canary-223f81d8-20250707" }, "peerDependencies": { - "react": "19.2.0-canary-5d87cd22-20250704" + "react": "19.2.0-canary-223f81d8-20250707" }, "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 48781d0ff0c290..33f70390e2a0a0 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-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; "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 5d37d46efa9ba8..3173fb60e2f095 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-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; 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 82a55fa4ce06e6..6275a677b1b0d2 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-5d87cd22-20250704"; + exports.version = "19.2.0-experimental-223f81d8-20250707"; })(); 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 41d6b645d67faf..c4bedf913066b5 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-5d87cd22-20250704"; +exports.version = "19.2.0-experimental-223f81d8-20250707"; diff --git a/packages/next/src/compiled/react-is/package.json b/packages/next/src/compiled/react-is/package.json index c0544569faccd5..b51504467dc3b1 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-5d87cd22-20250704", + "version": "19.2.0-canary-223f81d8-20250707", "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 717b0879e42ec0..0884df7443e418 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 @@ -759,7 +759,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1362,6 +1362,17 @@ this._children = []; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1381,9 +1392,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function createErrorChunk(response, error) { return new ReactPromise("rejected", null, error); } @@ -1462,15 +1491,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1493,6 +1521,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1503,15 +1532,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1556,24 +1586,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); - response._replayConsole && - (markAllTracksInOrder(), - flushComponentPerformance( - response, - getChunk(response, 0), - 0, - -Infinity, - -Infinity - )); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1649,7 +1674,7 @@ chunk || ((chunk = response._closed ? createErrorChunk(response, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1735,31 +1760,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1806,17 +1831,18 @@ response._debugFindSourceMapURL ); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -1829,7 +1855,7 @@ deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -1892,7 +1918,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2272,6 +2298,9 @@ this._closedReason = null; this._tempRefs = temporaryReferences; this._timeOrigin = 0; + this._pendingInitialRender = null; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2288,18 +2317,23 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2309,18 +2343,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2330,39 +2366,41 @@ response._bundlerConfig, model ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2399,7 +2437,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2464,7 +2502,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2537,11 +2575,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2584,7 +2622,7 @@ reason.$$typeof = REACT_POSTPONE_TYPE; stack = response._chunks; (env = stack.get(id)) - ? triggerErrorOnChunk(env, reason) + ? triggerErrorOnChunk(response, env, reason) : stack.set(id, createErrorChunk(response, reason)); } function resolveHint(response, code, model) { @@ -3059,9 +3097,8 @@ previousResult.track = trackIdx$jscomp$6; return previousResult; } - var children = root._children; - "resolved_model" === root.status && initializeModelChunk(root); - var debugInfo = root._debugInfo; + var children = root._children, + debugInfo = root._debugInfo; if (debugInfo) { for (var startTime$jscomp$0 = 0, i = 0; i < debugInfo.length; i++) { var info = debugInfo[i]; @@ -3521,6 +3558,20 @@ result.endTime = childrenEndTime; return result; } + function flushInitialRenderPerformance(response) { + if (response._replayConsole) { + var rootChunk = getChunk(response, 0); + isArrayImpl(rootChunk._children) && + (markAllTracksInOrder(), + flushComponentPerformance( + response, + rootChunk, + 0, + -Infinity, + -Infinity + )); + } + } function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -3591,7 +3642,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, createErrorChunk(response, tag)); break; case 84: @@ -3755,96 +3806,99 @@ options ? !1 !== options.replayConsoleLogs : !0, options && options.environmentName ? options.environmentName : void 0, debugChannel - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -3950,7 +4004,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, initializingChunk = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), @@ -4062,10 +4120,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704", + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -4080,12 +4138,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + 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 f8b35fb0bfe0c3..5bb209a744e166 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 @@ -647,15 +647,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -684,15 +682,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -736,11 +734,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -831,14 +830,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -879,17 +879,18 @@ function loadServerReference(response, metaData, parentObject, key) { if (!response._serverReferenceConfig) return createBoundServerReference(metaData, response._callServer); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -902,7 +903,7 @@ function loadServerReference(response, metaData, parentObject, key) { deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -940,7 +941,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1210,24 +1211,24 @@ function resolveModule(response, id, model) { chunk = chunks.get(id); model = JSON.parse(model, response._fromJSON); var clientReference = resolveClientReference(response._bundlerConfig, model); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1417,7 +1418,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1569,7 +1570,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; case 84: @@ -1610,7 +1611,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.stack = "Error: " + buffer.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; default: 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 90356c210a156a..ece8d2f54c19e8 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 @@ -879,7 +879,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1574,6 +1574,17 @@ this._children = []; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1593,9 +1604,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function createErrorChunk(response, error) { return new ReactPromise("rejected", null, error); } @@ -1674,15 +1703,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1705,6 +1733,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1715,15 +1744,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1768,24 +1798,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); - response._replayConsole && - (markAllTracksInOrder(), - flushComponentPerformance( - response, - getChunk(response, 0), - 0, - -Infinity, - -Infinity - )); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1861,7 +1886,7 @@ chunk || ((chunk = response._closed ? createErrorChunk(response, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1947,31 +1972,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -2111,7 +2136,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2491,6 +2516,9 @@ this._closedReason = null; this._tempRefs = temporaryReferences; this._timeOrigin = 0; + this._pendingInitialRender = null; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2507,18 +2535,23 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2528,18 +2561,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2554,39 +2589,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2623,7 +2660,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2688,7 +2725,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2761,11 +2798,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2808,7 +2845,7 @@ reason.$$typeof = REACT_POSTPONE_TYPE; stack = response._chunks; (env = stack.get(id)) - ? triggerErrorOnChunk(env, reason) + ? triggerErrorOnChunk(response, env, reason) : stack.set(id, createErrorChunk(response, reason)); } function resolveHint(response, code, model) { @@ -3283,9 +3320,8 @@ previousResult.track = trackIdx$jscomp$6; return previousResult; } - var children = root._children; - "resolved_model" === root.status && initializeModelChunk(root); - var debugInfo = root._debugInfo; + var children = root._children, + debugInfo = root._debugInfo; if (debugInfo) { for (var startTime$jscomp$0 = 0, i = 0; i < debugInfo.length; i++) { var info = debugInfo[i]; @@ -3745,6 +3781,20 @@ result.endTime = childrenEndTime; return result; } + function flushInitialRenderPerformance(response) { + if (response._replayConsole) { + var rootChunk = getChunk(response, 0); + isArrayImpl(rootChunk._children) && + (markAllTracksInOrder(), + flushComponentPerformance( + response, + rootChunk, + 0, + -Infinity, + -Infinity + )); + } + } function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -3815,7 +3865,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, createErrorChunk(response, tag)); break; case 84: @@ -3967,96 +4017,99 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -4165,7 +4218,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, initializingChunk = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), @@ -4275,12 +4332,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall); 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 b4703a820224ca..0cf71382fe948e 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 @@ -817,15 +817,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -854,15 +852,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -906,11 +904,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -1001,14 +1000,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1125,7 +1125,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1400,24 +1400,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1607,7 +1607,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1759,7 +1759,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; case 84: @@ -1800,7 +1800,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.stack = "Error: " + buffer.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; default: 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 e055a4bc708c71..2b95d5f4fb3727 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 @@ -879,7 +879,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1574,6 +1574,17 @@ this._children = []; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1593,9 +1604,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function createErrorChunk(response, error) { return new ReactPromise("rejected", null, error); } @@ -1674,15 +1703,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1705,6 +1733,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1715,15 +1744,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1768,24 +1798,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); - response._replayConsole && - (markAllTracksInOrder(), - flushComponentPerformance( - response, - getChunk(response, 0), - 0, - -Infinity, - -Infinity - )); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1861,7 +1886,7 @@ chunk || ((chunk = response._closed ? createErrorChunk(response, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1947,31 +1972,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -2111,7 +2136,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2491,6 +2516,9 @@ this._closedReason = null; this._tempRefs = temporaryReferences; this._timeOrigin = 0; + this._pendingInitialRender = null; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2507,18 +2535,23 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2528,18 +2561,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2554,39 +2589,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2623,7 +2660,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2688,7 +2725,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2761,11 +2798,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2808,7 +2845,7 @@ reason.$$typeof = REACT_POSTPONE_TYPE; stack = response._chunks; (env = stack.get(id)) - ? triggerErrorOnChunk(env, reason) + ? triggerErrorOnChunk(response, env, reason) : stack.set(id, createErrorChunk(response, reason)); } function resolveHint(response, code, model) { @@ -3283,9 +3320,8 @@ previousResult.track = trackIdx$jscomp$6; return previousResult; } - var children = root._children; - "resolved_model" === root.status && initializeModelChunk(root); - var debugInfo = root._debugInfo; + var children = root._children, + debugInfo = root._debugInfo; if (debugInfo) { for (var startTime$jscomp$0 = 0, i = 0; i < debugInfo.length; i++) { var info = debugInfo[i]; @@ -3745,6 +3781,20 @@ result.endTime = childrenEndTime; return result; } + function flushInitialRenderPerformance(response) { + if (response._replayConsole) { + var rootChunk = getChunk(response, 0); + isArrayImpl(rootChunk._children) && + (markAllTracksInOrder(), + flushComponentPerformance( + response, + rootChunk, + 0, + -Infinity, + -Infinity + )); + } + } function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -3815,7 +3865,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, createErrorChunk(response, tag)); break; case 84: @@ -3867,84 +3917,95 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(response, chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + function processBinaryChunk(weakResponse, chunk) { + if (void 0 !== weakResponse.weak.deref()) { + weakResponse = unwrapWeakResponse(weakResponse); + for ( + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, + chunkLength = chunk.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 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); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = chunk[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 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( + weakResponse, + rowID, + rowTag, + buffer, + rowLength + ), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; 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, rowID, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = rowID = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; + } } + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -4026,8 +4087,8 @@ return value; }; } - function close(response) { - reportGlobalError(response, Error("Connection closed.")); + function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw Error( @@ -4049,7 +4110,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { @@ -4172,7 +4233,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, initializingChunk = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), @@ -4282,7 +4347,7 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromNodeStream = function ( stream, @@ -4301,7 +4366,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; stream.on("data", function (chunk) { processBinaryChunk(response, chunk); }); @@ -4311,12 +4376,12 @@ stream.on("end", function () { return close(response); }); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall$1); 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 3ba5e71d088d70..c928126104f5d7 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 @@ -818,15 +818,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -855,15 +853,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -907,11 +905,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -1002,14 +1001,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1126,7 +1126,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1401,24 +1401,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1608,7 +1608,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1760,7 +1760,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; case 84: @@ -1801,7 +1801,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.stack = "Error: " + buffer.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; default: @@ -1811,14 +1811,14 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { : tag.set(id, new ReactPromise("resolved_model", buffer, response)); } } -function processBinaryChunk(response, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1872,7 +1872,7 @@ function processBinaryChunk(response, chunk) { var offset = chunk.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, rowID, rowTag, buffer, rowLength), + processFullBinaryRow(weakResponse, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -1884,10 +1884,10 @@ function processBinaryChunk(response, chunk) { break; } } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1924,8 +1924,8 @@ function createFromJSONCallback(response) { return value; }; } -function close(response) { - reportGlobalError(response, Error("Connection closed.")); +function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw 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 0ad06b5ebcc253..e345f4e416f4ca 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 @@ -652,9 +652,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -677,7 +677,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -858,6 +858,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -880,6 +881,7 @@ : null; type = this.timeOrigin = performance.now(); emitTimeOriginChunk(this, type + performance.timeOrigin); + this.abortTime = -0; model = createTask( this, model, @@ -953,7 +955,7 @@ return currentRequest ? currentRequest : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -964,15 +966,7 @@ ref ); case "rejected": - return ( - (thenable = thenable.reason), - "object" === typeof thenable && - null !== thenable && - thenable.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, thenable) - : emitErrorChunk(request, id, "", thenable, !0), - ref - ); + return emitErrorChunk(request, id, "", thenable.reason, !0), ref; } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; @@ -991,11 +985,7 @@ ((cancelled = !0), request.status === ABORTING ? emitDebugHaltChunk(request, id) - : "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, reason) - : emitErrorChunk(request, id, "", reason, !0), + : emitErrorChunk(request, id, "", reason, !0), enqueueFlush(request)); } ); @@ -1051,8 +1041,10 @@ return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), finishHaltedTask(newTask, request)) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -1125,8 +1117,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1213,8 +1204,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1386,7 +1376,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1772,7 +1762,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1852,7 +1842,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1860,7 +1850,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1939,7 +1929,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1965,8 +1955,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2000,7 +1991,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2612,7 +2603,7 @@ ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; tainted = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2631,7 +2622,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2870,7 +2861,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2898,7 +2889,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2991,12 +2982,12 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } function emitTimeOriginChunk(request, timeOrigin) { - request.pendingChunks++; + request.pendingDebugChunks++; timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); request.completedDebugChunks.push(timeOrigin); } @@ -3007,7 +2998,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; @@ -3015,7 +3006,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id$jscomp$0 = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -3066,11 +3057,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); } } @@ -3084,31 +3075,20 @@ } function forwardDebugInfoFromAbortedTask(request, task) { var model = task.model; - if ("object" === typeof model && null !== model) { - var debugInfo; - (debugInfo = model._debugInfo) && - forwardDebugInfo(request, task, debugInfo); - if ( - "function" !== typeof model.then && - model.$$typeof === REACT_LAZY_TYPE - ) { - request = model._payload; - model = model._init; - try { - model(request); - } catch (x) {} - } - } + "object" === typeof model && + null !== model && + (model = model._debugInfo) && + forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; + 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 && + (request.status === ABORTING && timestamp > request.abortTime) || (timestamp > task.time ? (emitTimingChunk(request, task.id, timestamp), (task.time = timestamp)) @@ -3199,7 +3179,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) @@ -3217,11 +3197,17 @@ callOnAllReadyIfReady(request); } catch (thrownValue) { if (request.status === ABORTING) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), finishHaltedTask(task, request); + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -3275,19 +3261,23 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), - task.timed && markOperationEndTime(request, task, performance.now()), + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), + task.timed && markOperationEndTime(request, task, request.abortTime), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } - function haltTask(task, request) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), + function haltTask(task) { + 0 === task.status && (task.status = 3); + } + function finishHaltedTask(task, request) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } function flushCompletedChunks(request, destination) { @@ -3319,7 +3309,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3360,6 +3350,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (cleanupTaintQueue(request), request.status < ABORTING && request.cacheController.abort( @@ -3408,62 +3399,98 @@ } } } - function abort(request, reason) { + function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then + abortedTasks.forEach(function (task) { + return finishHaltedTask(task, request); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.abortTime = performance.now(); + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + scheduleWork(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason ? Error( - "The render was aborted by the server with a promise." + "The render was aborted by the server without a reason." ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - abortableTasks.clear(); - callOnAllReadyIfReady(request); + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); } - null !== request.destination && - flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); - } } function fromHex(str) { return parseInt(str, 16); @@ -3475,7 +3502,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4252,7 +4279,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 f7259df99cc56b..2a22499141d018 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,8 +819,11 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -887,8 +890,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -970,8 +972,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1346,7 +1347,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1373,7 +1374,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1598,7 +1599,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); value = "$" === value[0] ? "$" + value : value; @@ -1755,7 +1756,7 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( String.fromCharCode.apply( @@ -1769,27 +1770,27 @@ function emitTypedArrayChunk(request, id, tag, typedArray) { ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; - tainted = new Uint8Array( + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? tainted.slice() : tainted; - tainted = typedArray.byteLength; - id = id.toString(16) + ":" + tag + tainted.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } @@ -1798,33 +1799,33 @@ function emitChunk(request, task, value) { "string" === typeof value && null !== byteLengthOfChunk ? ((task = TaintRegistryValues.get(value)), void 0 !== task && throwTaintViolation(task.message), - emitTextChunk(request, id, value)) + emitTextChunk(request, id, value, !1)) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1869,11 +1870,17 @@ function retryTask(request, task) { callOnAllReadyIfReady(request); } catch (thrownValue) { if (12 === request.status) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), 3 === task.status && request.pendingChunks--; + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -1923,15 +1930,17 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function haltTask(task, request) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); +function haltTask(task) { + 0 === task.status && (task.status = 3); } function flushCompletedChunks(request, destination) { currentView = new Uint8Array(2048); @@ -2016,58 +2025,98 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + 3 === task.status && request.pendingChunks--; + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$28) { - logRecoverableError(request, error$28, null), fatalError(request, error$28); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } +} +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + scheduleWork(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; + request.pendingChunks++; + emitErrorChunk(request, errorId$27, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$27); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId$27); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 7b501aa50cce22..23a031b3223822 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 @@ -659,9 +659,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -684,7 +684,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -865,6 +865,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -887,6 +888,7 @@ : null; type = this.timeOrigin = performance.now(); emitTimeOriginChunk(this, type + performance.timeOrigin); + this.abortTime = -0; model = createTask( this, model, @@ -965,7 +967,7 @@ return null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -976,15 +978,7 @@ ref ); case "rejected": - return ( - (thenable = thenable.reason), - "object" === typeof thenable && - null !== thenable && - thenable.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, thenable) - : emitErrorChunk(request, id, "", thenable, !0), - ref - ); + return emitErrorChunk(request, id, "", thenable.reason, !0), ref; } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; @@ -1003,11 +997,7 @@ ((cancelled = !0), request.status === ABORTING ? emitDebugHaltChunk(request, id) - : "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, reason) - : emitErrorChunk(request, id, "", reason, !0), + : emitErrorChunk(request, id, "", reason, !0), enqueueFlush(request)); } ); @@ -1063,8 +1053,10 @@ return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), finishHaltedTask(newTask, request)) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -1137,8 +1129,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1225,8 +1216,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1398,7 +1388,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1832,7 +1822,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1912,7 +1902,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1920,7 +1910,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1999,7 +1989,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -2025,8 +2015,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2060,7 +2051,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2694,7 +2685,7 @@ ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; tainted = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2713,7 +2704,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2952,7 +2943,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2980,7 +2971,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -3073,12 +3064,12 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } function emitTimeOriginChunk(request, timeOrigin) { - request.pendingChunks++; + request.pendingDebugChunks++; timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); request.completedDebugChunks.push(timeOrigin); } @@ -3089,7 +3080,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; @@ -3097,7 +3088,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id$jscomp$0 = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -3148,11 +3139,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); } } @@ -3166,31 +3157,20 @@ } function forwardDebugInfoFromAbortedTask(request, task) { var model = task.model; - if ("object" === typeof model && null !== model) { - var debugInfo; - (debugInfo = model._debugInfo) && - forwardDebugInfo(request, task, debugInfo); - if ( - "function" !== typeof model.then && - model.$$typeof === REACT_LAZY_TYPE - ) { - request = model._payload; - model = model._init; - try { - model(request); - } catch (x) {} - } - } + "object" === typeof model && + null !== model && + (model = model._debugInfo) && + forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; + 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 && + (request.status === ABORTING && timestamp > request.abortTime) || (timestamp > task.time ? (emitTimingChunk(request, task.id, timestamp), (task.time = timestamp)) @@ -3281,7 +3261,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) @@ -3299,11 +3279,17 @@ callOnAllReadyIfReady(request); } catch (thrownValue) { if (request.status === ABORTING) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), finishHaltedTask(task, request); + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -3357,19 +3343,23 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), - task.timed && markOperationEndTime(request, task, performance.now()), + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), + task.timed && markOperationEndTime(request, task, request.abortTime), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } - function haltTask(task, request) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), + function haltTask(task) { + 0 === task.status && (task.status = 3); + } + function finishHaltedTask(task, request) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } function flushCompletedChunks(request, destination) { @@ -3401,7 +3391,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3442,6 +3432,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (cleanupTaintQueue(request), request.status < ABORTING && request.cacheController.abort( @@ -3494,62 +3485,98 @@ } } } - function abort(request, reason) { + function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then + abortedTasks.forEach(function (task) { + return finishHaltedTask(task, request); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.abortTime = performance.now(); + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setTimeout(function () { + return finishHalt(request, abortableTasks); + }, 0); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId); + }, 0); + } else { + var error = + void 0 === reason ? Error( - "The render was aborted by the server with a promise." + "The render was aborted by the server without a reason." ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, _errorId2); + }, 0); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - abortableTasks.clear(); - callOnAllReadyIfReady(request); + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); } - null !== request.destination && - flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); - } } function fromHex(str) { return parseInt(str, 16); @@ -3561,7 +3588,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4338,7 +4365,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 2a06e1f449b5da..e8c46fca3c739f 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,8 +818,11 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -886,8 +889,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -969,8 +971,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1345,7 +1346,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1372,7 +1373,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1597,7 +1598,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); value = "$" === value[0] ? "$" + value : value; @@ -1758,7 +1759,7 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( String.fromCharCode.apply( @@ -1772,27 +1773,27 @@ function emitTypedArrayChunk(request, id, tag, typedArray) { ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; - tainted = new Uint8Array( + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? tainted.slice() : tainted; - tainted = typedArray.byteLength; - id = id.toString(16) + ":" + tag + tainted.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } @@ -1801,33 +1802,33 @@ function emitChunk(request, task, value) { "string" === typeof value && null !== byteLengthOfChunk ? ((task = TaintRegistryValues.get(value)), void 0 !== task && throwTaintViolation(task.message), - emitTextChunk(request, id, value)) + emitTextChunk(request, id, value, !1)) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1872,11 +1873,17 @@ function retryTask(request, task) { callOnAllReadyIfReady(request); } catch (thrownValue) { if (12 === request.status) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), 3 === task.status && request.pendingChunks--; + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -1926,15 +1933,17 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function haltTask(task, request) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); +function haltTask(task) { + 0 === task.status && (task.status = 3); } function flushCompletedChunks(request, destination) { currentView = new Uint8Array(2048); @@ -2023,58 +2032,98 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + 3 === task.status && request.pendingChunks--; + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$28) { - logRecoverableError(request, error$28, null), fatalError(request, error$28); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } +} +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setTimeout(function () { + return finishHalt(request, abortableTasks); + }, 0); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId); + }, 0); + } else { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; + request.pendingChunks++; + emitErrorChunk(request, errorId$27, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$27); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId$27); + }, 0); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 f3d51868b772cf..504d41f7b9e9e6 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 @@ -690,7 +690,7 @@ var envIdx = url.indexOf("/", 12), suffixIdx = url.lastIndexOf("?"); if (-1 < envIdx && -1 < suffixIdx) - return url.slice(envIdx + 1, suffixIdx); + return decodeURI(url.slice(envIdx + 1, suffixIdx)); } return url; } @@ -700,7 +700,7 @@ var callsite = stack[i], functionName = callsite[0], url = devirtualizeURL(callsite[1]); - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -723,7 +723,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -903,6 +903,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -925,6 +926,7 @@ : null; type = this.timeOrigin = performance.now(); emitTimeOriginChunk(this, type + performance.timeOrigin); + this.abortTime = -0; model = createTask( this, model, @@ -1000,7 +1002,7 @@ return store ? store : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1011,15 +1013,7 @@ ref ); case "rejected": - return ( - (thenable = thenable.reason), - "object" === typeof thenable && - null !== thenable && - thenable.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, thenable) - : emitErrorChunk(request, id, "", thenable, !0), - ref - ); + return emitErrorChunk(request, id, "", thenable.reason, !0), ref; } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; @@ -1038,11 +1032,7 @@ ((cancelled = !0), request.status === ABORTING ? emitDebugHaltChunk(request, id) - : "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, reason) - : emitErrorChunk(request, id, "", reason, !0), + : emitErrorChunk(request, id, "", reason, !0), enqueueFlush(request)); } ); @@ -1098,8 +1088,10 @@ return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), finishHaltedTask(newTask, request)) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -1172,8 +1164,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1260,8 +1251,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1432,7 +1422,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1755,83 +1745,102 @@ function visitAsyncNode(request, task, node, visited, cutOff) { if (visited.has(node)) return null; visited.add(node); - null !== node.previous && + var previousIONode = null; + if ( + null !== node.previous && node.end > request.timeOrigin && - visitAsyncNode(request, task, node.previous, visited, cutOff); + ((previousIONode = visitAsyncNode( + request, + task, + node.previous, + visited, + cutOff + )), + void 0 === previousIONode) + ) + return; switch (node.tag) { case 0: return node; case 3: - return null; + return previousIONode; case 1: - if (node.end <= request.timeOrigin) return null; - var awaited = node.awaited, - match = null; - null !== awaited && - ((awaited = visitAsyncNode( - request, - task, - awaited, - visited, - cutOff - )), - null !== awaited && - (match = - 1 === awaited.tag - ? awaited - : 0 === filterStackTrace(request, node.stack).length + if (node.end <= request.timeOrigin) return previousIONode; + var awaited = node.awaited; + if (null !== awaited) { + awaited = visitAsyncNode(request, task, awaited, visited, cutOff); + if (void 0 === awaited) break; + null !== awaited + ? (previousIONode = + 1 === awaited.tag ? awaited - : node)); + : 0 === filterStackTrace(request, node.stack).length + ? awaited + : node) + : request.status === ABORTING && + node.start < request.abortTime && + node.end > request.abortTime && + 0 < filterStackTrace(request, node.stack).length && + (previousIONode = node); + } node = node.promise.deref(); void 0 !== node && ((node = node._debugInfo), null == node || visited.has(node) || (visited.add(node), forwardDebugInfo(request, task, node))); - return match; + return previousIONode; case 4: - return null; + return previousIONode; case 2: - var _awaited = node.awaited; - match = null; - if ( - null !== _awaited && - ((awaited = visitAsyncNode( + awaited = node.awaited; + if (null !== awaited) { + var _ioNode = visitAsyncNode( request, task, - _awaited, + awaited, visited, cutOff - )), - null !== awaited) - ) { - var startTime = node.start, - endTime = node.end; - if (endTime <= request.timeOrigin) return null; - if (startTime < cutOff) match = awaited; - else { - cutOff = !1; - var fullStack = node.stack; - if (0 < fullStack.length) { - cutOff = request.filterStackFrame; - var callsite = fullStack[0]; - fullStack = callsite[0]; - callsite = devirtualizeURL(callsite[1]); - cutOff = cutOff(callsite, fullStack); + ); + if (void 0 === _ioNode) break; + if (null !== _ioNode) { + var startTime = node.start, + endTime = node.end; + if (endTime <= request.timeOrigin) return null; + if (startTime < cutOff) previousIONode = _ioNode; + else { + cutOff = !1; + for ( + var fullStack = node.stack, firstFrame = 0; + fullStack.length > firstFrame && + "Promise.then" === fullStack[firstFrame][0]; + + ) + firstFrame++; + if (fullStack.length > firstFrame) { + cutOff = request.filterStackFrame; + fullStack = fullStack[firstFrame]; + firstFrame = fullStack[0]; + var url = devirtualizeURL(fullStack[1]); + cutOff = cutOff(url, firstFrame, fullStack[2], fullStack[3]); + } + cutOff + ? (request.status === ABORTING && + startTime > request.abortTime) || + (serializeIONode(request, _ioNode, awaited.promise), + (awaited = (0, request.environmentName)()), + advanceTaskTime(request, task, startTime), + request.pendingDebugChunks++, + emitDebugChunk(request, task.id, { + awaited: _ioNode, + env: awaited, + owner: node.owner, + stack: filterStackTrace(request, node.stack) + }), + markOperationEndTime(request, task, endTime), + request.status === ABORTING && (previousIONode = void 0)) + : (previousIONode = _ioNode); } - cutOff - ? (serializeIONode(request, awaited, _awaited.promise), - (_awaited = (0, request.environmentName)()), - advanceTaskTime(request, task, startTime), - request.pendingChunks++, - emitDebugChunk(request, task.id, { - awaited: awaited, - env: _awaited, - owner: node.owner, - stack: filterStackTrace(request, node.stack) - }), - markOperationEndTime(request, task, endTime)) - : (match = awaited); } } node = node.promise.deref(); @@ -1840,7 +1849,7 @@ null == node || visited.has(node) || (visited.add(node), forwardDebugInfo(request, task, node))); - return match; + return previousIONode; default: throw Error("Unknown AsyncSequence tag. This is a bug in React."); } @@ -1856,9 +1865,10 @@ var visited = new Set(); alreadyForwardedDebugInfo && visited.add(alreadyForwardedDebugInfo); node = visitAsyncNode(request, task, node, visited, task.time); - null !== node && + void 0 !== node && + null !== node && (serializeIONode(request, node, node.promise), - request.pendingChunks++, + request.pendingDebugChunks++, (alreadyForwardedDebugInfo = (0, request.environmentName)()), (alreadyForwardedDebugInfo = { awaited: node, @@ -1961,7 +1971,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -2040,7 +2050,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -2048,7 +2058,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -2127,7 +2137,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -2153,8 +2163,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2188,7 +2199,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2832,19 +2843,22 @@ i++ ) { var callsite = name[i], - functionName = callsite[0]; - callsite = devirtualizeURL(callsite[1]); - if (filterStackFrame(callsite, functionName)) { - if ("" === bestMatch) { - name = functionName; - break a; - } - name = bestMatch; - break a; - } else + functionName = callsite[0], + url = devirtualizeURL(callsite[1]), + lineNumber = callsite[2]; + callsite = callsite[3]; + if ( "new Promise" !== functionName && - "node:internal/async_hooks" !== callsite && - (bestMatch = functionName); + "node:internal/async_hooks" !== url + ) + if (filterStackFrame(url, functionName, lineNumber, callsite)) { + if ("" === bestMatch) { + name = functionName; + break a; + } + name = bestMatch; + break a; + } else bestMatch = functionName; } name = ""; } @@ -2857,8 +2871,8 @@ filterStackFrame = void 0; null !== promiseRef && (filterStackFrame = promiseRef.deref()); promiseRef = (0, request.environmentName)(); - i = 3 === ioNode.tag ? performance.now() : ioNode.end; - request.pendingChunks++; + i = 3 === ioNode.tag ? request.abortTime : ioNode.end; + request.pendingDebugChunks++; functionName = request.nextChunkId++; emitIOInfoChunk( request, @@ -2889,7 +2903,7 @@ ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2906,7 +2920,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var binaryLength = byteLengthOfChunk(text); id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; debug @@ -3143,7 +3157,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -3171,7 +3185,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -3263,12 +3277,12 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } function emitTimeOriginChunk(request, timeOrigin) { - request.pendingChunks++; + request.pendingDebugChunks++; request.completedDebugChunks.push(":N" + timeOrigin + "\n"); } function forwardDebugInfo(request$jscomp$0, task, debugInfo) { @@ -3278,7 +3292,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; @@ -3286,7 +3300,7 @@ var request = request$jscomp$0, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id$jscomp$0 = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -3325,11 +3339,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); } } @@ -3362,42 +3376,34 @@ (debugInfo = model._debugInfo) && forwardDebugInfo(request, task, debugInfo); var thenable = null; - if ("function" === typeof model.then) thenable = model; - else if (model.$$typeof === REACT_LAZY_TYPE) { - var payload = model._payload; - model = model._init; - try { - model(payload); - } catch (x) { - "object" === typeof x && - null !== x && - "function" === typeof x.then && - (thenable = x); - } - } + "function" === typeof model.then + ? (thenable = model) + : model.$$typeof === REACT_LAZY_TYPE && + ((model = model._payload), + "function" === typeof model.then && (thenable = model)); if ( null !== thenable && - ((payload = getAsyncSequenceFromPromise(thenable)), null !== payload) + ((model = getAsyncSequenceFromPromise(thenable)), null !== model) ) { for ( - thenable = payload; + thenable = model; 4 === thenable.tag && null !== thenable.awaited; ) 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), emitDebugChunk(request, task.id, debugInfo)) - : emitAsyncSequence(request, task, payload, debugInfo, null, null); + : emitAsyncSequence(request, task, model, debugInfo, null, null); } } } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; + request.pendingDebugChunks++; timestamp -= request.timeOrigin; id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; request.completedDebugChunks.push(id); @@ -3410,7 +3416,7 @@ task.timed = !0; } function markOperationEndTime(request, task, timestamp) { - request.status !== ABORTING && + (request.status === ABORTING && timestamp > request.abortTime) || (timestamp > task.time ? (emitTimingChunk(request, task.id, timestamp), (task.time = timestamp)) @@ -3506,7 +3512,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) @@ -3525,11 +3531,17 @@ callOnAllReadyIfReady(request); } catch (thrownValue) { if (request.status === ABORTING) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), finishHaltedTask(task, request); + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -3584,19 +3596,23 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), - task.timed && markOperationEndTime(request, task, performance.now()), + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), + task.timed && markOperationEndTime(request, task, request.abortTime), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } - function haltTask(task, request) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), + function haltTask(task) { + 0 === task.status && (task.status = 3); + } + function finishHaltedTask(task, request) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } function flushCompletedChunks(request, destination) { @@ -3629,7 +3645,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3670,6 +3686,7 @@ } "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (cleanupTaintQueue(request), request.status < ABORTING && request.cacheController.abort( @@ -3717,62 +3734,98 @@ } } } - function abort(request, reason) { + function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then + abortedTasks.forEach(function (task) { + return finishHaltedTask(task, request); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.abortTime = performance.now(); + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setImmediate(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason ? Error( - "The render was aborted by the server with a promise." + "The render was aborted by the server without a reason." ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - abortableTasks.clear(); - callOnAllReadyIfReady(request); + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); } - null !== request.destination && - flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); - } } function fromHex(str) { return parseInt(str, 16); @@ -3791,7 +3844,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(request)); @@ -3823,7 +3876,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -5249,7 +5302,23 @@ var currentAsyncId = async_hooks.executionAsyncId(); asyncId !== currentAsyncId && ((asyncId = pendingOperations.get(currentAsyncId)), - (node.awaited = void 0 === asyncId ? null : asyncId)); + 1 === node.tag + ? (node.awaited = void 0 === asyncId ? null : asyncId) + : void 0 !== asyncId && + ((currentAsyncId = { + tag: 2, + owner: node.owner, + stack: node.stack, + start: node.start, + end: node.end, + promise: node.promise, + awaited: node.awaited, + previous: node.previous + }), + (node.start = node.end), + (node.end = performance.now()), + (node.previous = currentAsyncId), + (node.awaited = asyncId))); } }, destroy: function (asyncId) { @@ -5441,12 +5510,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_221 = []; + var JSCompiler_object_inline_chunks_229 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_221.push(chunk); + JSCompiler_object_inline_chunks_229.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_221, { + var blob = new Blob(JSCompiler_object_inline_chunks_229, { type: mimeType }); response._formData.append(name, blob, filename); 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 92814e93106df1..e31b5df811664e 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,8 +841,11 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -909,8 +912,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -992,8 +994,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1365,7 +1366,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1392,7 +1393,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1617,7 +1618,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); value = "$" === value[0] ? "$" + value : value; @@ -1765,7 +1766,7 @@ function emitErrorChunk(request, id, digest) { id = id.toString(16) + ":E" + stringify(digest) + "\n"; request.completedErrorChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( String.fromCharCode.apply( @@ -1779,24 +1780,24 @@ function emitTypedArrayChunk(request, id, tag, typedArray) { ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - tainted = typedArray.byteLength; - id = id.toString(16) + ":" + tag + tainted.toString(16) + ","; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; - var binaryLength = byteLengthOfChunk(text); - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = byteLengthOfChunk(text); + id = id.toString(16) + ":T" + debug.toString(16) + ","; request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { @@ -1804,33 +1805,33 @@ function emitChunk(request, task, value) { "string" === typeof value && null !== byteLengthOfChunk ? ((task = TaintRegistryValues.get(value)), void 0 !== task && throwTaintViolation(task.message), - emitTextChunk(request, id, value)) + emitTextChunk(request, id, value, !1)) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), (task = task.id.toString(16) + ":" + value + "\n"), @@ -1878,11 +1879,17 @@ function retryTask(request, task) { callOnAllReadyIfReady(request); } catch (thrownValue) { if (12 === request.status) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), 3 === task.status && request.pendingChunks--; + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -1932,15 +1939,17 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function haltTask(task, request) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); +function haltTask(task) { + 0 === task.status && (task.status = 3); } function flushCompletedChunks(request, destination) { currentView = new Uint8Array(2048); @@ -2049,58 +2058,98 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + 3 === task.status && request.pendingChunks--; + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$28) { - logRecoverableError(request, error$28, null), fatalError(request, error$28); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } +} +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setImmediate(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; + request.pendingChunks++; + emitErrorChunk(request, errorId$27, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$27); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId$27); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; @@ -2976,12 +3025,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_255 = []; + var JSCompiler_object_inline_chunks_263 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_255.push(chunk); + JSCompiler_object_inline_chunks_263.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_255, { + 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 1b6adaa7b5d95a..99578b42c9db39 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-5d87cd22-20250704", - "react-dom": "0.0.0-experimental-5d87cd22-20250704" + "react": "0.0.0-experimental-223f81d8-20250707", + "react-dom": "0.0.0-experimental-223f81d8-20250707" } } \ 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 7dcaa18d9b52e1..787cd02ba4a0ed 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 @@ -757,7 +757,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -911,6 +911,17 @@ this.reason = reason; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -930,9 +941,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function wakeChunk(listeners, value) { for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; @@ -1008,15 +1037,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1039,6 +1067,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1049,15 +1078,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1100,15 +1130,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1184,7 +1218,7 @@ chunk || ((chunk = response._closed ? new ReactPromise("rejected", null, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1270,31 +1304,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1341,17 +1375,18 @@ response._debugFindSourceMapURL ); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -1364,7 +1399,7 @@ deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -1427,7 +1462,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -1796,6 +1831,8 @@ this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -1812,17 +1849,22 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -1832,18 +1874,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -1853,39 +1897,41 @@ response._bundlerConfig, model ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -1922,7 +1968,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -1987,7 +2033,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2060,11 +2106,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2469,6 +2515,7 @@ ); resolveBuffer(response, id, constructor); } + function flushInitialRenderPerformance() {} function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -2539,7 +2586,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, new ReactPromise("rejected", null, tag)); break; case 84: @@ -2695,96 +2742,99 @@ options ? !1 !== options.replayConsoleLogs : !0, options && options.environmentName ? options.environmentName : void 0, debugChannel - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -2864,7 +2914,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, @@ -2975,10 +3029,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-canary-5d87cd22-20250704", + version: "19.2.0-canary-223f81d8-20250707", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-5d87cd22-20250704", + reconcilerVersion: "19.2.0-canary-223f81d8-20250707", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -2993,12 +3047,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + 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 4f7a2b091d19da..7e134695d42e50 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 @@ -643,15 +643,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -680,15 +678,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -732,11 +730,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -827,14 +826,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -875,17 +875,18 @@ function loadServerReference(response, metaData, parentObject, key) { if (!response._serverReferenceConfig) return createBoundServerReference(metaData, response._callServer); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -898,7 +899,7 @@ function loadServerReference(response, metaData, parentObject, key) { deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -936,7 +937,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1206,24 +1207,24 @@ function resolveModule(response, id, model) { chunk = chunks.get(id); model = JSON.parse(model, response._fromJSON); var clientReference = resolveClientReference(response._bundlerConfig, model); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1413,7 +1414,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1563,10 +1564,10 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { tag = JSON.parse(buffer); buffer = resolveErrorProd(); buffer.digest = tag.digest; - response = response._chunks; - (tag = response.get(id)) - ? triggerErrorOnChunk(tag, buffer) - : response.set(id, new ReactPromise("rejected", null, buffer)); + tag = response._chunks; + (chunk = tag.get(id)) + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("rejected", null, buffer)); break; case 84: response = response._chunks; @@ -1594,9 +1595,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { startAsyncIterable(response, id, !0); break; case 67: - (id = response._chunks.get(id)) && - "fulfilled" === id.status && - id.reason.close("" === buffer ? '"$undefined"' : buffer); + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === buffer ? '"$undefined"' : buffer); break; default: (tag = response._chunks), 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 b56fd339e19be7..233020abb61214 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 @@ -877,7 +877,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1123,6 +1123,17 @@ this.reason = reason; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1142,9 +1153,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function wakeChunk(listeners, value) { for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; @@ -1220,15 +1249,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1251,6 +1279,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1261,15 +1290,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1312,15 +1342,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1396,7 +1430,7 @@ chunk || ((chunk = response._closed ? new ReactPromise("rejected", null, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1482,31 +1516,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1646,7 +1680,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2015,6 +2049,8 @@ this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2031,17 +2067,22 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2051,18 +2092,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2077,39 +2120,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2146,7 +2191,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2211,7 +2256,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2284,11 +2329,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2693,6 +2738,7 @@ ); resolveBuffer(response, id, constructor); } + function flushInitialRenderPerformance() {} function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -2763,7 +2809,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, new ReactPromise("rejected", null, tag)); break; case 84: @@ -2907,96 +2953,99 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -3079,7 +3128,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, @@ -3188,12 +3241,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall); 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 7b9e85e30dbfd4..53001149054a2e 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 @@ -813,15 +813,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -850,15 +848,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -902,11 +900,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -997,14 +996,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1121,7 +1121,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1396,24 +1396,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1603,7 +1603,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1753,10 +1753,10 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { tag = JSON.parse(buffer); buffer = resolveErrorProd(); buffer.digest = tag.digest; - response = response._chunks; - (tag = response.get(id)) - ? triggerErrorOnChunk(tag, buffer) - : response.set(id, new ReactPromise("rejected", null, buffer)); + tag = response._chunks; + (chunk = tag.get(id)) + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("rejected", null, buffer)); break; case 84: response = response._chunks; @@ -1784,9 +1784,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { startAsyncIterable(response, id, !0); break; case 67: - (id = response._chunks.get(id)) && - "fulfilled" === id.status && - id.reason.close("" === buffer ? '"$undefined"' : buffer); + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === buffer ? '"$undefined"' : buffer); break; default: (tag = response._chunks), 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 d445b241523438..97b32ad0f5f195 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 @@ -877,7 +877,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1123,6 +1123,17 @@ this.reason = reason; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1142,9 +1153,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function wakeChunk(listeners, value) { for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; @@ -1220,15 +1249,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1251,6 +1279,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1261,15 +1290,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1312,15 +1342,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1396,7 +1430,7 @@ chunk || ((chunk = response._closed ? new ReactPromise("rejected", null, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1482,31 +1516,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1646,7 +1680,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2015,6 +2049,8 @@ this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2031,17 +2067,22 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2051,18 +2092,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2077,39 +2120,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2146,7 +2191,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2211,7 +2256,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2284,11 +2329,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2693,6 +2738,7 @@ ); resolveBuffer(response, id, constructor); } + function flushInitialRenderPerformance() {} function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -2763,7 +2809,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, new ReactPromise("rejected", null, tag)); break; case 84: @@ -2807,84 +2853,95 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(response, chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + function processBinaryChunk(weakResponse, chunk) { + if (void 0 !== weakResponse.weak.deref()) { + weakResponse = unwrapWeakResponse(weakResponse); + for ( + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, + chunkLength = chunk.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 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); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = chunk[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 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( + weakResponse, + rowID, + rowTag, + buffer, + rowLength + ), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; 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, rowID, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = rowID = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; + } } + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -2966,8 +3023,8 @@ return value; }; } - function close(response) { - reportGlobalError(response, Error("Connection closed.")); + function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw Error( @@ -2989,7 +3046,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { @@ -3086,7 +3143,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, @@ -3195,7 +3256,7 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromNodeStream = function ( stream, @@ -3214,7 +3275,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; stream.on("data", function (chunk) { processBinaryChunk(response, chunk); }); @@ -3224,12 +3285,12 @@ stream.on("end", function () { return close(response); }); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall$1); 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 d7a17aaace43c8..ee3176823052e8 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 @@ -814,15 +814,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -851,15 +849,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -903,11 +901,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -998,14 +997,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1122,7 +1122,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1397,24 +1397,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1604,7 +1604,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1754,10 +1754,10 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { tag = JSON.parse(buffer); buffer = resolveErrorProd(); buffer.digest = tag.digest; - response = response._chunks; - (tag = response.get(id)) - ? triggerErrorOnChunk(tag, buffer) - : response.set(id, new ReactPromise("rejected", null, buffer)); + tag = response._chunks; + (chunk = tag.get(id)) + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("rejected", null, buffer)); break; case 84: response = response._chunks; @@ -1785,9 +1785,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { startAsyncIterable(response, id, !0); break; case 67: - (id = response._chunks.get(id)) && - "fulfilled" === id.status && - id.reason.close("" === buffer ? '"$undefined"' : buffer); + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === buffer ? '"$undefined"' : buffer); break; default: (tag = response._chunks), @@ -1796,14 +1796,14 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { : tag.set(id, new ReactPromise("resolved_model", buffer, response)); } } -function processBinaryChunk(response, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1857,7 +1857,7 @@ function processBinaryChunk(response, chunk) { var offset = chunk.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, rowID, rowTag, buffer, rowLength), + processFullBinaryRow(weakResponse, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -1869,10 +1869,10 @@ function processBinaryChunk(response, chunk) { break; } } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1909,8 +1909,8 @@ function createFromJSONCallback(response) { return value; }; } -function close(response) { - reportGlobalError(response, Error("Connection closed.")); +function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw 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 7785a5be996a82..c439a5342ce4a5 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 @@ -649,9 +649,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -674,7 +674,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -837,6 +837,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -920,7 +921,7 @@ return currentRequest ? currentRequest : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -993,7 +994,9 @@ if (request.status === ABORTING) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1320,7 +1323,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1694,7 +1697,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1774,7 +1777,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1782,7 +1785,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1861,7 +1864,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1887,8 +1890,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2464,7 +2468,7 @@ } } function emitTypedArrayChunk(request, id, tag, typedArray, debug) { - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var buffer = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2483,7 +2487,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2722,7 +2726,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2750,7 +2754,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2843,7 +2847,7 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } @@ -2854,7 +2858,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; @@ -2862,7 +2866,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -2913,11 +2917,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); } } @@ -3002,7 +3006,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( @@ -3018,11 +3022,13 @@ request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (request.status === ABORTING) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (request.status === ABORTING) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -3075,9 +3081,11 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - if (5 !== task.status) { - task.status = 3; + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + if (3 === task.status) { var model = task.model; "object" === typeof model && null !== model && @@ -3117,7 +3125,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3158,6 +3166,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (request.status < ABORTING && request.cacheController.abort( Error( @@ -3205,44 +3214,60 @@ } } } - function abort(request, reason) { + function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error( - "The render was aborted by the server with a promise." - ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); + } + } function fromHex(str) { return parseInt(str, 16); } @@ -3253,7 +3278,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4030,7 +4055,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 bc40f1103afcd8..f588808d29c2cd 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 @@ -790,7 +790,9 @@ function serializeThenable(request, task, thenable) { if (12 === request.status) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1297,7 +1299,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1544,7 +1546,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); request = "$" === value[0] ? "$" + value : value; @@ -1678,61 +1680,61 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { - request.pendingChunks++; - var buffer = new Uint8Array( +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer; - buffer = typedArray.byteLength; - id = id.toString(16) + ":" + tag + buffer.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { var id = task.id; "string" === typeof value && null !== byteLengthOfChunk - ? emitTextChunk(request, id, value) + ? emitTextChunk(request, id, value, !1) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1771,11 +1773,13 @@ function retryTask(request, task) { request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (12 === request.status) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (12 === request.status) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -1824,10 +1828,12 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } @@ -1913,39 +1919,56 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitErrorChunk(request, errorId, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error("The render was aborted by the server without a reason.") + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error("The render was aborted by the server with a promise.") + : reason, + digest = logRecoverableError(request, error, null), + errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitErrorChunk(request, errorId, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 b093e8946a3aef..12004f122cdebb 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 @@ -656,9 +656,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -681,7 +681,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -844,6 +844,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -932,7 +933,7 @@ return null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1005,7 +1006,9 @@ if (request.status === ABORTING) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1332,7 +1335,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1754,7 +1757,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1834,7 +1837,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1842,7 +1845,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1921,7 +1924,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1947,8 +1950,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2535,7 +2539,7 @@ } } function emitTypedArrayChunk(request, id, tag, typedArray, debug) { - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var buffer = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2554,7 +2558,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2793,7 +2797,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2821,7 +2825,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2914,7 +2918,7 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } @@ -2925,7 +2929,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; @@ -2933,7 +2937,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -2984,11 +2988,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); } } @@ -3073,7 +3077,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( @@ -3089,11 +3093,13 @@ request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (request.status === ABORTING) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (request.status === ABORTING) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -3146,9 +3152,11 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - if (5 !== task.status) { - task.status = 3; + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + if (3 === task.status) { var model = task.model; "object" === typeof model && null !== model && @@ -3188,7 +3196,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3229,6 +3237,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (request.status < ABORTING && request.cacheController.abort( Error( @@ -3280,44 +3289,60 @@ } } } - function abort(request, reason) { + function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error( - "The render was aborted by the server with a promise." - ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, _errorId2); + }, 0); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); + } + } function fromHex(str) { return parseInt(str, 16); } @@ -3328,7 +3353,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4105,7 +4130,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 2dd2333e0a2dfa..cdaf11d4fe8f95 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 @@ -789,7 +789,9 @@ function serializeThenable(request, task, thenable) { if (12 === request.status) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1296,7 +1298,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1543,7 +1545,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); request = "$" === value[0] ? "$" + value : value; @@ -1679,61 +1681,61 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { - request.pendingChunks++; - var buffer = new Uint8Array( +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer; - buffer = typedArray.byteLength; - id = id.toString(16) + ":" + tag + buffer.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { var id = task.id; "string" === typeof value && null !== byteLengthOfChunk - ? emitTextChunk(request, id, value) + ? emitTextChunk(request, id, value, !1) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1772,11 +1774,13 @@ function retryTask(request, task) { request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (12 === request.status) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (12 === request.status) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -1825,10 +1829,12 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } @@ -1918,39 +1924,56 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitErrorChunk(request, errorId, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error("The render was aborted by the server without a reason.") + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error("The render was aborted by the server with a promise.") + : reason, + digest = logRecoverableError(request, error, null), + errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitErrorChunk(request, errorId, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId); + }, 0); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 975fe245183de8..c86b97fca404dc 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 @@ -680,9 +680,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -705,7 +705,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -867,6 +867,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -952,7 +953,7 @@ return store ? store : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1025,7 +1026,9 @@ if (request.status === ABORTING) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1351,7 +1354,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1751,7 +1754,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1830,7 +1833,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1838,7 +1841,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1917,7 +1920,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1943,8 +1946,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2517,7 +2521,7 @@ } } function emitTypedArrayChunk(request, id, tag, typedArray, debug) { - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2534,7 +2538,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var binaryLength = byteLengthOfChunk(text); id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; debug @@ -2771,7 +2775,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2799,7 +2803,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2891,7 +2895,7 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } @@ -2902,7 +2906,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; @@ -2910,7 +2914,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -2960,11 +2964,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); } } @@ -3054,7 +3058,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( @@ -3071,11 +3075,13 @@ request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (request.status === ABORTING) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (request.status === ABORTING) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -3128,9 +3134,11 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - if (5 !== task.status) { - task.status = 3; + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + if (3 === task.status) { var model = task.model; "object" === typeof model && null !== model && @@ -3171,7 +3179,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3212,6 +3220,7 @@ } "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (request.status < ABORTING && request.cacheController.abort( Error( @@ -3258,44 +3267,60 @@ } } } - function abort(request, reason) { + function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error( - "The render was aborted by the server with a promise." - ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); + } + } function fromHex(str) { return parseInt(str, 16); } @@ -3313,7 +3338,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(request)); @@ -3345,7 +3370,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4818,12 +4843,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_207 = []; + var JSCompiler_object_inline_chunks_213 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_207.push(chunk); + JSCompiler_object_inline_chunks_213.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_207, { + var blob = new Blob(JSCompiler_object_inline_chunks_213, { type: mimeType }); response._formData.append(name, blob, filename); 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 13136e21cbf212..090630eb04a5dc 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 @@ -812,7 +812,9 @@ function serializeThenable(request, task, thenable) { if (12 === request.status) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1316,7 +1318,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1563,7 +1565,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); request = "$" === value[0] ? "$" + value : value; @@ -1690,57 +1692,57 @@ function emitErrorChunk(request, id, digest) { id = id.toString(16) + ":E" + stringify(digest) + "\n"; request.completedErrorChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { - request.pendingChunks++; +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - var binaryLength = typedArray.byteLength; - id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ","; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; - var binaryLength = byteLengthOfChunk(text); - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = byteLengthOfChunk(text); + id = id.toString(16) + ":T" + debug.toString(16) + ","; request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { var id = task.id; "string" === typeof value && null !== byteLengthOfChunk - ? emitTextChunk(request, id, value) + ? emitTextChunk(request, id, value, !1) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), (task = task.id.toString(16) + ":" + value + "\n"), @@ -1782,11 +1784,13 @@ function retryTask(request, task) { request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (12 === request.status) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (12 === request.status) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -1835,10 +1839,12 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } @@ -1948,39 +1954,56 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitErrorChunk(request, errorId, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error("The render was aborted by the server without a reason.") + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error("The render was aborted by the server with a promise.") + : reason, + digest = logRecoverableError(request, error, null), + errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitErrorChunk(request, errorId, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; @@ -2856,12 +2879,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_245 = []; + var JSCompiler_object_inline_chunks_253 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_245.push(chunk); + JSCompiler_object_inline_chunks_253.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_245, { + 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 fb3d94cdebe77f..cb8230b36865d8 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-5d87cd22-20250704", - "react-dom": "19.2.0-canary-5d87cd22-20250704" + "react": "19.2.0-canary-223f81d8-20250707", + "react-dom": "19.2.0-canary-223f81d8-20250707" } } \ 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 e8f655ab47f28d..1ad0ad2e104ee2 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 @@ -766,7 +766,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1369,6 +1369,17 @@ this._children = []; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1388,9 +1399,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function createErrorChunk(response, error) { return new ReactPromise("rejected", null, error); } @@ -1469,15 +1498,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1500,6 +1528,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1510,15 +1539,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1563,24 +1593,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); - response._replayConsole && - (markAllTracksInOrder(), - flushComponentPerformance( - response, - getChunk(response, 0), - 0, - -Infinity, - -Infinity - )); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1656,7 +1681,7 @@ chunk || ((chunk = response._closed ? createErrorChunk(response, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1742,31 +1767,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1813,17 +1838,18 @@ response._debugFindSourceMapURL ); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -1836,7 +1862,7 @@ deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -1899,7 +1925,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2279,6 +2305,9 @@ this._closedReason = null; this._tempRefs = temporaryReferences; this._timeOrigin = 0; + this._pendingInitialRender = null; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2295,18 +2324,23 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2316,18 +2350,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2337,39 +2373,41 @@ response._bundlerConfig, model ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2406,7 +2444,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2471,7 +2509,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2544,11 +2582,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2591,7 +2629,7 @@ reason.$$typeof = REACT_POSTPONE_TYPE; stack = response._chunks; (env = stack.get(id)) - ? triggerErrorOnChunk(env, reason) + ? triggerErrorOnChunk(response, env, reason) : stack.set(id, createErrorChunk(response, reason)); } function resolveHint(response, code, model) { @@ -3066,9 +3104,8 @@ previousResult.track = trackIdx$jscomp$6; return previousResult; } - var children = root._children; - "resolved_model" === root.status && initializeModelChunk(root); - var debugInfo = root._debugInfo; + var children = root._children, + debugInfo = root._debugInfo; if (debugInfo) { for (var startTime$jscomp$0 = 0, i = 0; i < debugInfo.length; i++) { var info = debugInfo[i]; @@ -3528,6 +3565,20 @@ result.endTime = childrenEndTime; return result; } + function flushInitialRenderPerformance(response) { + if (response._replayConsole) { + var rootChunk = getChunk(response, 0); + isArrayImpl(rootChunk._children) && + (markAllTracksInOrder(), + flushComponentPerformance( + response, + rootChunk, + 0, + -Infinity, + -Infinity + )); + } + } function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -3598,7 +3649,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, createErrorChunk(response, tag)); break; case 84: @@ -3762,96 +3813,99 @@ options ? !1 !== options.replayConsoleLogs : !0, options && options.environmentName ? options.environmentName : void 0, debugChannel - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -3965,7 +4019,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, initializingChunk = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), @@ -4077,10 +4135,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-experimental-5d87cd22-20250704", + version: "19.2.0-experimental-223f81d8-20250707", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-experimental-5d87cd22-20250704", + reconcilerVersion: "19.2.0-experimental-223f81d8-20250707", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -4095,12 +4153,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + 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 39522ccd8bab49..794a22ebbeb965 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 @@ -659,15 +659,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -696,15 +694,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -748,11 +746,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -843,14 +842,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -891,17 +891,18 @@ function loadServerReference(response, metaData, parentObject, key) { if (!response._serverReferenceConfig) return createBoundServerReference(metaData, response._callServer); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -914,7 +915,7 @@ function loadServerReference(response, metaData, parentObject, key) { deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -952,7 +953,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1222,24 +1223,24 @@ function resolveModule(response, id, model) { chunk = chunks.get(id); model = JSON.parse(model, response._fromJSON); var clientReference = resolveClientReference(response._bundlerConfig, model); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1429,7 +1430,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1581,7 +1582,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; case 84: @@ -1622,7 +1623,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.stack = "Error: " + buffer.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; default: 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 3d3a470993721b..1afbe9e8194117 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 @@ -882,7 +882,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1577,6 +1577,17 @@ this._children = []; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1596,9 +1607,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function createErrorChunk(response, error) { return new ReactPromise("rejected", null, error); } @@ -1677,15 +1706,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1708,6 +1736,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1718,15 +1747,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1771,24 +1801,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); - response._replayConsole && - (markAllTracksInOrder(), - flushComponentPerformance( - response, - getChunk(response, 0), - 0, - -Infinity, - -Infinity - )); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1864,7 +1889,7 @@ chunk || ((chunk = response._closed ? createErrorChunk(response, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1950,31 +1975,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -2114,7 +2139,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2494,6 +2519,9 @@ this._closedReason = null; this._tempRefs = temporaryReferences; this._timeOrigin = 0; + this._pendingInitialRender = null; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2510,18 +2538,23 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2531,18 +2564,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2557,39 +2592,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2626,7 +2663,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2691,7 +2728,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2764,11 +2801,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2811,7 +2848,7 @@ reason.$$typeof = REACT_POSTPONE_TYPE; stack = response._chunks; (env = stack.get(id)) - ? triggerErrorOnChunk(env, reason) + ? triggerErrorOnChunk(response, env, reason) : stack.set(id, createErrorChunk(response, reason)); } function resolveHint(response, code, model) { @@ -3286,9 +3323,8 @@ previousResult.track = trackIdx$jscomp$6; return previousResult; } - var children = root._children; - "resolved_model" === root.status && initializeModelChunk(root); - var debugInfo = root._debugInfo; + var children = root._children, + debugInfo = root._debugInfo; if (debugInfo) { for (var startTime$jscomp$0 = 0, i = 0; i < debugInfo.length; i++) { var info = debugInfo[i]; @@ -3748,6 +3784,20 @@ result.endTime = childrenEndTime; return result; } + function flushInitialRenderPerformance(response) { + if (response._replayConsole) { + var rootChunk = getChunk(response, 0); + isArrayImpl(rootChunk._children) && + (markAllTracksInOrder(), + flushComponentPerformance( + response, + rootChunk, + 0, + -Infinity, + -Infinity + )); + } + } function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -3818,7 +3868,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, createErrorChunk(response, tag)); break; case 84: @@ -3970,96 +4020,99 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -4168,7 +4221,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, initializingChunk = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), @@ -4278,12 +4335,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall); 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 f98b298cc1d547..c41d69a6624512 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 @@ -820,15 +820,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -857,15 +855,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -909,11 +907,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -1004,14 +1003,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1128,7 +1128,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1403,24 +1403,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1610,7 +1610,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1762,7 +1762,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; case 84: @@ -1803,7 +1803,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { buffer.stack = "Error: " + buffer.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) + ? triggerErrorOnChunk(response, chunk, buffer) : tag.set(id, createErrorChunk(response, buffer)); break; default: 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 1812e629fba414..0af27d469565d7 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 @@ -882,7 +882,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1577,6 +1577,17 @@ this._children = []; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1596,9 +1607,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function createErrorChunk(response, error) { return new ReactPromise("rejected", null, error); } @@ -1677,15 +1706,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1708,6 +1736,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1718,15 +1747,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1771,24 +1801,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); - response._replayConsole && - (markAllTracksInOrder(), - flushComponentPerformance( - response, - getChunk(response, 0), - 0, - -Infinity, - -Infinity - )); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1864,7 +1889,7 @@ chunk || ((chunk = response._closed ? createErrorChunk(response, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1950,31 +1975,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -2114,7 +2139,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2494,6 +2519,9 @@ this._closedReason = null; this._tempRefs = temporaryReferences; this._timeOrigin = 0; + this._pendingInitialRender = null; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2510,18 +2538,23 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2531,18 +2564,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2557,39 +2592,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2626,7 +2663,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2691,7 +2728,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2764,11 +2801,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2811,7 +2848,7 @@ reason.$$typeof = REACT_POSTPONE_TYPE; stack = response._chunks; (env = stack.get(id)) - ? triggerErrorOnChunk(env, reason) + ? triggerErrorOnChunk(response, env, reason) : stack.set(id, createErrorChunk(response, reason)); } function resolveHint(response, code, model) { @@ -3286,9 +3323,8 @@ previousResult.track = trackIdx$jscomp$6; return previousResult; } - var children = root._children; - "resolved_model" === root.status && initializeModelChunk(root); - var debugInfo = root._debugInfo; + var children = root._children, + debugInfo = root._debugInfo; if (debugInfo) { for (var startTime$jscomp$0 = 0, i = 0; i < debugInfo.length; i++) { var info = debugInfo[i]; @@ -3748,6 +3784,20 @@ result.endTime = childrenEndTime; return result; } + function flushInitialRenderPerformance(response) { + if (response._replayConsole) { + var rootChunk = getChunk(response, 0); + isArrayImpl(rootChunk._children) && + (markAllTracksInOrder(), + flushComponentPerformance( + response, + rootChunk, + 0, + -Infinity, + -Infinity + )); + } + } function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -3818,7 +3868,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, createErrorChunk(response, tag)); break; case 84: @@ -3870,84 +3920,95 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(response, chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + function processBinaryChunk(weakResponse, chunk) { + if (void 0 !== weakResponse.weak.deref()) { + weakResponse = unwrapWeakResponse(weakResponse); + for ( + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, + chunkLength = chunk.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 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); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = chunk[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 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( + weakResponse, + rowID, + rowTag, + buffer, + rowLength + ), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; 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, rowID, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = rowID = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; + } } + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -4029,8 +4090,8 @@ return value; }; } - function close(response) { - reportGlobalError(response, Error("Connection closed.")); + function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw Error( @@ -4052,7 +4113,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { @@ -4175,7 +4236,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, initializingChunk = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), @@ -4285,14 +4350,14 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromNodeStream = function ( stream, serverConsumerManifest, options ) { - var response = new ResponseInstance( + var response$jscomp$0 = new ResponseInstance( serverConsumerManifest.moduleMap, serverConsumerManifest.serverModuleMap, serverConsumerManifest.moduleLoading, @@ -4304,109 +4369,112 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + if (void 0 !== response$jscomp$0.weak.deref()) { + for ( + var response = unwrapWeakResponse(response$jscomp$0), + i = 0, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._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) + ) { + 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." ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) + 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." ); - 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." - ); + } + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; - } else processBinaryChunk(response, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { - reportGlobalError(response, error); + reportGlobalError(response$jscomp$0, error); }); stream.on("end", function () { - return close(response); + return close(response$jscomp$0); }); - return getChunk(response, 0); + return getRoot(response$jscomp$0); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall$1); 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 666bace093b7ec..bcd33d814cc02c 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 @@ -821,15 +821,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -858,15 +856,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -910,11 +908,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -1005,14 +1004,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1129,7 +1129,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1404,24 +1404,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1611,7 +1611,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1765,7 +1765,7 @@ function processFullStringRow(response, id, tag, row) { tag = response._chunks; var chunk = tag.get(id); chunk - ? triggerErrorOnChunk(chunk, row) + ? triggerErrorOnChunk(response, chunk, row) : tag.set(id, createErrorChunk(response, row)); break; case 84: @@ -1806,7 +1806,7 @@ function processFullStringRow(response, id, tag, row) { row.stack = "Error: " + row.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, row) + ? triggerErrorOnChunk(response, chunk, row) : tag.set(id, createErrorChunk(response, row)); break; default: @@ -1816,14 +1816,14 @@ function processFullStringRow(response, id, tag, row) { : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(response, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1877,7 +1877,7 @@ function processBinaryChunk(response, chunk) { var offset = chunk.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, rowID, rowTag, buffer, rowLength), + processFullBinaryRow(weakResponse, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -1889,10 +1889,10 @@ function processBinaryChunk(response, chunk) { break; } } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1929,8 +1929,8 @@ function createFromJSONCallback(response) { return value; }; } -function close(response) { - reportGlobalError(response, Error("Connection closed.")); +function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw 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 2e34d8c5e9d308..bb8e7d02517491 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 @@ -844,7 +844,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1539,6 +1539,17 @@ this._children = []; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1558,9 +1569,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function createErrorChunk(response, error) { return new ReactPromise("rejected", null, error); } @@ -1639,15 +1668,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1670,6 +1698,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1680,15 +1709,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1733,24 +1763,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); - response._replayConsole && - (markAllTracksInOrder(), - flushComponentPerformance( - response, - getChunk(response, 0), - 0, - -Infinity, - -Infinity - )); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1826,7 +1851,7 @@ chunk || ((chunk = response._closed ? createErrorChunk(response, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1912,31 +1937,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -2076,7 +2101,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2456,6 +2481,9 @@ this._closedReason = null; this._tempRefs = temporaryReferences; this._timeOrigin = 0; + this._pendingInitialRender = null; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2472,18 +2500,23 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); replayConsole && markAllTracksInOrder(); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2493,18 +2526,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2519,39 +2554,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2588,7 +2625,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2653,7 +2690,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2726,11 +2763,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2773,7 +2810,7 @@ reason.$$typeof = REACT_POSTPONE_TYPE; stack = response._chunks; (env = stack.get(id)) - ? triggerErrorOnChunk(env, reason) + ? triggerErrorOnChunk(response, env, reason) : stack.set(id, createErrorChunk(response, reason)); } function resolveHint(response, code, model) { @@ -3248,9 +3285,8 @@ previousResult.track = trackIdx$jscomp$6; return previousResult; } - var children = root._children; - "resolved_model" === root.status && initializeModelChunk(root); - var debugInfo = root._debugInfo; + var children = root._children, + debugInfo = root._debugInfo; if (debugInfo) { for (var startTime$jscomp$0 = 0, i = 0; i < debugInfo.length; i++) { var info = debugInfo[i]; @@ -3710,6 +3746,20 @@ result.endTime = childrenEndTime; return result; } + function flushInitialRenderPerformance(response) { + if (response._replayConsole) { + var rootChunk = getChunk(response, 0); + isArrayImpl(rootChunk._children) && + (markAllTracksInOrder(), + flushComponentPerformance( + response, + rootChunk, + 0, + -Infinity, + -Infinity + )); + } + } function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -3780,7 +3830,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, createErrorChunk(response, tag)); break; case 84: @@ -3832,84 +3882,95 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(response, chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + function processBinaryChunk(weakResponse, chunk) { + if (void 0 !== weakResponse.weak.deref()) { + weakResponse = unwrapWeakResponse(weakResponse); + for ( + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, + chunkLength = chunk.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 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); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = chunk[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 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( + weakResponse, + rowID, + rowTag, + buffer, + rowLength + ), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; 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, rowID, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = rowID = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; + } } + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -3991,8 +4052,8 @@ return value; }; } - function close(response) { - reportGlobalError(response, Error("Connection closed.")); + function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw Error( @@ -4014,7 +4075,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { @@ -4137,7 +4198,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, initializingChunk = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), @@ -4247,14 +4312,14 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromNodeStream = function ( stream, serverConsumerManifest, options ) { - var response = new ResponseInstance( + var response$jscomp$0 = new ResponseInstance( serverConsumerManifest.moduleMap, serverConsumerManifest.serverModuleMap, serverConsumerManifest.moduleLoading, @@ -4266,109 +4331,112 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + if (void 0 !== response$jscomp$0.weak.deref()) { + for ( + var response = unwrapWeakResponse(response$jscomp$0), + i = 0, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._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) + ) { + 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." ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) + 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." ); - 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." - ); + } + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; - } else processBinaryChunk(response, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { - reportGlobalError(response, error); + reportGlobalError(response$jscomp$0, error); }); stream.on("end", function () { - return close(response); + return close(response$jscomp$0); }); - return getChunk(response, 0); + return getRoot(response$jscomp$0); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall$1); 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 f2c4805621fe2e..1549691d8567ab 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 @@ -786,15 +786,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -823,15 +821,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -875,11 +873,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -970,14 +969,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1094,7 +1094,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1369,24 +1369,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1576,7 +1576,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1730,7 +1730,7 @@ function processFullStringRow(response, id, tag, row) { tag = response._chunks; var chunk = tag.get(id); chunk - ? triggerErrorOnChunk(chunk, row) + ? triggerErrorOnChunk(response, chunk, row) : tag.set(id, createErrorChunk(response, row)); break; case 84: @@ -1771,7 +1771,7 @@ function processFullStringRow(response, id, tag, row) { row.stack = "Error: " + row.message; tag = response._chunks; (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, row) + ? triggerErrorOnChunk(response, chunk, row) : tag.set(id, createErrorChunk(response, row)); break; default: @@ -1781,14 +1781,14 @@ function processFullStringRow(response, id, tag, row) { : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(response, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1842,7 +1842,7 @@ function processBinaryChunk(response, chunk) { var offset = chunk.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, rowID, rowTag, buffer, rowLength), + processFullBinaryRow(weakResponse, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -1854,10 +1854,10 @@ function processBinaryChunk(response, chunk) { break; } } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1894,8 +1894,8 @@ function createFromJSONCallback(response) { return value; }; } -function close(response) { - reportGlobalError(response, Error("Connection closed.")); +function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw 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 885d84ab03f41e..5e2fe6bff81cfa 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 @@ -652,9 +652,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -677,7 +677,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -858,6 +858,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -880,6 +881,7 @@ : null; type = this.timeOrigin = performance.now(); emitTimeOriginChunk(this, type + performance.timeOrigin); + this.abortTime = -0; model = createTask( this, model, @@ -953,7 +955,7 @@ return currentRequest ? currentRequest : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -964,15 +966,7 @@ ref ); case "rejected": - return ( - (thenable = thenable.reason), - "object" === typeof thenable && - null !== thenable && - thenable.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, thenable) - : emitErrorChunk(request, id, "", thenable, !0), - ref - ); + return emitErrorChunk(request, id, "", thenable.reason, !0), ref; } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; @@ -991,11 +985,7 @@ ((cancelled = !0), request.status === ABORTING ? emitDebugHaltChunk(request, id) - : "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, reason) - : emitErrorChunk(request, id, "", reason, !0), + : emitErrorChunk(request, id, "", reason, !0), enqueueFlush(request)); } ); @@ -1051,8 +1041,10 @@ return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), finishHaltedTask(newTask, request)) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -1125,8 +1117,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1213,8 +1204,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1386,7 +1376,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1772,7 +1762,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1852,7 +1842,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1860,7 +1850,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1939,7 +1929,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1965,8 +1955,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2000,7 +1991,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2612,7 +2603,7 @@ ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; tainted = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2631,7 +2622,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2870,7 +2861,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2898,7 +2889,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2991,12 +2982,12 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } function emitTimeOriginChunk(request, timeOrigin) { - request.pendingChunks++; + request.pendingDebugChunks++; timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); request.completedDebugChunks.push(timeOrigin); } @@ -3007,7 +2998,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; @@ -3015,7 +3006,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id$jscomp$0 = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -3066,11 +3057,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); } } @@ -3084,31 +3075,20 @@ } function forwardDebugInfoFromAbortedTask(request, task) { var model = task.model; - if ("object" === typeof model && null !== model) { - var debugInfo; - (debugInfo = model._debugInfo) && - forwardDebugInfo(request, task, debugInfo); - if ( - "function" !== typeof model.then && - model.$$typeof === REACT_LAZY_TYPE - ) { - request = model._payload; - model = model._init; - try { - model(request); - } catch (x) {} - } - } + "object" === typeof model && + null !== model && + (model = model._debugInfo) && + forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; + 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 && + (request.status === ABORTING && timestamp > request.abortTime) || (timestamp > task.time ? (emitTimingChunk(request, task.id, timestamp), (task.time = timestamp)) @@ -3199,7 +3179,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) @@ -3217,11 +3197,17 @@ callOnAllReadyIfReady(request); } catch (thrownValue) { if (request.status === ABORTING) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), finishHaltedTask(task, request); + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -3275,19 +3261,23 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), - task.timed && markOperationEndTime(request, task, performance.now()), + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), + task.timed && markOperationEndTime(request, task, request.abortTime), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } - function haltTask(task, request) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), + function haltTask(task) { + 0 === task.status && (task.status = 3); + } + function finishHaltedTask(task, request) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } function flushCompletedChunks(request, destination) { @@ -3319,7 +3309,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3360,6 +3350,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (cleanupTaintQueue(request), request.status < ABORTING && request.cacheController.abort( @@ -3408,62 +3399,98 @@ } } } - function abort(request, reason) { + function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then + abortedTasks.forEach(function (task) { + return finishHaltedTask(task, request); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.abortTime = performance.now(); + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + scheduleWork(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason ? Error( - "The render was aborted by the server with a promise." + "The render was aborted by the server without a reason." ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - abortableTasks.clear(); - callOnAllReadyIfReady(request); + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); } - null !== request.destination && - flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); - } } function fromHex(str) { return parseInt(str, 16); @@ -3475,7 +3502,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4259,7 +4286,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 d114e9b9dd8a9c..80baa43e289c84 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,8 +819,11 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -887,8 +890,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -970,8 +972,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1346,7 +1347,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1373,7 +1374,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1598,7 +1599,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); value = "$" === value[0] ? "$" + value : value; @@ -1755,7 +1756,7 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( String.fromCharCode.apply( @@ -1769,27 +1770,27 @@ function emitTypedArrayChunk(request, id, tag, typedArray) { ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; - tainted = new Uint8Array( + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? tainted.slice() : tainted; - tainted = typedArray.byteLength; - id = id.toString(16) + ":" + tag + tainted.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } @@ -1798,33 +1799,33 @@ function emitChunk(request, task, value) { "string" === typeof value && null !== byteLengthOfChunk ? ((task = TaintRegistryValues.get(value)), void 0 !== task && throwTaintViolation(task.message), - emitTextChunk(request, id, value)) + emitTextChunk(request, id, value, !1)) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1869,11 +1870,17 @@ function retryTask(request, task) { callOnAllReadyIfReady(request); } catch (thrownValue) { if (12 === request.status) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), 3 === task.status && request.pendingChunks--; + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -1923,15 +1930,17 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function haltTask(task, request) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); +function haltTask(task) { + 0 === task.status && (task.status = 3); } function flushCompletedChunks(request, destination) { currentView = new Uint8Array(2048); @@ -2016,58 +2025,98 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + 3 === task.status && request.pendingChunks--; + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$28) { - logRecoverableError(request, error$28, null), fatalError(request, error$28); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } +} +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + scheduleWork(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; + request.pendingChunks++; + emitErrorChunk(request, errorId$27, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$27); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId$27); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 ec63ccee4e1866..4d0c9b277c26b4 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 @@ -659,9 +659,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -684,7 +684,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -865,6 +865,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -887,6 +888,7 @@ : null; type = this.timeOrigin = performance.now(); emitTimeOriginChunk(this, type + performance.timeOrigin); + this.abortTime = -0; model = createTask( this, model, @@ -965,7 +967,7 @@ return null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -976,15 +978,7 @@ ref ); case "rejected": - return ( - (thenable = thenable.reason), - "object" === typeof thenable && - null !== thenable && - thenable.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, thenable) - : emitErrorChunk(request, id, "", thenable, !0), - ref - ); + return emitErrorChunk(request, id, "", thenable.reason, !0), ref; } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; @@ -1003,11 +997,7 @@ ((cancelled = !0), request.status === ABORTING ? emitDebugHaltChunk(request, id) - : "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, reason) - : emitErrorChunk(request, id, "", reason, !0), + : emitErrorChunk(request, id, "", reason, !0), enqueueFlush(request)); } ); @@ -1063,8 +1053,10 @@ return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), finishHaltedTask(newTask, request)) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -1137,8 +1129,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1225,8 +1216,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1398,7 +1388,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1832,7 +1822,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1912,7 +1902,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1920,7 +1910,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1999,7 +1989,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -2025,8 +2015,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2060,7 +2051,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2694,7 +2685,7 @@ ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; tainted = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2713,7 +2704,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2952,7 +2943,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2980,7 +2971,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -3073,12 +3064,12 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } function emitTimeOriginChunk(request, timeOrigin) { - request.pendingChunks++; + request.pendingDebugChunks++; timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); request.completedDebugChunks.push(timeOrigin); } @@ -3089,7 +3080,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; @@ -3097,7 +3088,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id$jscomp$0 = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -3148,11 +3139,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); } } @@ -3166,31 +3157,20 @@ } function forwardDebugInfoFromAbortedTask(request, task) { var model = task.model; - if ("object" === typeof model && null !== model) { - var debugInfo; - (debugInfo = model._debugInfo) && - forwardDebugInfo(request, task, debugInfo); - if ( - "function" !== typeof model.then && - model.$$typeof === REACT_LAZY_TYPE - ) { - request = model._payload; - model = model._init; - try { - model(request); - } catch (x) {} - } - } + "object" === typeof model && + null !== model && + (model = model._debugInfo) && + forwardDebugInfo(request, task, model); } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; + 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 && + (request.status === ABORTING && timestamp > request.abortTime) || (timestamp > task.time ? (emitTimingChunk(request, task.id, timestamp), (task.time = timestamp)) @@ -3281,7 +3261,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) @@ -3299,11 +3279,17 @@ callOnAllReadyIfReady(request); } catch (thrownValue) { if (request.status === ABORTING) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), finishHaltedTask(task, request); + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -3357,19 +3343,23 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), - task.timed && markOperationEndTime(request, task, performance.now()), + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), + task.timed && markOperationEndTime(request, task, request.abortTime), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } - function haltTask(task, request) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), + function haltTask(task) { + 0 === task.status && (task.status = 3); + } + function finishHaltedTask(task, request) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } function flushCompletedChunks(request, destination) { @@ -3401,7 +3391,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3442,6 +3432,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (cleanupTaintQueue(request), request.status < ABORTING && request.cacheController.abort( @@ -3494,62 +3485,98 @@ } } } - function abort(request, reason) { + function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then + abortedTasks.forEach(function (task) { + return finishHaltedTask(task, request); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.abortTime = performance.now(); + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setTimeout(function () { + return finishHalt(request, abortableTasks); + }, 0); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId); + }, 0); + } else { + var error = + void 0 === reason ? Error( - "The render was aborted by the server with a promise." + "The render was aborted by the server without a reason." ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, _errorId2); + }, 0); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - abortableTasks.clear(); - callOnAllReadyIfReady(request); + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); } - null !== request.destination && - flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); - } } function fromHex(str) { return parseInt(str, 16); @@ -3561,7 +3588,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4341,7 +4368,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 e1640e67adcb89..7197da06009e5f 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,8 +818,11 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -886,8 +889,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -969,8 +971,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1345,7 +1346,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1372,7 +1373,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1597,7 +1598,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); value = "$" === value[0] ? "$" + value : value; @@ -1758,7 +1759,7 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( String.fromCharCode.apply( @@ -1772,27 +1773,27 @@ function emitTypedArrayChunk(request, id, tag, typedArray) { ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; - tainted = new Uint8Array( + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? tainted.slice() : tainted; - tainted = typedArray.byteLength; - id = id.toString(16) + ":" + tag + tainted.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } @@ -1801,33 +1802,33 @@ function emitChunk(request, task, value) { "string" === typeof value && null !== byteLengthOfChunk ? ((task = TaintRegistryValues.get(value)), void 0 !== task && throwTaintViolation(task.message), - emitTextChunk(request, id, value)) + emitTextChunk(request, id, value, !1)) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1872,11 +1873,17 @@ function retryTask(request, task) { callOnAllReadyIfReady(request); } catch (thrownValue) { if (12 === request.status) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), 3 === task.status && request.pendingChunks--; + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -1926,15 +1933,17 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function haltTask(task, request) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); +function haltTask(task) { + 0 === task.status && (task.status = 3); } function flushCompletedChunks(request, destination) { currentView = new Uint8Array(2048); @@ -2023,58 +2032,98 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + 3 === task.status && request.pendingChunks--; + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$28) { - logRecoverableError(request, error$28, null), fatalError(request, error$28); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } +} +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setTimeout(function () { + return finishHalt(request, abortableTasks); + }, 0); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId); + }, 0); + } else { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; + request.pendingChunks++; + emitErrorChunk(request, errorId$27, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$27); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId$27); + }, 0); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 839a546c1dfcdf..03e48866a6a19b 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 @@ -690,7 +690,7 @@ var envIdx = url.indexOf("/", 12), suffixIdx = url.lastIndexOf("?"); if (-1 < envIdx && -1 < suffixIdx) - return url.slice(envIdx + 1, suffixIdx); + return decodeURI(url.slice(envIdx + 1, suffixIdx)); } return url; } @@ -700,7 +700,7 @@ var callsite = stack[i], functionName = callsite[0], url = devirtualizeURL(callsite[1]); - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -723,7 +723,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -903,6 +903,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -925,6 +926,7 @@ : null; type = this.timeOrigin = performance.now(); emitTimeOriginChunk(this, type + performance.timeOrigin); + this.abortTime = -0; model = createTask( this, model, @@ -1000,7 +1002,7 @@ return store ? store : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1011,15 +1013,7 @@ ref ); case "rejected": - return ( - (thenable = thenable.reason), - "object" === typeof thenable && - null !== thenable && - thenable.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, thenable) - : emitErrorChunk(request, id, "", thenable, !0), - ref - ); + return emitErrorChunk(request, id, "", thenable.reason, !0), ref; } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; @@ -1038,11 +1032,7 @@ ((cancelled = !0), request.status === ABORTING ? emitDebugHaltChunk(request, id) - : "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, reason) - : emitErrorChunk(request, id, "", reason, !0), + : emitErrorChunk(request, id, "", reason, !0), enqueueFlush(request)); } ); @@ -1098,8 +1088,10 @@ return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), finishHaltedTask(newTask, request)) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -1172,8 +1164,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1260,8 +1251,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1432,7 +1422,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1755,83 +1745,102 @@ function visitAsyncNode(request, task, node, visited, cutOff) { if (visited.has(node)) return null; visited.add(node); - null !== node.previous && + var previousIONode = null; + if ( + null !== node.previous && node.end > request.timeOrigin && - visitAsyncNode(request, task, node.previous, visited, cutOff); + ((previousIONode = visitAsyncNode( + request, + task, + node.previous, + visited, + cutOff + )), + void 0 === previousIONode) + ) + return; switch (node.tag) { case 0: return node; case 3: - return null; + return previousIONode; case 1: - if (node.end <= request.timeOrigin) return null; - var awaited = node.awaited, - match = null; - null !== awaited && - ((awaited = visitAsyncNode( - request, - task, - awaited, - visited, - cutOff - )), - null !== awaited && - (match = - 1 === awaited.tag - ? awaited - : 0 === filterStackTrace(request, node.stack).length + if (node.end <= request.timeOrigin) return previousIONode; + var awaited = node.awaited; + if (null !== awaited) { + awaited = visitAsyncNode(request, task, awaited, visited, cutOff); + if (void 0 === awaited) break; + null !== awaited + ? (previousIONode = + 1 === awaited.tag ? awaited - : node)); + : 0 === filterStackTrace(request, node.stack).length + ? awaited + : node) + : request.status === ABORTING && + node.start < request.abortTime && + node.end > request.abortTime && + 0 < filterStackTrace(request, node.stack).length && + (previousIONode = node); + } node = node.promise.deref(); void 0 !== node && ((node = node._debugInfo), null == node || visited.has(node) || (visited.add(node), forwardDebugInfo(request, task, node))); - return match; + return previousIONode; case 4: - return null; + return previousIONode; case 2: - var _awaited = node.awaited; - match = null; - if ( - null !== _awaited && - ((awaited = visitAsyncNode( + awaited = node.awaited; + if (null !== awaited) { + var _ioNode = visitAsyncNode( request, task, - _awaited, + awaited, visited, cutOff - )), - null !== awaited) - ) { - var startTime = node.start, - endTime = node.end; - if (endTime <= request.timeOrigin) return null; - if (startTime < cutOff) match = awaited; - else { - cutOff = !1; - var fullStack = node.stack; - if (0 < fullStack.length) { - cutOff = request.filterStackFrame; - var callsite = fullStack[0]; - fullStack = callsite[0]; - callsite = devirtualizeURL(callsite[1]); - cutOff = cutOff(callsite, fullStack); + ); + if (void 0 === _ioNode) break; + if (null !== _ioNode) { + var startTime = node.start, + endTime = node.end; + if (endTime <= request.timeOrigin) return null; + if (startTime < cutOff) previousIONode = _ioNode; + else { + cutOff = !1; + for ( + var fullStack = node.stack, firstFrame = 0; + fullStack.length > firstFrame && + "Promise.then" === fullStack[firstFrame][0]; + + ) + firstFrame++; + if (fullStack.length > firstFrame) { + cutOff = request.filterStackFrame; + fullStack = fullStack[firstFrame]; + firstFrame = fullStack[0]; + var url = devirtualizeURL(fullStack[1]); + cutOff = cutOff(url, firstFrame, fullStack[2], fullStack[3]); + } + cutOff + ? (request.status === ABORTING && + startTime > request.abortTime) || + (serializeIONode(request, _ioNode, awaited.promise), + (awaited = (0, request.environmentName)()), + advanceTaskTime(request, task, startTime), + request.pendingDebugChunks++, + emitDebugChunk(request, task.id, { + awaited: _ioNode, + env: awaited, + owner: node.owner, + stack: filterStackTrace(request, node.stack) + }), + markOperationEndTime(request, task, endTime), + request.status === ABORTING && (previousIONode = void 0)) + : (previousIONode = _ioNode); } - cutOff - ? (serializeIONode(request, awaited, _awaited.promise), - (_awaited = (0, request.environmentName)()), - advanceTaskTime(request, task, startTime), - request.pendingChunks++, - emitDebugChunk(request, task.id, { - awaited: awaited, - env: _awaited, - owner: node.owner, - stack: filterStackTrace(request, node.stack) - }), - markOperationEndTime(request, task, endTime)) - : (match = awaited); } } node = node.promise.deref(); @@ -1840,7 +1849,7 @@ null == node || visited.has(node) || (visited.add(node), forwardDebugInfo(request, task, node))); - return match; + return previousIONode; default: throw Error("Unknown AsyncSequence tag. This is a bug in React."); } @@ -1856,9 +1865,10 @@ var visited = new Set(); alreadyForwardedDebugInfo && visited.add(alreadyForwardedDebugInfo); node = visitAsyncNode(request, task, node, visited, task.time); - null !== node && + void 0 !== node && + null !== node && (serializeIONode(request, node, node.promise), - request.pendingChunks++, + request.pendingDebugChunks++, (alreadyForwardedDebugInfo = (0, request.environmentName)()), (alreadyForwardedDebugInfo = { awaited: node, @@ -1961,7 +1971,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -2040,7 +2050,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -2048,7 +2058,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -2127,7 +2137,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -2153,8 +2163,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2188,7 +2199,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2832,19 +2843,22 @@ i++ ) { var callsite = name[i], - functionName = callsite[0]; - callsite = devirtualizeURL(callsite[1]); - if (filterStackFrame(callsite, functionName)) { - if ("" === bestMatch) { - name = functionName; - break a; - } - name = bestMatch; - break a; - } else + functionName = callsite[0], + url = devirtualizeURL(callsite[1]), + lineNumber = callsite[2]; + callsite = callsite[3]; + if ( "new Promise" !== functionName && - "node:internal/async_hooks" !== callsite && - (bestMatch = functionName); + "node:internal/async_hooks" !== url + ) + if (filterStackFrame(url, functionName, lineNumber, callsite)) { + if ("" === bestMatch) { + name = functionName; + break a; + } + name = bestMatch; + break a; + } else bestMatch = functionName; } name = ""; } @@ -2857,8 +2871,8 @@ filterStackFrame = void 0; null !== promiseRef && (filterStackFrame = promiseRef.deref()); promiseRef = (0, request.environmentName)(); - i = 3 === ioNode.tag ? performance.now() : ioNode.end; - request.pendingChunks++; + i = 3 === ioNode.tag ? request.abortTime : ioNode.end; + request.pendingDebugChunks++; functionName = request.nextChunkId++; emitIOInfoChunk( request, @@ -2889,7 +2903,7 @@ ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2906,7 +2920,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var binaryLength = byteLengthOfChunk(text); id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; debug @@ -3143,7 +3157,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -3171,7 +3185,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -3263,12 +3277,12 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } function emitTimeOriginChunk(request, timeOrigin) { - request.pendingChunks++; + request.pendingDebugChunks++; request.completedDebugChunks.push(":N" + timeOrigin + "\n"); } function forwardDebugInfo(request$jscomp$0, task, debugInfo) { @@ -3278,7 +3292,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; @@ -3286,7 +3300,7 @@ var request = request$jscomp$0, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id$jscomp$0 = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -3325,11 +3339,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); } } @@ -3362,42 +3376,34 @@ (debugInfo = model._debugInfo) && forwardDebugInfo(request, task, debugInfo); var thenable = null; - if ("function" === typeof model.then) thenable = model; - else if (model.$$typeof === REACT_LAZY_TYPE) { - var payload = model._payload; - model = model._init; - try { - model(payload); - } catch (x) { - "object" === typeof x && - null !== x && - "function" === typeof x.then && - (thenable = x); - } - } + "function" === typeof model.then + ? (thenable = model) + : model.$$typeof === REACT_LAZY_TYPE && + ((model = model._payload), + "function" === typeof model.then && (thenable = model)); if ( null !== thenable && - ((payload = getAsyncSequenceFromPromise(thenable)), null !== payload) + ((model = getAsyncSequenceFromPromise(thenable)), null !== model) ) { for ( - thenable = payload; + thenable = model; 4 === thenable.tag && null !== thenable.awaited; ) 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), emitDebugChunk(request, task.id, debugInfo)) - : emitAsyncSequence(request, task, payload, debugInfo, null, null); + : emitAsyncSequence(request, task, model, debugInfo, null, null); } } } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; + request.pendingDebugChunks++; timestamp -= request.timeOrigin; id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; request.completedDebugChunks.push(id); @@ -3410,7 +3416,7 @@ task.timed = !0; } function markOperationEndTime(request, task, timestamp) { - request.status !== ABORTING && + (request.status === ABORTING && timestamp > request.abortTime) || (timestamp > task.time ? (emitTimingChunk(request, task.id, timestamp), (task.time = timestamp)) @@ -3506,7 +3512,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) @@ -3525,11 +3531,17 @@ callOnAllReadyIfReady(request); } catch (thrownValue) { if (request.status === ABORTING) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), finishHaltedTask(task, request); + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -3584,19 +3596,23 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), - task.timed && markOperationEndTime(request, task, performance.now()), + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), + task.timed && markOperationEndTime(request, task, request.abortTime), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } - function haltTask(task, request) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), + function haltTask(task) { + 0 === task.status && (task.status = 3); + } + function finishHaltedTask(task, request) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } function flushCompletedChunks(request, destination) { @@ -3629,7 +3645,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3670,6 +3686,7 @@ } "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (cleanupTaintQueue(request), request.status < ABORTING && request.cacheController.abort( @@ -3717,62 +3734,98 @@ } } } - function abort(request, reason) { + function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then + abortedTasks.forEach(function (task) { + return finishHaltedTask(task, request); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.abortTime = performance.now(); + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setImmediate(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason ? Error( - "The render was aborted by the server with a promise." + "The render was aborted by the server without a reason." ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - abortableTasks.clear(); - callOnAllReadyIfReady(request); + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); } - null !== request.destination && - flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); - } } function fromHex(str) { return parseInt(str, 16); @@ -3791,7 +3844,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(request)); @@ -3823,7 +3876,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -5252,7 +5305,23 @@ var currentAsyncId = async_hooks.executionAsyncId(); asyncId !== currentAsyncId && ((asyncId = pendingOperations.get(currentAsyncId)), - (node.awaited = void 0 === asyncId ? null : asyncId)); + 1 === node.tag + ? (node.awaited = void 0 === asyncId ? null : asyncId) + : void 0 !== asyncId && + ((currentAsyncId = { + tag: 2, + owner: node.owner, + stack: node.stack, + start: node.start, + end: node.end, + promise: node.promise, + awaited: node.awaited, + previous: node.previous + }), + (node.start = node.end), + (node.end = performance.now()), + (node.previous = currentAsyncId), + (node.awaited = asyncId))); } }, destroy: function (asyncId) { @@ -5444,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_221 = []; + var JSCompiler_object_inline_chunks_229 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_221.push(chunk); + JSCompiler_object_inline_chunks_229.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_221, { + var blob = new Blob(JSCompiler_object_inline_chunks_229, { 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.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js index e8679b987be83b..3c2a3dccdcf39d 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,8 +841,11 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -909,8 +912,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -992,8 +994,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1365,7 +1366,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1392,7 +1393,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1617,7 +1618,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); value = "$" === value[0] ? "$" + value : value; @@ -1765,7 +1766,7 @@ function emitErrorChunk(request, id, digest) { id = id.toString(16) + ":E" + stringify(digest) + "\n"; request.completedErrorChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( String.fromCharCode.apply( @@ -1779,24 +1780,24 @@ function emitTypedArrayChunk(request, id, tag, typedArray) { ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - tainted = typedArray.byteLength; - id = id.toString(16) + ":" + tag + tainted.toString(16) + ","; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; - var binaryLength = byteLengthOfChunk(text); - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = byteLengthOfChunk(text); + id = id.toString(16) + ":T" + debug.toString(16) + ","; request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { @@ -1804,33 +1805,33 @@ function emitChunk(request, task, value) { "string" === typeof value && null !== byteLengthOfChunk ? ((task = TaintRegistryValues.get(value)), void 0 !== task && throwTaintViolation(task.message), - emitTextChunk(request, id, value)) + emitTextChunk(request, id, value, !1)) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), (task = task.id.toString(16) + ":" + value + "\n"), @@ -1878,11 +1879,17 @@ function retryTask(request, task) { callOnAllReadyIfReady(request); } catch (thrownValue) { if (12 === request.status) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), 3 === task.status && request.pendingChunks--; + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -1932,15 +1939,17 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function haltTask(task, request) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); +function haltTask(task) { + 0 === task.status && (task.status = 3); } function flushCompletedChunks(request, destination) { currentView = new Uint8Array(2048); @@ -2049,58 +2058,98 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + 3 === task.status && request.pendingChunks--; + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$28) { - logRecoverableError(request, error$28, null), fatalError(request, error$28); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } +} +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setImmediate(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; + request.pendingChunks++; + emitErrorChunk(request, errorId$27, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$27); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId$27); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; @@ -2979,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_255 = []; + var JSCompiler_object_inline_chunks_263 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_255.push(chunk); + JSCompiler_object_inline_chunks_263.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_255, { + 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 966c46abd27853..a8aa4464a5b0f6 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 @@ -690,7 +690,7 @@ var envIdx = url.indexOf("/", 12), suffixIdx = url.lastIndexOf("?"); if (-1 < envIdx && -1 < suffixIdx) - return url.slice(envIdx + 1, suffixIdx); + return decodeURI(url.slice(envIdx + 1, suffixIdx)); } return url; } @@ -700,7 +700,7 @@ var callsite = stack[i], functionName = callsite[0], url = devirtualizeURL(callsite[1]); - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -723,7 +723,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -903,6 +903,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -925,6 +926,7 @@ : null; type = this.timeOrigin = performance.now(); emitTimeOriginChunk(this, type + performance.timeOrigin); + this.abortTime = -0; model = createTask( this, model, @@ -1000,7 +1002,7 @@ return store ? store : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1011,15 +1013,7 @@ ref ); case "rejected": - return ( - (thenable = thenable.reason), - "object" === typeof thenable && - null !== thenable && - thenable.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, thenable) - : emitErrorChunk(request, id, "", thenable, !0), - ref - ); + return emitErrorChunk(request, id, "", thenable.reason, !0), ref; } if (request.status === ABORTING) return emitDebugHaltChunk(request, id), ref; @@ -1038,11 +1032,7 @@ ((cancelled = !0), request.status === ABORTING ? emitDebugHaltChunk(request, id) - : "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? emitPostponeChunk(request, id, reason) - : emitErrorChunk(request, id, "", reason, !0), + : emitErrorChunk(request, id, "", reason, !0), enqueueFlush(request)); } ); @@ -1098,8 +1088,10 @@ return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), finishHaltedTask(newTask, request)) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -1172,8 +1164,7 @@ signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1260,8 +1251,7 @@ signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1432,7 +1422,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1755,83 +1745,102 @@ function visitAsyncNode(request, task, node, visited, cutOff) { if (visited.has(node)) return null; visited.add(node); - null !== node.previous && + var previousIONode = null; + if ( + null !== node.previous && node.end > request.timeOrigin && - visitAsyncNode(request, task, node.previous, visited, cutOff); + ((previousIONode = visitAsyncNode( + request, + task, + node.previous, + visited, + cutOff + )), + void 0 === previousIONode) + ) + return; switch (node.tag) { case 0: return node; case 3: - return null; + return previousIONode; case 1: - if (node.end <= request.timeOrigin) return null; - var awaited = node.awaited, - match = null; - null !== awaited && - ((awaited = visitAsyncNode( - request, - task, - awaited, - visited, - cutOff - )), - null !== awaited && - (match = - 1 === awaited.tag - ? awaited - : 0 === filterStackTrace(request, node.stack).length + if (node.end <= request.timeOrigin) return previousIONode; + var awaited = node.awaited; + if (null !== awaited) { + awaited = visitAsyncNode(request, task, awaited, visited, cutOff); + if (void 0 === awaited) break; + null !== awaited + ? (previousIONode = + 1 === awaited.tag ? awaited - : node)); + : 0 === filterStackTrace(request, node.stack).length + ? awaited + : node) + : request.status === ABORTING && + node.start < request.abortTime && + node.end > request.abortTime && + 0 < filterStackTrace(request, node.stack).length && + (previousIONode = node); + } node = node.promise.deref(); void 0 !== node && ((node = node._debugInfo), null == node || visited.has(node) || (visited.add(node), forwardDebugInfo(request, task, node))); - return match; + return previousIONode; case 4: - return null; + return previousIONode; case 2: - var _awaited = node.awaited; - match = null; - if ( - null !== _awaited && - ((awaited = visitAsyncNode( + awaited = node.awaited; + if (null !== awaited) { + var _ioNode = visitAsyncNode( request, task, - _awaited, + awaited, visited, cutOff - )), - null !== awaited) - ) { - var startTime = node.start, - endTime = node.end; - if (endTime <= request.timeOrigin) return null; - if (startTime < cutOff) match = awaited; - else { - cutOff = !1; - var fullStack = node.stack; - if (0 < fullStack.length) { - cutOff = request.filterStackFrame; - var callsite = fullStack[0]; - fullStack = callsite[0]; - callsite = devirtualizeURL(callsite[1]); - cutOff = cutOff(callsite, fullStack); + ); + if (void 0 === _ioNode) break; + if (null !== _ioNode) { + var startTime = node.start, + endTime = node.end; + if (endTime <= request.timeOrigin) return null; + if (startTime < cutOff) previousIONode = _ioNode; + else { + cutOff = !1; + for ( + var fullStack = node.stack, firstFrame = 0; + fullStack.length > firstFrame && + "Promise.then" === fullStack[firstFrame][0]; + + ) + firstFrame++; + if (fullStack.length > firstFrame) { + cutOff = request.filterStackFrame; + fullStack = fullStack[firstFrame]; + firstFrame = fullStack[0]; + var url = devirtualizeURL(fullStack[1]); + cutOff = cutOff(url, firstFrame, fullStack[2], fullStack[3]); + } + cutOff + ? (request.status === ABORTING && + startTime > request.abortTime) || + (serializeIONode(request, _ioNode, awaited.promise), + (awaited = (0, request.environmentName)()), + advanceTaskTime(request, task, startTime), + request.pendingDebugChunks++, + emitDebugChunk(request, task.id, { + awaited: _ioNode, + env: awaited, + owner: node.owner, + stack: filterStackTrace(request, node.stack) + }), + markOperationEndTime(request, task, endTime), + request.status === ABORTING && (previousIONode = void 0)) + : (previousIONode = _ioNode); } - cutOff - ? (serializeIONode(request, awaited, _awaited.promise), - (_awaited = (0, request.environmentName)()), - advanceTaskTime(request, task, startTime), - request.pendingChunks++, - emitDebugChunk(request, task.id, { - awaited: awaited, - env: _awaited, - owner: node.owner, - stack: filterStackTrace(request, node.stack) - }), - markOperationEndTime(request, task, endTime)) - : (match = awaited); } } node = node.promise.deref(); @@ -1840,7 +1849,7 @@ null == node || visited.has(node) || (visited.add(node), forwardDebugInfo(request, task, node))); - return match; + return previousIONode; default: throw Error("Unknown AsyncSequence tag. This is a bug in React."); } @@ -1856,9 +1865,10 @@ var visited = new Set(); alreadyForwardedDebugInfo && visited.add(alreadyForwardedDebugInfo); node = visitAsyncNode(request, task, node, visited, task.time); - null !== node && + void 0 !== node && + null !== node && (serializeIONode(request, node, node.promise), - request.pendingChunks++, + request.pendingDebugChunks++, (alreadyForwardedDebugInfo = (0, request.environmentName)()), (alreadyForwardedDebugInfo = { awaited: node, @@ -1961,7 +1971,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -2040,7 +2050,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -2048,7 +2058,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -2127,7 +2137,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -2153,8 +2163,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2188,7 +2199,7 @@ signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -2832,19 +2843,22 @@ i++ ) { var callsite = name[i], - functionName = callsite[0]; - callsite = devirtualizeURL(callsite[1]); - if (filterStackFrame(callsite, functionName)) { - if ("" === bestMatch) { - name = functionName; - break a; - } - name = bestMatch; - break a; - } else + functionName = callsite[0], + url = devirtualizeURL(callsite[1]), + lineNumber = callsite[2]; + callsite = callsite[3]; + if ( "new Promise" !== functionName && - "node:internal/async_hooks" !== callsite && - (bestMatch = functionName); + "node:internal/async_hooks" !== url + ) + if (filterStackFrame(url, functionName, lineNumber, callsite)) { + if ("" === bestMatch) { + name = functionName; + break a; + } + name = bestMatch; + break a; + } else bestMatch = functionName; } name = ""; } @@ -2857,8 +2871,8 @@ filterStackFrame = void 0; null !== promiseRef && (filterStackFrame = promiseRef.deref()); promiseRef = (0, request.environmentName)(); - i = 3 === ioNode.tag ? performance.now() : ioNode.end; - request.pendingChunks++; + i = 3 === ioNode.tag ? request.abortTime : ioNode.end; + request.pendingDebugChunks++; functionName = request.nextChunkId++; emitIOInfoChunk( request, @@ -2889,7 +2903,7 @@ ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2906,7 +2920,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var binaryLength = byteLengthOfChunk(text); id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; debug @@ -3143,7 +3157,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -3171,7 +3185,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -3263,12 +3277,12 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } function emitTimeOriginChunk(request, timeOrigin) { - request.pendingChunks++; + request.pendingDebugChunks++; request.completedDebugChunks.push(":N" + timeOrigin + "\n"); } function forwardDebugInfo(request$jscomp$0, task, debugInfo) { @@ -3278,7 +3292,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; @@ -3286,7 +3300,7 @@ var request = request$jscomp$0, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id$jscomp$0 = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -3325,11 +3339,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); } } @@ -3362,42 +3376,34 @@ (debugInfo = model._debugInfo) && forwardDebugInfo(request, task, debugInfo); var thenable = null; - if ("function" === typeof model.then) thenable = model; - else if (model.$$typeof === REACT_LAZY_TYPE) { - var payload = model._payload; - model = model._init; - try { - model(payload); - } catch (x) { - "object" === typeof x && - null !== x && - "function" === typeof x.then && - (thenable = x); - } - } + "function" === typeof model.then + ? (thenable = model) + : model.$$typeof === REACT_LAZY_TYPE && + ((model = model._payload), + "function" === typeof model.then && (thenable = model)); if ( null !== thenable && - ((payload = getAsyncSequenceFromPromise(thenable)), null !== payload) + ((model = getAsyncSequenceFromPromise(thenable)), null !== model) ) { for ( - thenable = payload; + thenable = model; 4 === thenable.tag && null !== thenable.awaited; ) 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), emitDebugChunk(request, task.id, debugInfo)) - : emitAsyncSequence(request, task, payload, debugInfo, null, null); + : emitAsyncSequence(request, task, model, debugInfo, null, null); } } } function emitTimingChunk(request, id, timestamp) { - request.pendingChunks++; + request.pendingDebugChunks++; timestamp -= request.timeOrigin; id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; request.completedDebugChunks.push(id); @@ -3410,7 +3416,7 @@ task.timed = !0; } function markOperationEndTime(request, task, timestamp) { - request.status !== ABORTING && + (request.status === ABORTING && timestamp > request.abortTime) || (timestamp > task.time ? (emitTimingChunk(request, task.id, timestamp), (task.time = timestamp)) @@ -3506,7 +3512,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) @@ -3525,11 +3531,17 @@ callOnAllReadyIfReady(request); } catch (thrownValue) { if (request.status === ABORTING) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), finishHaltedTask(task, request); + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -3584,19 +3596,23 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), - task.timed && markOperationEndTime(request, task, performance.now()), + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), + task.timed && markOperationEndTime(request, task, request.abortTime), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } - function haltTask(task, request) { - 5 !== task.status && - ((task.status = 3), - forwardDebugInfoFromAbortedTask(request, task), + function haltTask(task) { + 0 === task.status && (task.status = 3); + } + function finishHaltedTask(task, request) { + 3 === task.status && + (forwardDebugInfoFromAbortedTask(request, task), request.pendingChunks--); } function flushCompletedChunks(request, destination) { @@ -3629,7 +3645,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3670,6 +3686,7 @@ } "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (cleanupTaintQueue(request), request.status < ABORTING && request.cacheController.abort( @@ -3717,62 +3734,98 @@ } } } - function abort(request, reason) { + function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then + abortedTasks.forEach(function (task) { + return finishHaltedTask(task, request); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.abortTime = performance.now(); + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setImmediate(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason ? Error( - "The render was aborted by the server with a promise." + "The render was aborted by the server without a reason." ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); } - abortableTasks.clear(); - callOnAllReadyIfReady(request); + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); } - null !== request.destination && - flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); - } } function fromHex(str) { return parseInt(str, 16); @@ -3791,7 +3844,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(request)); @@ -3823,7 +3876,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -5215,7 +5268,23 @@ var currentAsyncId = async_hooks.executionAsyncId(); asyncId !== currentAsyncId && ((asyncId = pendingOperations.get(currentAsyncId)), - (node.awaited = void 0 === asyncId ? null : asyncId)); + 1 === node.tag + ? (node.awaited = void 0 === asyncId ? null : asyncId) + : void 0 !== asyncId && + ((currentAsyncId = { + tag: 2, + owner: node.owner, + stack: node.stack, + start: node.start, + end: node.end, + promise: node.promise, + awaited: node.awaited, + previous: node.previous + }), + (node.start = node.end), + (node.end = performance.now()), + (node.previous = currentAsyncId), + (node.awaited = asyncId))); } }, destroy: function (asyncId) { @@ -5407,12 +5476,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_221 = []; + var JSCompiler_object_inline_chunks_229 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_221.push(chunk); + JSCompiler_object_inline_chunks_229.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_221, { + var blob = new Blob(JSCompiler_object_inline_chunks_229, { 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.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js index cf84be8e29e54e..cce2a21d74344d 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,8 +841,11 @@ function serializeThenable(request, task, thenable) { return ( request.abortableTasks.delete(newTask), 21 === request.type - ? haltTask(newTask, request) - : abortTask(newTask, request, request.fatalError), + ? (haltTask(newTask), + 3 === newTask.status && request.pendingChunks--) + : ((task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task)), newTask.id ); "string" !== typeof thenable.status && @@ -909,8 +912,7 @@ function serializeReadableStream(request, task, stream) { signal.removeEventListener("abort", abortStream); signal = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -992,8 +994,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) { signal.removeEventListener("abort", abortIterable); var reason = signal.reason; 21 === request.type - ? (haltTask(streamTask, request), - request.abortableTasks.delete(streamTask)) + ? (haltTask(streamTask), request.abortableTasks.delete(streamTask)) : (erroredTask(request, streamTask, signal.reason), enqueueFlush(request)); "function" === typeof iterator.throw && @@ -1365,7 +1366,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1392,7 +1393,7 @@ function serializeBlob(request, blob) { signal.removeEventListener("abort", abortBlob); signal = signal.reason; 21 === request.type - ? haltTask(newTask, request) + ? haltTask(newTask) : (erroredTask(request, newTask, signal), enqueueFlush(request)); reader.cancel(signal).then(error, error); } @@ -1617,7 +1618,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); value = "$" === value[0] ? "$" + value : value; @@ -1765,7 +1766,7 @@ function emitErrorChunk(request, id, digest) { id = id.toString(16) + ":E" + stringify(digest) + "\n"; request.completedErrorChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( String.fromCharCode.apply( @@ -1779,24 +1780,24 @@ function emitTypedArrayChunk(request, id, tag, typedArray) { ); void 0 !== tainted && throwTaintViolation(tainted.message); } - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - tainted = typedArray.byteLength; - id = id.toString(16) + ":" + tag + tainted.toString(16) + ","; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; - var binaryLength = byteLengthOfChunk(text); - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = byteLengthOfChunk(text); + id = id.toString(16) + ":T" + debug.toString(16) + ","; request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { @@ -1804,33 +1805,33 @@ function emitChunk(request, task, value) { "string" === typeof value && null !== byteLengthOfChunk ? ((task = TaintRegistryValues.get(value)), void 0 !== task && throwTaintViolation(task.message), - emitTextChunk(request, id, value)) + emitTextChunk(request, id, value, !1)) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), (task = task.id.toString(16) + ":" + value + "\n"), @@ -1878,11 +1879,17 @@ function retryTask(request, task) { callOnAllReadyIfReady(request); } catch (thrownValue) { if (12 === request.status) - request.abortableTasks.delete(task), + if ( + (request.abortableTasks.delete(task), (task.status = 0), - 21 === request.type - ? haltTask(task, request) - : abortTask(task, request, request.fatalError); + 21 === request.type) + ) + haltTask(task), 3 === task.status && request.pendingChunks--; + else { + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException @@ -1932,15 +1939,17 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } -function haltTask(task, request) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); +function haltTask(task) { + 0 === task.status && (task.status = 3); } function flushCompletedChunks(request, destination) { currentView = new Uint8Array(2048); @@ -2049,58 +2058,98 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishHalt(request, abortedTasks) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - if (21 === request.type) - abortableTasks.forEach(function (task) { - return haltTask(task, request); - }); - else if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) { - logPostpone(request, reason.message, null); - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } else { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + 3 === task.status && request.pendingChunks--; + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$28) { - logRecoverableError(request, error$28, null), fatalError(request, error$28); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function finishAbort(request, abortedTasks, errorId) { + try { + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } +} +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) + if (21 === request.type) + abortableTasks.forEach(function (task) { + return haltTask(task, request); + }), + setImmediate(function () { + return finishHalt(request, abortableTasks); + }); + else if ( + "object" === typeof reason && + null !== reason && + reason.$$typeof === REACT_POSTPONE_TYPE + ) { + logPostpone(request, reason.message, null); + var errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitPostponeChunk(request, errorId, reason); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + errorId$27 = request.nextChunkId++; + request.fatalError = errorId$27; + request.pendingChunks++; + emitErrorChunk(request, errorId$27, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$27); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId$27); + }); + } + else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$28) { + logRecoverableError(request, error$28, null), + fatalError(request, error$28); + } +} function resolveServerReference(bundlerConfig, id) { var idx = id.lastIndexOf("#"); bundlerConfig = id.slice(0, idx); @@ -2945,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_255 = []; + var JSCompiler_object_inline_chunks_263 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_255.push(chunk); + JSCompiler_object_inline_chunks_263.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_255, { + 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 874849fba2bef4..caff7646520c64 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-5d87cd22-20250704", - "react-dom": "0.0.0-experimental-5d87cd22-20250704", + "react": "0.0.0-experimental-223f81d8-20250707", + "react-dom": "0.0.0-experimental-223f81d8-20250707", "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 0b6b7a02efbdfe..47e72deaf3efd3 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 @@ -764,7 +764,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -918,6 +918,17 @@ this.reason = reason; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -937,9 +948,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function wakeChunk(listeners, value) { for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; @@ -1015,15 +1044,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1046,6 +1074,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1056,15 +1085,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1107,15 +1137,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1191,7 +1225,7 @@ chunk || ((chunk = response._closed ? new ReactPromise("rejected", null, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1277,31 +1311,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1348,17 +1382,18 @@ response._debugFindSourceMapURL ); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -1371,7 +1406,7 @@ deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -1434,7 +1469,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -1803,6 +1838,8 @@ this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -1819,17 +1856,22 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -1839,18 +1881,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -1860,39 +1904,41 @@ response._bundlerConfig, model ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -1929,7 +1975,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -1994,7 +2040,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2067,11 +2113,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2476,6 +2522,7 @@ ); resolveBuffer(response, id, constructor); } + function flushInitialRenderPerformance() {} function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -2546,7 +2593,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, new ReactPromise("rejected", null, tag)); break; case 84: @@ -2702,96 +2749,99 @@ options ? !1 !== options.replayConsoleLogs : !0, options && options.environmentName ? options.environmentName : void 0, debugChannel - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -2879,7 +2929,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, @@ -2990,10 +3044,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.2.0-canary-5d87cd22-20250704", + version: "19.2.0-canary-223f81d8-20250707", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.2.0-canary-5d87cd22-20250704", + reconcilerVersion: "19.2.0-canary-223f81d8-20250707", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -3008,12 +3062,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + 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 5ff10ea5229338..e6e6c372a06871 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 @@ -655,15 +655,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -692,15 +690,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -744,11 +742,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -839,14 +838,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -887,17 +887,18 @@ function loadServerReference(response, metaData, parentObject, key) { if (!response._serverReferenceConfig) return createBoundServerReference(metaData, response._callServer); var serverReference = resolveServerReference( - response._serverReferenceConfig, - metaData.id - ); - if ((response = preloadModule(serverReference))) - metaData.bound && (response = Promise.all([response, metaData.bound])); - else if (metaData.bound) response = Promise.resolve(metaData.bound); + response._serverReferenceConfig, + metaData.id + ), + promise = preloadModule(serverReference); + if (promise) + metaData.bound && (promise = Promise.all([promise, metaData.bound])); + else if (metaData.bound) promise = Promise.resolve(metaData.bound); else return ( - (response = requireModule(serverReference)), - registerBoundServerReference(response, metaData.id, metaData.bound), - response + (promise = requireModule(serverReference)), + registerBoundServerReference(promise, metaData.id, metaData.bound), + promise ); if (initializingHandler) { var handler = initializingHandler; @@ -910,7 +911,7 @@ function loadServerReference(response, metaData, parentObject, key) { deps: 1, errored: !1 }; - response.then( + promise.then( function () { var resolvedValue = requireModule(serverReference); if (metaData.bound) { @@ -948,7 +949,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1218,24 +1219,24 @@ function resolveModule(response, id, model) { chunk = chunks.get(id); model = JSON.parse(model, response._fromJSON); var clientReference = resolveClientReference(response._bundlerConfig, model); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1425,7 +1426,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1575,10 +1576,10 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { tag = JSON.parse(buffer); buffer = resolveErrorProd(); buffer.digest = tag.digest; - response = response._chunks; - (tag = response.get(id)) - ? triggerErrorOnChunk(tag, buffer) - : response.set(id, new ReactPromise("rejected", null, buffer)); + tag = response._chunks; + (chunk = tag.get(id)) + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("rejected", null, buffer)); break; case 84: response = response._chunks; @@ -1606,9 +1607,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { startAsyncIterable(response, id, !0); break; case 67: - (id = response._chunks.get(id)) && - "fulfilled" === id.status && - id.reason.close("" === buffer ? '"$undefined"' : buffer); + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === buffer ? '"$undefined"' : buffer); break; default: (tag = response._chunks), 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 e5314261048bd6..1292c52c8a6225 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 @@ -880,7 +880,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1126,6 +1126,17 @@ this.reason = reason; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1145,9 +1156,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function wakeChunk(listeners, value) { for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; @@ -1223,15 +1252,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1254,6 +1282,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1264,15 +1293,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1315,15 +1345,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1399,7 +1433,7 @@ chunk || ((chunk = response._closed ? new ReactPromise("rejected", null, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1485,31 +1519,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1649,7 +1683,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2018,6 +2052,8 @@ this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2034,17 +2070,22 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2054,18 +2095,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2080,39 +2123,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2149,7 +2194,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2214,7 +2259,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2287,11 +2332,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2696,6 +2741,7 @@ ); resolveBuffer(response, id, constructor); } + function flushInitialRenderPerformance() {} function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -2766,7 +2812,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, new ReactPromise("rejected", null, tag)); break; case 84: @@ -2910,96 +2956,99 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { var value = _ref.value; if (_ref.done) reportGlobalError(response, Error("Connection closed.")); else { - var i = 0, - rowState = response._rowState; - _ref = response._rowID; - for ( - var rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._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[i++]; - 58 === lastIdx - ? (rowState = 1) - : (_ref = - (_ref << 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); + ) { + 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; - 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(response, _ref, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = _ref = 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; } - response._rowState = rowState; - response._rowID = _ref; - response._rowTag = rowTag; - response._rowLength = rowLength; return reader.read().then(progress).catch(error); } } @@ -3082,7 +3131,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, @@ -3191,12 +3244,12 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall); 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 9a7e3262a74d2d..05f1360b97fd68 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 @@ -816,15 +816,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -853,15 +851,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -905,11 +903,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -1000,14 +999,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1124,7 +1124,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1399,24 +1399,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1606,7 +1606,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1756,10 +1756,10 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { tag = JSON.parse(buffer); buffer = resolveErrorProd(); buffer.digest = tag.digest; - response = response._chunks; - (tag = response.get(id)) - ? triggerErrorOnChunk(tag, buffer) - : response.set(id, new ReactPromise("rejected", null, buffer)); + tag = response._chunks; + (chunk = tag.get(id)) + ? triggerErrorOnChunk(response, chunk, buffer) + : tag.set(id, new ReactPromise("rejected", null, buffer)); break; case 84: response = response._chunks; @@ -1787,9 +1787,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { startAsyncIterable(response, id, !0); break; case 67: - (id = response._chunks.get(id)) && - "fulfilled" === id.status && - id.reason.close("" === buffer ? '"$undefined"' : buffer); + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === buffer ? '"$undefined"' : buffer); break; default: (tag = response._chunks), 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 d369eaede184cd..9d3b5346ca27ba 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 @@ -880,7 +880,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1126,6 +1126,17 @@ this.reason = reason; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1145,9 +1156,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function wakeChunk(listeners, value) { for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; @@ -1223,15 +1252,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1254,6 +1282,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1264,15 +1293,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1315,15 +1345,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1399,7 +1433,7 @@ chunk || ((chunk = response._closed ? new ReactPromise("rejected", null, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1485,31 +1519,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1649,7 +1683,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -2018,6 +2052,8 @@ this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2034,17 +2070,22 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2054,18 +2095,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2080,39 +2123,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2149,7 +2194,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2214,7 +2259,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2287,11 +2332,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2696,6 +2741,7 @@ ); resolveBuffer(response, id, constructor); } + function flushInitialRenderPerformance() {} function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -2766,7 +2812,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, new ReactPromise("rejected", null, tag)); break; case 84: @@ -2810,84 +2856,95 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(response, chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + function processBinaryChunk(weakResponse, chunk) { + if (void 0 !== weakResponse.weak.deref()) { + weakResponse = unwrapWeakResponse(weakResponse); + for ( + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, + chunkLength = chunk.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 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); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = chunk[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 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( + weakResponse, + rowID, + rowTag, + buffer, + rowLength + ), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; 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, rowID, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = rowID = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; + } } + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -2969,8 +3026,8 @@ return value; }; } - function close(response) { - reportGlobalError(response, Error("Connection closed.")); + function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw Error( @@ -2992,7 +3049,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { @@ -3089,7 +3146,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, @@ -3198,14 +3259,14 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromNodeStream = function ( stream, serverConsumerManifest, options ) { - var response = new ResponseInstance( + var response$jscomp$0 = new ResponseInstance( serverConsumerManifest.moduleMap, serverConsumerManifest.serverModuleMap, serverConsumerManifest.moduleLoading, @@ -3217,109 +3278,112 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + if (void 0 !== response$jscomp$0.weak.deref()) { + for ( + var response = unwrapWeakResponse(response$jscomp$0), + i = 0, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._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) + ) { + 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." ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) + 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." ); - 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." - ); + } + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; - } else processBinaryChunk(response, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { - reportGlobalError(response, error); + reportGlobalError(response$jscomp$0, error); }); stream.on("end", function () { - return close(response); + return close(response$jscomp$0); }); - return getChunk(response, 0); + return getRoot(response$jscomp$0); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall$1); 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 676d9380b9da3a..1cb286911a00c3 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 @@ -817,15 +817,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -854,15 +852,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -906,11 +904,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -1001,14 +1000,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1125,7 +1125,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1400,24 +1400,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1607,7 +1607,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1758,10 +1758,11 @@ function processFullStringRow(response, id, tag, row) { tag = JSON.parse(row); row = resolveErrorProd(); row.digest = tag.digest; - response = response._chunks; - (tag = response.get(id)) - ? triggerErrorOnChunk(tag, row) - : response.set(id, new ReactPromise("rejected", null, row)); + tag = response._chunks; + var chunk = tag.get(id); + chunk + ? triggerErrorOnChunk(response, chunk, row) + : tag.set(id, new ReactPromise("rejected", null, row)); break; case 84: response = response._chunks; @@ -1789,26 +1790,25 @@ function processFullStringRow(response, id, tag, row) { startAsyncIterable(response, id, !0); break; case 67: - (id = response._chunks.get(id)) && - "fulfilled" === id.status && - id.reason.close("" === row ? '"$undefined"' : row); + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); break; default: - tag = response._chunks; - var chunk = tag.get(id); - chunk - ? resolveModelChunk(response, chunk, row) - : tag.set(id, new ReactPromise("resolved_model", row, response)); + (tag = response._chunks), + (chunk = tag.get(id)) + ? resolveModelChunk(response, chunk, row) + : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(response, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1862,7 +1862,7 @@ function processBinaryChunk(response, chunk) { var offset = chunk.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, rowID, rowTag, buffer, rowLength), + processFullBinaryRow(weakResponse, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -1874,10 +1874,10 @@ function processBinaryChunk(response, chunk) { break; } } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1914,8 +1914,8 @@ function createFromJSONCallback(response) { return value; }; } -function close(response) { - reportGlobalError(response, Error("Connection closed.")); +function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw 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 4ada80e4fba5de..7584a243943ac6 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 @@ -842,7 +842,7 @@ "\n//# sourceURL=rsc://React/" + encodeURIComponent(environmentName) + "/" + - filename + + encodeURI(filename) + "?s" + fakeServerFunctionIdx++), (col += "\n//# sourceMappingURL=" + sourceMap)) @@ -1088,6 +1088,17 @@ this.reason = reason; this._debugInfo = null; } + function unwrapWeakResponse(weakResponse) { + weakResponse = weakResponse.weak.deref(); + if (void 0 === weakResponse) + throw Error( + "We did not expect to receive new data after GC:ing the response." + ); + return weakResponse; + } + function cleanupDebugChannel(debugChannel) { + debugChannel(""); + } function readChunk(chunk) { switch (chunk.status) { case "resolved_model": @@ -1107,9 +1118,27 @@ throw chunk.reason; } } - function createPendingChunk() { + function getRoot(weakResponse) { + weakResponse = unwrapWeakResponse(weakResponse); + return getChunk(weakResponse, 0); + } + function createPendingChunk(response) { + 0 === response._pendingChunks++ && + ((response._weakResponse.response = response), + null !== response._pendingInitialRender && + (clearTimeout(response._pendingInitialRender), + (response._pendingInitialRender = null))); return new ReactPromise("pending", null, null); } + function releasePendingChunk(response, chunk) { + "pending" === chunk.status && + 0 === --response._pendingChunks && + ((response._weakResponse.response = null), + (response._pendingInitialRender = setTimeout( + flushInitialRenderPerformance.bind(null, response), + 100 + ))); + } function wakeChunk(listeners, value) { for (var i = 0; i < listeners.length; i++) { var listener = listeners[i]; @@ -1185,15 +1214,14 @@ rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } - function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } + function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : (releasePendingChunk(response, chunk), + (response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -1216,6 +1244,7 @@ function resolveModelChunk(response, chunk, value) { if ("pending" !== chunk.status) chunk.reason.enqueueModel(value); else { + releasePendingChunk(response, chunk); var resolveListeners = chunk.value, rejectListeners = chunk.reason; chunk.status = "resolved_model"; @@ -1226,15 +1255,16 @@ wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } - function resolveModuleChunk(chunk, value) { + function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + releasePendingChunk(response, chunk); + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } function initializeModelChunk(chunk) { @@ -1277,15 +1307,19 @@ (chunk.status = "rejected"), (chunk.reason = error); } } - function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); - }); - var debugChannel = response._debugChannel; - void 0 !== debugChannel && - (debugChannel(""), (response._debugChannel = void 0)); + function reportGlobalError(weakResponse, error) { + if (void 0 !== weakResponse.weak.deref()) { + var response = unwrapWeakResponse(weakResponse); + response._closed = !0; + response._closedReason = error; + response._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(response, chunk, error); + }); + weakResponse = response._debugChannel; + void 0 !== weakResponse && + (weakResponse(""), (response._debugChannel = void 0)); + } } function nullRefGetter() { return null; @@ -1361,7 +1395,7 @@ chunk || ((chunk = response._closed ? new ReactPromise("rejected", null, response._closedReason) - : createPendingChunk()), + : createPendingChunk(response)), chunks.set(id, chunk)); return chunk; } @@ -1447,31 +1481,31 @@ } function rejectReference(reference, error) { var handler = reference.handler; - if ( - !handler.errored && - ((reference = handler.value), - (handler.errored = !0), - (handler.value = error), - (handler = handler.chunk), - null !== handler && "blocked" === handler.status) - ) { - if ( - "object" === typeof reference && - null !== reference && - reference.$$typeof === REACT_ELEMENT_TYPE - ) { - var erroredComponent = { - name: getComponentNameFromType(reference.type) || "", - owner: reference._owner - }; - erroredComponent.debugStack = reference._debugStack; - supportsCreateTask && - (erroredComponent.debugTask = reference._debugTask); - (handler._debugInfo || (handler._debugInfo = [])).push( - erroredComponent - ); + reference = reference.response; + if (!handler.errored) { + var blockedValue = handler.value; + handler.errored = !0; + handler.value = error; + handler = handler.chunk; + if (null !== handler && "blocked" === handler.status) { + if ( + "object" === typeof blockedValue && + null !== blockedValue && + blockedValue.$$typeof === REACT_ELEMENT_TYPE + ) { + var erroredComponent = { + name: getComponentNameFromType(blockedValue.type) || "", + owner: blockedValue._owner + }; + erroredComponent.debugStack = blockedValue._debugStack; + supportsCreateTask && + (erroredComponent.debugTask = blockedValue._debugTask); + (handler._debugInfo || (handler._debugInfo = [])).push( + erroredComponent + ); + } + triggerErrorOnChunk(reference, handler, error); } - triggerErrorOnChunk(handler, error); } } function waitForReference( @@ -1611,7 +1645,7 @@ erroredComponent ); } - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } } @@ -1980,6 +2014,8 @@ this._closed = !1; this._closedReason = null; this._tempRefs = temporaryReferences; + this._pendingChunks = 0; + this._weakResponse = { weak: new WeakRef(this), response: this }; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -1996,17 +2032,22 @@ this._debugChannel = debugChannel; this._replayConsole = replayConsole; this._rootEnvironmentName = environmentName; + debugChannel && + (null === debugChannelRegistry + ? (debugChannel(""), (this._debugChannel = void 0)) + : debugChannelRegistry.register(this, debugChannel)); this._fromJSON = createFromJSONCallback(this); } function resolveDebugHalt(response, id) { - response = response._chunks; - var chunk = response.get(id); - chunk || response.set(id, (chunk = createPendingChunk())); + var chunks = response._chunks, + chunk = chunks.get(id); + chunk || chunks.set(id, (chunk = createPendingChunk(response))); if ("pending" === chunk.status || "blocked" === chunk.status) - (id = chunk), - (id.status = "halted"), - (id.value = null), - (id.reason = null); + releasePendingChunk(response, chunk), + (response = chunk), + (response.status = "halted"), + (response.value = null), + (response.reason = null); } function resolveModel(response, id, model) { var chunks = response._chunks, @@ -2016,18 +2057,20 @@ : chunks.set(id, new ReactPromise("resolved_model", model, response)); } function resolveText(response, id, text) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(text) - : response.set(id, new ReactPromise("fulfilled", text, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", text, null))); } function resolveBuffer(response, id, buffer) { - response = response._chunks; - var chunk = response.get(id); + var chunks = response._chunks, + chunk = chunks.get(id); chunk && "pending" !== chunk.status ? chunk.reason.enqueueValue(buffer) - : response.set(id, new ReactPromise("fulfilled", buffer, null)); + : (chunk && releasePendingChunk(response, chunk), + chunks.set(id, new ReactPromise("fulfilled", buffer, null))); } function resolveModule(response, id, model) { var chunks = response._chunks, @@ -2042,39 +2085,41 @@ model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { + releasePendingChunk(response, chunk); var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) ); } function resolveStream(response, id, stream, controller) { - var chunks = response._chunks; - response = chunks.get(id); - response - ? "pending" === response.status && - ((id = response.value), - (response.status = "fulfilled"), - (response.value = stream), - (response.reason = controller), - null !== id && wakeChunk(id, response.value)) + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? "pending" === chunk.status && + (releasePendingChunk(response, chunk), + (response = chunk.value), + (chunk.status = "fulfilled"), + (chunk.value = stream), + (chunk.reason = controller), + null !== response && wakeChunk(response, chunk.value)) : chunks.set(id, new ReactPromise("fulfilled", stream, controller)); } function startReadableStream(response, id, type) { @@ -2111,7 +2156,7 @@ (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var _chunk2 = createPendingChunk(); + var _chunk2 = createPendingChunk(response); _chunk2.then( function (v) { return controller.enqueue(v); @@ -2176,7 +2221,7 @@ { done: !0, value: void 0 }, null ); - buffer[nextReadIndex] = createPendingChunk(); + buffer[nextReadIndex] = createPendingChunk(response); } return buffer[nextReadIndex++]; }); @@ -2249,11 +2294,11 @@ closed = !0; for ( nextWriteIndex === buffer.length && - (buffer[nextWriteIndex] = createPendingChunk()); + (buffer[nextWriteIndex] = createPendingChunk(response)); nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -2658,6 +2703,7 @@ ); resolveBuffer(response, id, constructor); } + function flushInitialRenderPerformance() {} function processFullBinaryRow(response, id, tag, buffer, chunk) { switch (tag) { case 65: @@ -2728,7 +2774,7 @@ row = response._chunks; var chunk = row.get(id); chunk - ? triggerErrorOnChunk(chunk, tag) + ? triggerErrorOnChunk(response, chunk, tag) : row.set(id, new ReactPromise("rejected", null, tag)); break; case 84: @@ -2772,84 +2818,95 @@ : resolveModel(response, id, row); } } - function processBinaryChunk(response, chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + function processBinaryChunk(weakResponse, chunk) { + if (void 0 !== weakResponse.weak.deref()) { + weakResponse = unwrapWeakResponse(weakResponse); + for ( + var i = 0, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, + chunkLength = chunk.length; + i < chunkLength; - ) { - var lastIdx = -1; - switch (rowState) { - case 0: - lastIdx = chunk[i++]; - 58 === lastIdx - ? (rowState = 1) - : (rowID = - (rowID << 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); + ) { + var lastIdx = -1; + switch (rowState) { + case 0: + lastIdx = chunk[i++]; + 58 === lastIdx + ? (rowState = 1) + : (rowID = + (rowID << 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( + weakResponse, + rowID, + rowTag, + buffer, + rowLength + ), + (i = lastIdx), + 3 === rowState && i++, + (rowLength = rowID = rowTag = rowState = 0), + (buffer.length = 0); + else { + chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); + buffer.push(chunk); + rowLength -= chunk.byteLength; 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, rowID, rowTag, buffer, rowLength), - (i = lastIdx), - 3 === rowState && i++, - (rowLength = rowID = rowTag = rowState = 0), - (buffer.length = 0); - else { - chunk = new Uint8Array(chunk.buffer, offset, chunk.byteLength - i); - buffer.push(chunk); - rowLength -= chunk.byteLength; - break; + } } + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -2931,8 +2988,8 @@ return value; }; } - function close(response) { - reportGlobalError(response, Error("Connection closed.")); + function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw Error( @@ -2954,7 +3011,7 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; } function startReadingFromStream(response, stream) { function progress(_ref) { @@ -3051,7 +3108,11 @@ "function" === typeof reject && reject(this.reason); } }; - var initializingHandler = null, + var debugChannelRegistry = + "function" === typeof FinalizationRegistry + ? new FinalizationRegistry(cleanupDebugChannel) + : null, + initializingHandler = null, supportsCreateTask = !!console.createTask, fakeFunctionCache = new Map(), fakeFunctionIdx = 0, @@ -3160,14 +3221,14 @@ reportGlobalError(response, e); } ); - return getChunk(response, 0); + return getRoot(response); }; exports.createFromNodeStream = function ( stream, serverConsumerManifest, options ) { - var response = new ResponseInstance( + var response$jscomp$0 = new ResponseInstance( serverConsumerManifest.moduleMap, serverConsumerManifest.serverModuleMap, serverConsumerManifest.moduleLoading, @@ -3179,109 +3240,112 @@ options ? !0 === options.replayConsoleLogs : !1, options && options.environmentName ? options.environmentName : void 0, void 0 - ); + )._weakResponse; stream.on("data", function (chunk) { if ("string" === typeof chunk) { - for ( - var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, - chunkLength = chunk.length; - i < chunkLength; + if (void 0 !== response$jscomp$0.weak.deref()) { + for ( + var response = unwrapWeakResponse(response$jscomp$0), + i = 0, + rowState = response._rowState, + rowID = response._rowID, + rowTag = response._rowTag, + rowLength = response._rowLength, + buffer = response._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) + ) { + 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." ); - lastIdx = chunk.length; - } - if (-1 < lastIdx) { - if (0 < buffer.length) + 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." ); - 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." - ); + } + response._rowState = rowState; + response._rowID = rowID; + response._rowTag = rowTag; + response._rowLength = rowLength; } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; - } else processBinaryChunk(response, chunk); + } else processBinaryChunk(response$jscomp$0, chunk); }); stream.on("error", function (error) { - reportGlobalError(response, error); + reportGlobalError(response$jscomp$0, error); }); stream.on("end", function () { - return close(response); + return close(response$jscomp$0); }); - return getChunk(response, 0); + return getRoot(response$jscomp$0); }; exports.createFromReadableStream = function (stream, options) { options = createResponseFromOptions(options); startReadingFromStream(options, stream); - return getChunk(options, 0); + return getRoot(options); }; exports.createServerReference = function (id) { return createServerReference$1(id, noServerCall$1); 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 6c6c593cdf788a..d69fb30f2a09fb 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 @@ -782,15 +782,13 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) { rejectListeners && rejectChunk(rejectListeners, chunk.reason); } } -function triggerErrorOnChunk(chunk, error) { - if ("pending" !== chunk.status && "blocked" !== chunk.status) - chunk.reason.error(error); - else { - var listeners = chunk.reason; - chunk.status = "rejected"; - chunk.reason = error; - null !== listeners && rejectChunk(listeners, error); - } +function triggerErrorOnChunk(response, chunk, error) { + "pending" !== chunk.status && "blocked" !== chunk.status + ? chunk.reason.error(error) + : ((response = chunk.reason), + (chunk.status = "rejected"), + (chunk.reason = error), + null !== response && rejectChunk(response, error)); } function createResolvedIteratorResultChunk(response, value, done) { return new ReactPromise( @@ -819,15 +817,15 @@ function resolveModelChunk(response, chunk, value) { wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); } } -function resolveModuleChunk(chunk, value) { +function resolveModuleChunk(response, chunk, value) { if ("pending" === chunk.status || "blocked" === chunk.status) { - var resolveListeners = chunk.value, - rejectListeners = chunk.reason; + response = chunk.value; + var rejectListeners = chunk.reason; chunk.status = "resolved_module"; chunk.value = value; - null !== resolveListeners && + null !== response && (initializeModuleChunk(chunk), - wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners)); + wakeChunkIfInitialized(chunk, response, rejectListeners)); } } var initializingHandler = null; @@ -871,11 +869,12 @@ function initializeModuleChunk(chunk) { (chunk.status = "rejected"), (chunk.reason = error); } } -function reportGlobalError(response, error) { - response._closed = !0; - response._closedReason = error; - response._chunks.forEach(function (chunk) { - "pending" === chunk.status && triggerErrorOnChunk(chunk, error); +function reportGlobalError(weakResponse, error) { + weakResponse._closed = !0; + weakResponse._closedReason = error; + weakResponse._chunks.forEach(function (chunk) { + "pending" === chunk.status && + triggerErrorOnChunk(weakResponse, chunk, error); }); } function createLazyChunkWrapper(chunk) { @@ -966,14 +965,15 @@ function fulfillReference(reference, value) { null !== parentObject && wakeChunk(parentObject, handler.value))); } function rejectReference(reference, error) { - reference = reference.handler; - reference.errored || - ((reference.errored = !0), - (reference.value = error), - (reference = reference.chunk), - null !== reference && - "blocked" === reference.status && - triggerErrorOnChunk(reference, error)); + var handler = reference.handler; + reference = reference.response; + handler.errored || + ((handler.errored = !0), + (handler.value = error), + (handler = handler.chunk), + null !== handler && + "blocked" === handler.status && + triggerErrorOnChunk(reference, handler, error)); } function waitForReference( referencedChunk, @@ -1090,7 +1090,7 @@ function loadServerReference(response, metaData, parentObject, key) { var chunk = handler.chunk; null !== chunk && "blocked" === chunk.status && - triggerErrorOnChunk(chunk, error); + triggerErrorOnChunk(response, chunk, error); } } ); @@ -1365,24 +1365,24 @@ function resolveModule(response, id, model) { model[1], response._nonce ); - if ((response = preloadModule(clientReference))) { + if ((model = preloadModule(clientReference))) { if (chunk) { var blockedChunk = chunk; blockedChunk.status = "blocked"; } else (blockedChunk = new ReactPromise("blocked", null, null)), chunks.set(id, blockedChunk); - response.then( + model.then( function () { - return resolveModuleChunk(blockedChunk, clientReference); + return resolveModuleChunk(response, blockedChunk, clientReference); }, function (error) { - return triggerErrorOnChunk(blockedChunk, error); + return triggerErrorOnChunk(response, blockedChunk, error); } ); } else chunk - ? resolveModuleChunk(chunk, clientReference) + ? resolveModuleChunk(response, chunk, clientReference) : chunks.set( id, new ReactPromise("resolved_module", clientReference, null) @@ -1572,7 +1572,7 @@ function startAsyncIterable(response, id, iterator) { nextWriteIndex < buffer.length; ) - triggerErrorOnChunk(buffer[nextWriteIndex++], error); + triggerErrorOnChunk(response, buffer[nextWriteIndex++], error); } } ); @@ -1723,10 +1723,11 @@ function processFullStringRow(response, id, tag, row) { tag = JSON.parse(row); row = resolveErrorProd(); row.digest = tag.digest; - response = response._chunks; - (tag = response.get(id)) - ? triggerErrorOnChunk(tag, row) - : response.set(id, new ReactPromise("rejected", null, row)); + tag = response._chunks; + var chunk = tag.get(id); + chunk + ? triggerErrorOnChunk(response, chunk, row) + : tag.set(id, new ReactPromise("rejected", null, row)); break; case 84: response = response._chunks; @@ -1754,26 +1755,25 @@ function processFullStringRow(response, id, tag, row) { startAsyncIterable(response, id, !0); break; case 67: - (id = response._chunks.get(id)) && - "fulfilled" === id.status && - id.reason.close("" === row ? '"$undefined"' : row); + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); break; default: - tag = response._chunks; - var chunk = tag.get(id); - chunk - ? resolveModelChunk(response, chunk, row) - : tag.set(id, new ReactPromise("resolved_model", row, response)); + (tag = response._chunks), + (chunk = tag.get(id)) + ? resolveModelChunk(response, chunk, row) + : tag.set(id, new ReactPromise("resolved_model", row, response)); } } -function processBinaryChunk(response, chunk) { +function processBinaryChunk(weakResponse, chunk) { for ( var i = 0, - rowState = response._rowState, - rowID = response._rowID, - rowTag = response._rowTag, - rowLength = response._rowLength, - buffer = response._buffer, + rowState = weakResponse._rowState, + rowID = weakResponse._rowID, + rowTag = weakResponse._rowTag, + rowLength = weakResponse._rowLength, + buffer = weakResponse._buffer, chunkLength = chunk.length; i < chunkLength; @@ -1827,7 +1827,7 @@ function processBinaryChunk(response, chunk) { var offset = chunk.byteOffset + i; if (-1 < lastIdx) (rowLength = new Uint8Array(chunk.buffer, offset, lastIdx - i)), - processFullBinaryRow(response, rowID, rowTag, buffer, rowLength), + processFullBinaryRow(weakResponse, rowID, rowTag, buffer, rowLength), (i = lastIdx), 3 === rowState && i++, (rowLength = rowID = rowTag = rowState = 0), @@ -1839,10 +1839,10 @@ function processBinaryChunk(response, chunk) { break; } } - response._rowState = rowState; - response._rowID = rowID; - response._rowTag = rowTag; - response._rowLength = rowLength; + weakResponse._rowState = rowState; + weakResponse._rowID = rowID; + weakResponse._rowTag = rowTag; + weakResponse._rowLength = rowLength; } function createFromJSONCallback(response) { return function (key, value) { @@ -1879,8 +1879,8 @@ function createFromJSONCallback(response) { return value; }; } -function close(response) { - reportGlobalError(response, Error("Connection closed.")); +function close(weakResponse) { + reportGlobalError(weakResponse, Error("Connection closed.")); } function noServerCall$1() { throw 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 e476c585f05ce7..3778092f151ef4 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 @@ -649,9 +649,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -674,7 +674,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -837,6 +837,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -920,7 +921,7 @@ return currentRequest ? currentRequest : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -993,7 +994,9 @@ if (request.status === ABORTING) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1320,7 +1323,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1694,7 +1697,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1774,7 +1777,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1782,7 +1785,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1861,7 +1864,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1887,8 +1890,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2464,7 +2468,7 @@ } } function emitTypedArrayChunk(request, id, tag, typedArray, debug) { - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var buffer = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2483,7 +2487,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2722,7 +2726,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2750,7 +2754,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2843,7 +2847,7 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } @@ -2854,7 +2858,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; @@ -2862,7 +2866,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -2913,11 +2917,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); } } @@ -3002,7 +3006,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( @@ -3018,11 +3022,13 @@ request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (request.status === ABORTING) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (request.status === ABORTING) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -3075,9 +3081,11 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - if (5 !== task.status) { - task.status = 3; + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + if (3 === task.status) { var model = task.model; "object" === typeof model && null !== model && @@ -3117,7 +3125,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3158,6 +3166,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (request.status < ABORTING && request.cacheController.abort( Error( @@ -3205,44 +3214,60 @@ } } } - function abort(request, reason) { + function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error( - "The render was aborted by the server with a promise." - ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); + } + } function fromHex(str) { return parseInt(str, 16); } @@ -3253,7 +3278,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4037,7 +4062,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 8f0bbda1ba86cb..89599515bf7dca 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 @@ -790,7 +790,9 @@ function serializeThenable(request, task, thenable) { if (12 === request.status) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1297,7 +1299,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1544,7 +1546,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); request = "$" === value[0] ? "$" + value : value; @@ -1678,61 +1680,61 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { - request.pendingChunks++; - var buffer = new Uint8Array( +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer; - buffer = typedArray.byteLength; - id = id.toString(16) + ":" + tag + buffer.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { var id = task.id; "string" === typeof value && null !== byteLengthOfChunk - ? emitTextChunk(request, id, value) + ? emitTextChunk(request, id, value, !1) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1771,11 +1773,13 @@ function retryTask(request, task) { request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (12 === request.status) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (12 === request.status) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -1824,10 +1828,12 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } @@ -1913,39 +1919,56 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitErrorChunk(request, errorId, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error("The render was aborted by the server without a reason.") + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error("The render was aborted by the server with a promise.") + : reason, + digest = logRecoverableError(request, error, null), + errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitErrorChunk(request, errorId, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + scheduleWork(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 f8af5f0026883a..d9f5d64593ad31 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 @@ -656,9 +656,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -681,7 +681,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -844,6 +844,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -932,7 +933,7 @@ return null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1005,7 +1006,9 @@ if (request.status === ABORTING) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1332,7 +1335,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1754,7 +1757,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1834,7 +1837,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1842,7 +1845,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1921,7 +1924,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1947,8 +1950,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2535,7 +2539,7 @@ } } function emitTypedArrayChunk(request, id, tag, typedArray, debug) { - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var buffer = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2554,7 +2558,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); var binaryLength = text.byteLength; id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; @@ -2793,7 +2797,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2821,7 +2825,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2914,7 +2918,7 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } @@ -2925,7 +2929,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; @@ -2933,7 +2937,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -2984,11 +2988,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); } } @@ -3073,7 +3077,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( @@ -3089,11 +3093,13 @@ request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (request.status === ABORTING) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (request.status === ABORTING) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -3146,9 +3152,11 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - if (5 !== task.status) { - task.status = 3; + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + if (3 === task.status) { var model = task.model; "object" === typeof model && null !== model && @@ -3188,7 +3196,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3229,6 +3237,7 @@ (writtenBytes = 0)); } 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (request.status < ABORTING && request.cacheController.abort( Error( @@ -3280,44 +3289,60 @@ } } } - function abort(request, reason) { + function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error( - "The render was aborted by the server with a promise." - ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, _errorId2); + }, 0); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); + } + } function fromHex(str) { return parseInt(str, 16); } @@ -3328,7 +3353,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4108,7 +4133,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(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 81d93fb64b3fa0..722543c30f1f97 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 @@ -789,7 +789,9 @@ function serializeThenable(request, task, thenable) { if (12 === request.status) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1296,7 +1298,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1543,7 +1545,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); request = "$" === value[0] ? "$" + value : value; @@ -1679,61 +1681,61 @@ function emitModelChunk(request, id, json) { id = stringToChunk(id); request.completedRegularChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { - request.pendingChunks++; - var buffer = new Uint8Array( +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer; - buffer = typedArray.byteLength; - id = id.toString(16) + ":" + tag + buffer.toString(16) + ","; + typedArray = 2048 < typedArray.byteLength ? debug.slice() : debug; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; text = stringToChunk(text); - var binaryLength = text.byteLength; - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug = text.byteLength; + id = id.toString(16) + ":T" + debug.toString(16) + ","; id = stringToChunk(id); request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { var id = task.id; "string" === typeof value && null !== byteLengthOfChunk - ? emitTextChunk(request, id, value) + ? emitTextChunk(request, id, value, !1) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } @@ -1772,11 +1774,13 @@ function retryTask(request, task) { request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (12 === request.status) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (12 === request.status) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -1825,10 +1829,12 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } @@ -1918,39 +1924,56 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitErrorChunk(request, errorId, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error("The render was aborted by the server without a reason.") + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error("The render was aborted by the server with a promise.") + : reason, + digest = logRecoverableError(request, error, null), + errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitErrorChunk(request, errorId, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setTimeout(function () { + return finishAbort(request, abortableTasks, errorId); + }, 0); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; 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 411995901543aa..e7d68a0ebfaa32 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 @@ -680,9 +680,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -705,7 +705,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -867,6 +867,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -952,7 +953,7 @@ return store ? store : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1025,7 +1026,9 @@ if (request.status === ABORTING) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1351,7 +1354,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1751,7 +1754,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1830,7 +1833,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1838,7 +1841,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1917,7 +1920,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1943,8 +1946,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2517,7 +2521,7 @@ } } function emitTypedArrayChunk(request, id, tag, typedArray, debug) { - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2534,7 +2538,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var binaryLength = byteLengthOfChunk(text); id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; debug @@ -2771,7 +2775,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2799,7 +2803,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2891,7 +2895,7 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } @@ -2902,7 +2906,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; @@ -2910,7 +2914,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -2960,11 +2964,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); } } @@ -3054,7 +3058,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( @@ -3071,11 +3075,13 @@ request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (request.status === ABORTING) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (request.status === ABORTING) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -3128,9 +3134,11 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - if (5 !== task.status) { - task.status = 3; + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + if (3 === task.status) { var model = task.model; "object" === typeof model && null !== model && @@ -3171,7 +3179,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3212,6 +3220,7 @@ } "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (request.status < ABORTING && request.cacheController.abort( Error( @@ -3258,44 +3267,60 @@ } } } - function abort(request, reason) { + function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error( - "The render was aborted by the server with a promise." - ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); + } + } function fromHex(str) { return parseInt(str, 16); } @@ -3313,7 +3338,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(request)); @@ -3345,7 +3370,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4821,12 +4846,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_207 = []; + var JSCompiler_object_inline_chunks_213 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_207.push(chunk); + JSCompiler_object_inline_chunks_213.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_207, { + var blob = new Blob(JSCompiler_object_inline_chunks_213, { 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.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js index 77ff1bce98f4d5..b4c903487ee927 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 @@ -812,7 +812,9 @@ function serializeThenable(request, task, thenable) { if (12 === request.status) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1316,7 +1318,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1563,7 +1565,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); request = "$" === value[0] ? "$" + value : value; @@ -1690,57 +1692,57 @@ function emitErrorChunk(request, id, digest) { id = id.toString(16) + ":E" + stringify(digest) + "\n"; request.completedErrorChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { - request.pendingChunks++; +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - var binaryLength = typedArray.byteLength; - id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ","; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; - var binaryLength = byteLengthOfChunk(text); - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = byteLengthOfChunk(text); + id = id.toString(16) + ":T" + debug.toString(16) + ","; request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { var id = task.id; "string" === typeof value && null !== byteLengthOfChunk - ? emitTextChunk(request, id, value) + ? emitTextChunk(request, id, value, !1) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), (task = task.id.toString(16) + ":" + value + "\n"), @@ -1782,11 +1784,13 @@ function retryTask(request, task) { request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (12 === request.status) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (12 === request.status) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -1835,10 +1839,12 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } @@ -1948,39 +1954,56 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitErrorChunk(request, errorId, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error("The render was aborted by the server without a reason.") + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error("The render was aborted by the server with a promise.") + : reason, + digest = logRecoverableError(request, error, null), + errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitErrorChunk(request, errorId, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); + } +} function resolveServerReference(bundlerConfig, id) { var name = "", resolvedModuleData = bundlerConfig[id]; @@ -2859,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_245 = []; + var JSCompiler_object_inline_chunks_253 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_245.push(chunk); + JSCompiler_object_inline_chunks_253.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_245, { + 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 a7aa0fef388e08..2d7dd6db1f5bf4 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 @@ -680,9 +680,9 @@ suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && - (url = url.slice(envIdx + 1, suffixIdx)); + (url = decodeURI(url.slice(envIdx + 1, suffixIdx))); } - request(url, functionName) && + request(url, functionName, callsite[2], callsite[3]) && ((callsite = callsite.slice(0)), (callsite[1] = url), filteredStack.push(callsite)); @@ -705,7 +705,7 @@ request, parseStackTrace(Error("react-stack-top-frame"), 1) ); - request.pendingChunks++; + request.pendingDebugChunks++; var owner = resolveOwner(), args = Array.from(arguments); a: { @@ -867,6 +867,7 @@ void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; + this.pendingDebugChunks = 0; this.completedDebugChunks = []; this.environmentName = void 0 === environmentName @@ -952,7 +953,7 @@ return store ? store : null; } function serializeDebugThenable(request, counter, thenable) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, ref = "$@" + id.toString(16); request.writtenDebugObjects.set(thenable, ref); @@ -1025,7 +1026,9 @@ if (request.status === ABORTING) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1351,7 +1354,7 @@ var componentDebugID = task.id; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); - request.pendingChunks++; + request.pendingDebugChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, @@ -1751,7 +1754,7 @@ function serializeDeferredObject(request, value) { var deferredDebugObjects = request.deferredDebugObjects; return null !== deferredDebugObjects - ? (request.pendingChunks++, + ? (request.pendingDebugChunks++, (request = request.nextChunkId++), deferredDebugObjects.existing.set(value, request), deferredDebugObjects.retained.set(request, value), @@ -1830,7 +1833,7 @@ request.bundlerConfig, clientReference ); - request.pendingChunks++; + request.pendingDebugChunks++; var importId = request.nextChunkId++; emitImportChunk(request, importId, clientReferenceMetadata, !0); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName @@ -1838,7 +1841,7 @@ : serializeByValueID(importId); } catch (x) { return ( - request.pendingChunks++, + request.pendingDebugChunks++, (parent = request.nextChunkId++), (parentPropertyName = logRecoverableError(request, x, null)), emitErrorChunk(request, parent, parentPropertyName, x, !0), @@ -1917,7 +1920,7 @@ return serializeByValueID(bufferId); } function serializeDebugTypedArray(request, tag, typedArray) { - request.pendingChunks++; + request.pendingDebugChunks++; var bufferId = request.nextChunkId++; emitTypedArrayChunk(request, bufferId, tag, typedArray, !0); return serializeByValueID(bufferId); @@ -1943,8 +1946,9 @@ reader.cancel(reason).then(noop, noop); } var model = [blob.type], - reader = blob.stream().getReader(), - id = request.nextChunkId++; + reader = blob.stream().getReader(); + request.pendingDebugChunks++; + var id = request.nextChunkId++; reader.read().then(progress).catch(error); return "$B" + id.toString(16); } @@ -2517,7 +2521,7 @@ } } function emitTypedArrayChunk(request, id, tag, typedArray, debug) { - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, @@ -2534,7 +2538,7 @@ throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; var binaryLength = byteLengthOfChunk(text); id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; debug @@ -2771,7 +2775,7 @@ if (0 >= counter.objectLimit) return serializeDeferredObject(request, value); counter.objectLimit--; - request.pendingChunks++; + request.pendingDebugChunks++; counter = request.nextChunkId++; emitTextChunk(request, counter, value, !0); return serializeByValueID(counter); @@ -2799,7 +2803,7 @@ ref = counter.get(value); if (void 0 !== ref) return ref; key = "$E(" + (Function.prototype.toString.call(value) + ")"); - request.pendingChunks++; + request.pendingDebugChunks++; ref = request.nextChunkId++; key = encodeReferenceChunk(request, ref, key); request.completedDebugChunks.push(key); @@ -2891,7 +2895,7 @@ } function outlineDebugModel(request, counter, model) { var id = request.nextChunkId++; - request.pendingChunks++; + request.pendingDebugChunks++; emitOutlinedDebugModelChunk(request, id, counter, model); return id; } @@ -2902,7 +2906,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; @@ -2910,7 +2914,7 @@ var request = request$jscomp$1, ioInfo$jscomp$0 = ioInfo; if (!request.writtenObjects.has(ioInfo$jscomp$0)) { - request.pendingChunks++; + request.pendingDebugChunks++; var id = request.nextChunkId++, owner = ioInfo$jscomp$0.owner; null != owner && outlineComponentInfo(request, owner); @@ -2960,11 +2964,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); } } @@ -3054,7 +3058,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( @@ -3071,11 +3075,13 @@ request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (request.status === ABORTING) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (request.status === ABORTING) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -3128,9 +3134,11 @@ (currentRequest = prevRequest); } } - function abortTask(task, request, errorId) { - if (5 !== task.status) { - task.status = 3; + function abortTask(task) { + 0 === task.status && (task.status = 3); + } + function finishAbortedTask(task, request, errorId) { + if (3 === task.status) { var model = task.model; "object" === typeof model && null !== model && @@ -3171,7 +3179,7 @@ var debugChunks = request.completedDebugChunks; for (i = 0; i < debugChunks.length; i++) if ( - (request.pendingChunks--, + (request.pendingDebugChunks--, !writeChunkAndReturn(destination, debugChunks[i])) ) { request.destination = null; @@ -3212,6 +3220,7 @@ } "function" === typeof destination.flush && destination.flush(); 0 === request.pendingChunks && + 0 === request.pendingDebugChunks && (request.status < ABORTING && request.cacheController.abort( Error( @@ -3258,44 +3267,60 @@ } } } - function abort(request, reason) { + function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = ABORTING), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error( - "The render was aborted by the server without a reason." - ) - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error( - "The render was aborted by the server with a promise." - ) - : reason, - digest = logRecoverableError(request, error, null), - _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$2) { - logRecoverableError(request, error$2, null), - fatalError(request, error$2); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } + function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = ABORTING; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error( + "The render was aborted by the server without a reason." + ) + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error( + "The render was aborted by the server with a promise." + ) + : reason, + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, _errorId2); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$2) { + logRecoverableError(request, error$2, null), + fatalError(request, error$2); + } + } function fromHex(str) { return parseInt(str, 16); } @@ -3313,7 +3338,7 @@ var id = message[command], retainedValue = deferredDebugObjects.retained.get(id); void 0 !== retainedValue && - (request.pendingChunks--, + (request.pendingDebugChunks--, deferredDebugObjects.retained.delete(id), deferredDebugObjects.existing.delete(retainedValue), enqueueFlush(request)); @@ -3345,7 +3370,7 @@ "resolveDebugMessage/closeDebugChannel should not be called for a Request that wasn't kept alive. This is a bug in React." ); deferredDebugObjects.retained.forEach(function (value, id) { - request.pendingChunks--; + request.pendingDebugChunks--; deferredDebugObjects.retained.delete(id); deferredDebugObjects.existing.delete(value); }); @@ -4784,12 +4809,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_207 = []; + var JSCompiler_object_inline_chunks_213 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_207.push(chunk); + JSCompiler_object_inline_chunks_213.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_207, { + var blob = new Blob(JSCompiler_object_inline_chunks_213, { 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.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js index a482acd157cde8..9aa5560c07c625 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 @@ -812,7 +812,9 @@ function serializeThenable(request, task, thenable) { if (12 === request.status) return ( request.abortableTasks.delete(newTask), - abortTask(newTask, request, request.fatalError), + (task = request.fatalError), + abortTask(newTask), + finishAbortedTask(newTask, request, task), newTask.id ); "string" !== typeof thenable.status && @@ -1316,7 +1318,7 @@ function outlineModel(request, value) { function serializeTypedArray(request, tag, typedArray) { request.pendingChunks++; var bufferId = request.nextChunkId++; - emitTypedArrayChunk(request, bufferId, tag, typedArray); + emitTypedArrayChunk(request, bufferId, tag, typedArray, !1); return serializeByValueID(bufferId); } function serializeBlob(request, blob) { @@ -1563,7 +1565,7 @@ function renderModelDestructive( return ( request.pendingChunks++, (task = request.nextChunkId++), - emitTextChunk(request, task, value), + emitTextChunk(request, task, value, !1), serializeByValueID(task) ); request = "$" === value[0] ? "$" + value : value; @@ -1690,57 +1692,57 @@ function emitErrorChunk(request, id, digest) { id = id.toString(16) + ":E" + stringify(digest) + "\n"; request.completedErrorChunks.push(id); } -function emitTypedArrayChunk(request, id, tag, typedArray) { - request.pendingChunks++; +function emitTypedArrayChunk(request, id, tag, typedArray, debug) { + debug ? request.pendingDebugChunks++ : request.pendingChunks++; typedArray = new Uint8Array( typedArray.buffer, typedArray.byteOffset, typedArray.byteLength ); - var binaryLength = typedArray.byteLength; - id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ","; + debug = typedArray.byteLength; + id = id.toString(16) + ":" + tag + debug.toString(16) + ","; request.completedRegularChunks.push(id, typedArray); } -function emitTextChunk(request, id, text) { +function emitTextChunk(request, id, text, debug) { if (null === byteLengthOfChunk) throw Error( "Existence of byteLengthOfChunk should have already been checked. This is a bug in React." ); - request.pendingChunks++; - var binaryLength = byteLengthOfChunk(text); - id = id.toString(16) + ":T" + binaryLength.toString(16) + ","; + debug ? request.pendingDebugChunks++ : request.pendingChunks++; + debug = byteLengthOfChunk(text); + id = id.toString(16) + ":T" + debug.toString(16) + ","; request.completedRegularChunks.push(id, text); } function emitChunk(request, task, value) { var id = task.id; "string" === typeof value && null !== byteLengthOfChunk - ? emitTextChunk(request, id, value) + ? emitTextChunk(request, id, value, !1) : value instanceof ArrayBuffer - ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value)) + ? emitTypedArrayChunk(request, id, "A", new Uint8Array(value), !1) : value instanceof Int8Array - ? emitTypedArrayChunk(request, id, "O", value) + ? emitTypedArrayChunk(request, id, "O", value, !1) : value instanceof Uint8Array - ? emitTypedArrayChunk(request, id, "o", value) + ? emitTypedArrayChunk(request, id, "o", value, !1) : value instanceof Uint8ClampedArray - ? emitTypedArrayChunk(request, id, "U", value) + ? emitTypedArrayChunk(request, id, "U", value, !1) : value instanceof Int16Array - ? emitTypedArrayChunk(request, id, "S", value) + ? emitTypedArrayChunk(request, id, "S", value, !1) : value instanceof Uint16Array - ? emitTypedArrayChunk(request, id, "s", value) + ? emitTypedArrayChunk(request, id, "s", value, !1) : value instanceof Int32Array - ? emitTypedArrayChunk(request, id, "L", value) + ? emitTypedArrayChunk(request, id, "L", value, !1) : value instanceof Uint32Array - ? emitTypedArrayChunk(request, id, "l", value) + ? emitTypedArrayChunk(request, id, "l", value, !1) : value instanceof Float32Array - ? emitTypedArrayChunk(request, id, "G", value) + ? emitTypedArrayChunk(request, id, "G", value, !1) : value instanceof Float64Array - ? emitTypedArrayChunk(request, id, "g", value) + ? emitTypedArrayChunk(request, id, "g", value, !1) : value instanceof BigInt64Array - ? emitTypedArrayChunk(request, id, "M", value) + ? emitTypedArrayChunk(request, id, "M", value, !1) : value instanceof BigUint64Array - ? emitTypedArrayChunk(request, id, "m", value) + ? emitTypedArrayChunk(request, id, "m", value, !1) : value instanceof DataView - ? emitTypedArrayChunk(request, id, "V", value) + ? emitTypedArrayChunk(request, id, "V", value, !1) : ((value = stringify(value, task.toJSON)), (task = task.id.toString(16) + ":" + value + "\n"), @@ -1782,11 +1784,13 @@ function retryTask(request, task) { request.abortableTasks.delete(task); callOnAllReadyIfReady(request); } catch (thrownValue) { - if (12 === request.status) - request.abortableTasks.delete(task), - (task.status = 0), - abortTask(task, request, request.fatalError); - else { + if (12 === request.status) { + request.abortableTasks.delete(task); + task.status = 0; + var errorId = request.fatalError; + abortTask(task); + finishAbortedTask(task, request, errorId); + } else { var x = thrownValue === SuspenseException ? getSuspendedThenable() @@ -1835,10 +1839,12 @@ function performWork(request) { (currentRequest = prevRequest); } } -function abortTask(task, request, errorId) { - 5 !== task.status && - ((task.status = 3), - (errorId = serializeByValueID(errorId)), +function abortTask(task) { + 0 === task.status && (task.status = 3); +} +function finishAbortedTask(task, request, errorId) { + 3 === task.status && + ((errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); } @@ -1948,39 +1954,56 @@ function startFlowing(request, destination) { } } } -function abort(request, reason) { +function finishAbort(request, abortedTasks, errorId) { try { - 11 >= request.status && - ((request.status = 12), - request.cacheController.abort(reason), - callOnAllReadyIfReady(request)); - var abortableTasks = request.abortableTasks; - if (0 < abortableTasks.size) { - var error = - void 0 === reason - ? Error("The render was aborted by the server without a reason.") - : "object" === typeof reason && - null !== reason && - "function" === typeof reason.then - ? Error("The render was aborted by the server with a promise.") - : reason, - digest = logRecoverableError(request, error, null), - errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitErrorChunk(request, errorId, digest, error, !1); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - abortableTasks.clear(); - callOnAllReadyIfReady(request); - } + abortedTasks.forEach(function (task) { + return finishAbortedTask(task, request, errorId); + }); + var onAllReady = request.onAllReady; + onAllReady(); null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); } } +function abort(request, reason) { + if (!(11 < request.status)) + try { + request.status = 12; + request.cacheController.abort(reason); + var abortableTasks = request.abortableTasks; + if (0 < abortableTasks.size) { + var error = + void 0 === reason + ? Error("The render was aborted by the server without a reason.") + : "object" === typeof reason && + null !== reason && + "function" === typeof reason.then + ? Error("The render was aborted by the server with a promise.") + : reason, + digest = logRecoverableError(request, error, null), + errorId = request.nextChunkId++; + request.fatalError = errorId; + request.pendingChunks++; + emitErrorChunk(request, errorId, digest, error, !1); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId); + }); + setImmediate(function () { + return finishAbort(request, abortableTasks, errorId); + }); + } else { + var onAllReady = request.onAllReady; + onAllReady(); + null !== request.destination && + flushCompletedChunks(request, request.destination); + } + } catch (error$24) { + logRecoverableError(request, error$24, null), + fatalError(request, error$24); + } +} function resolveServerReference(bundlerConfig, id) { var idx = id.lastIndexOf("#"); bundlerConfig = id.slice(0, idx); @@ -2825,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_245 = []; + var JSCompiler_object_inline_chunks_253 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_245.push(chunk); + JSCompiler_object_inline_chunks_253.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_245, { + 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 b99a8f579e48d6..938d98bb98a5ac 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-5d87cd22-20250704", - "react-dom": "19.2.0-canary-5d87cd22-20250704", + "react": "19.2.0-canary-223f81d8-20250707", + "react-dom": "19.2.0-canary-223f81d8-20250707", "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 cdfafac8b0519d..b2d8e03cb6af2c 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-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; "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 0dcaa6522669c7..f5f6a24743b73a 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-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; 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 4e65858bd191ea..16676ef14dd3b0 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-5d87cd22-20250704"; + exports.version = "19.2.0-canary-223f81d8-20250707"; })(); 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 d757fd57b65fe2..a443e1359c1c3b 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-5d87cd22-20250704"; +exports.version = "19.2.0-canary-223f81d8-20250707"; diff --git a/packages/next/src/compiled/unistore/unistore.js b/packages/next/src/compiled/unistore/unistore.js index d51b36a38b0a19..855393acb0b12c 100644 --- a/packages/next/src/compiled/unistore/unistore.js +++ b/packages/next/src/compiled/unistore/unistore.js @@ -1 +1 @@ -(()=>{var t={987:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a{var t={559:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a=14.0.0'} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -2939,7 +2939,7 @@ packages: resolution: {integrity: sha512-5mlW1DquU5HaxjLkfkGN1GA/fvVGdyHURRiX/0FHl2cfIfRxSOfmxEH5YS43edp0OldZrZ+dkBKbngxcNCdZvA==} peerDependencies: '@types/react': '*' - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -2956,7 +2956,7 @@ packages: '@emotion/use-insertion-effect-with-fallbacks@1.0.1': resolution: {integrity: sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 '@emotion/utils@1.2.1': resolution: {integrity: sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==} @@ -3617,20 +3617,20 @@ packages: '@floating-ui/react-dom@2.1.0': resolution: {integrity: sha512-lNzj5EQmEKn5FFKc04+zasr09h/uX8RtJRNj5gUXsSQIXHVWTVh+hVAg1vOMCexkX8EgvemMvIFpQfkosnVNyA==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 '@floating-ui/react-dom@2.1.4': resolution: {integrity: sha512-JbbpPhp38UmXDDAu60RJmbeme37Jbgsm7NrHGgzYYFKmblzRUh6Pa641dII6LsjwF4XlScDrde2UAzDo/b9KPw==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 '@floating-ui/react@0.26.16': resolution: {integrity: sha512-HEf43zxZNAI/E781QIVpYSF3K2VH4TTYZpqecjdsFkjsaU1EbaWcM++kw0HXFffj7gDUcBFevX8s0rQGQpxkow==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 '@floating-ui/utils@0.2.10': resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==} @@ -4334,13 +4334,13 @@ packages: resolution: {integrity: sha512-l9ypojKN3PjwO1CSLIsqxi7mA25+7w+xc71Q+JuCCREI0tuGwkZsKbIOpuTATIJOjPh8ycLiW7QxX1LYsRTq6w==} peerDependencies: '@mantine/hooks': 7.10.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 '@mantine/hooks@7.11.2': resolution: {integrity: sha512-jhyVe/sbDEG2U8rr2lMecUPgQxcfr5hh9HazqGfkS7ZRIMDO7uJ947yAcTMGGkp5Lxtt5TBFt1Cb6tiB2/1agg==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 '@manypkg/find-root@1.1.0': resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -4363,13 +4363,13 @@ packages: '@mdx-js/react@2.2.1': resolution: {integrity: sha512-YdXcMcEnqZhzql98RNrqYo9cEhTTesBiCclEtoiQUbJwx87q9453GTapYU6kJ8ZZ2ek1Vp25SiAXEFy5O/eAPw==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 '@mdx-js/react@3.1.0': resolution: {integrity: sha512-QjHtSaoameoalGnKDT3FoIl4+9RwyTmo9ZJGBdLOks/YOiWHoRDI3PUwEzOE7kEmGcV3AFcp9K6dYu9rEuKLAQ==} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 '@module-federation/error-codes@0.14.0': resolution: {integrity: sha512-GGk+EoeSACJikZZyShnLshtq9E2eCrDWbRiB4QAFXCX4oYmGgFfzXlx59vMNwqTKPJWxkEGnPYacJMcr2YYjag==} @@ -5062,8 +5062,8 @@ packages: '@storybook/blocks@8.6.0': resolution: {integrity: sha512-3PNxlB5Ooj8CIhttbDxeV6kW7ui+2GEdTngtqhnsUHVjzeTKpilsk2lviOeUzqlyq5FDK+rhpZ3L3DJ9pDvioA==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 storybook: ^8.6.0 peerDependenciesMeta: react: @@ -5113,8 +5113,8 @@ packages: resolution: {integrity: sha512-Nz/UzeYQdUZUhacrPyfkiiysSjydyjgg/p0P9HxB4p/WaJUUjMAcaoaLgy3EXx61zZJ3iD36WPuDkZs5QYrA0A==} engines: {node: '>=14.0.0'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 '@storybook/instrumenter@8.6.0': resolution: {integrity: sha512-eEY/Hfa3Vj5Nv4vHRHlSqjoyW6oAKNK3rKIXfL/eawQwb7rKhzijDLG5YBH44Hh7dEPIqUp0LEdgpyIY7GXezg==} @@ -5130,8 +5130,8 @@ packages: resolution: {integrity: sha512-04T86VG0UJtiozgZkTR5sY1qM3E0Rgwqwllvyy7kFFdkV+Sv/VsPjW9sC38s9C8FtCYRL8pJZz81ey3oylpIMA==} engines: {node: '>=18.0.0'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 storybook: ^8.6.0 typescript: '*' peerDependenciesMeta: @@ -5152,16 +5152,16 @@ packages: '@storybook/react-dom-shim@8.6.0': resolution: {integrity: sha512-5Y+vMHhcx0xnaNsLQMbkmjc3zkDn/fGBNsiLH2e4POvW3ZQvOxjoyxAsEQaKwLtFgsdCFSd2tR89F6ItYrA2JQ==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 storybook: ^8.6.0 '@storybook/react-webpack5@8.6.0': resolution: {integrity: sha512-2L9CYDPn1OL0B8K5EU/Wpo9Slg8f0vkYPaPioQnmcK3Q4SJR4JAuDVWHUtNdxhaPOkHIy887Tfrf6BEC/blMaQ==} engines: {node: '>=18.0.0'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 storybook: ^8.6.0 typescript: '>= 4.2.x' peerDependenciesMeta: @@ -5173,8 +5173,8 @@ packages: engines: {node: '>=18.0.0'} peerDependencies: '@storybook/test': 8.6.0 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 storybook: ^8.6.0 typescript: '>= 4.2.x' peerDependenciesMeta: @@ -5354,8 +5354,8 @@ packages: engines: {node: '>=18'} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -11485,7 +11485,7 @@ packages: lucide-react@0.383.0: resolution: {integrity: sha512-13xlG0CQCJtzjSQYwwJ3WRqMHtRj3EXmLlorrARt7y+IHnxUCp3XyFNL1DfaGySWxHObDvnu1u1dV+0VMKHUSg==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} @@ -14011,23 +14011,23 @@ packages: resolution: {integrity: sha512-APPU8HB2uZnpl6Vt/+0AFoVYgSRtfiP6FLrZgPPTDmqSb2R4qZRbgd0A3VzIFxDt5e+Fozjx79WjLWnF69DK8g==} engines: {node: '>=16.14.0'} - react-dom@0.0.0-experimental-5d87cd22-20250704: - resolution: {integrity: sha512-yT34O66vuyLdz9+zU9IXgOyxCzqSzBTB8Jjqti6/FIeWPtS5u+LP7BM2wU1fhYeKil0qflPs42PpD0wgl4dKJA==} + react-dom@0.0.0-experimental-223f81d8-20250707: + resolution: {integrity: sha512-0TQL+wjj3ktxKL1/LBWN3JiGqphFsbJPHh9UfXcfuQBo35ptRQsb1pcCqhCQQ8rlK/2yY9+fPVZOjVu58/900A==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 - react-dom@19.2.0-canary-5d87cd22-20250704: - resolution: {integrity: sha512-P13LQzKI1poJOd6gntrIiorhDFftKKRnBRnW30E/BdN0DuZVWz/xxSid0u/R1d6Bphn9tBxRGSKjkmLwPgGeVA==} + react-dom@19.2.0-canary-223f81d8-20250707: + resolution: {integrity: sha512-Gt/LiATgpr+kYCtLBtq27n24adacNHR5qFFquKQrrEf0hbpt251AJ0QVJlCeIjGrrJ/hoFknuj3jcfZni1cKNg==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 react-dom@19.2.0-canary-fa3feba6-20250623: resolution: {integrity: sha512-a/OyVKA4wJo1eBL82KJOBho8x2p2rZe/pubH94hGCBMfsty+x0xyB8KbE/YtNhXzMJaJ28PvvPceZ6WbqbDQlg==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 - react-is@19.2.0-canary-5d87cd22-20250704: - resolution: {integrity: sha512-V2xBZfjhFQx816KT5LzjXDzQyUpuOM6zakaSR1eb024rdsxLgReLFnJAQOeu8KWvu0fHYt+hzFWrOkbpwBkVcA==} + react-is@19.2.0-canary-223f81d8-20250707: + resolution: {integrity: sha512-6L4ED9OJqsHDJwGWhlfAiPkbuQOOJtzVsxq9BCqx8o+uM0BJbGMm4PWGGkZ4HOvHY6/srz+3qrBNpH7lZBHfzQ==} react-is@19.2.0-canary-fa3feba6-20250623: resolution: {integrity: sha512-BktwFemMIkQdqE8Ijv9BzB7rx0yAk4xndThBAi8cLnkMOd6Imm+XBeTweHHuMhehtTK623DIsWT1roVRBUby8Q==} @@ -14038,8 +14038,8 @@ packages: react-number-format@5.4.0: resolution: {integrity: sha512-NWdICrqLhI7rAS8yUeLVd6Wr4cN7UjJ9IBTS0f/a9i7UB4x4Ti70kGnksBtZ7o4Z7YRbvCMMR/jQmkoOBa/4fg==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 react-refresh@0.12.0: resolution: {integrity: sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A==} @@ -14050,7 +14050,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -14060,58 +14060,58 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true - react-server-dom-turbopack@0.0.0-experimental-5d87cd22-20250704: - resolution: {integrity: sha512-cbS3KL84rvLq5VeKemUnHPwDrCeSkaav3zycpmgd6YHFbmVlzBVnX6Hih1DLh5r6DXYY0bIHBdwxahrzg37/Og==} + react-server-dom-turbopack@0.0.0-experimental-223f81d8-20250707: + resolution: {integrity: sha512-NOvlRINH/m8hi8FbAHL1VWMkm3Da0J13wLoNVHG+K2DaZ/cBOZPwn9ls+HpAPl3Noave3D0B4ztMaSe3H3WKRg==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 - react-server-dom-turbopack@19.2.0-canary-5d87cd22-20250704: - resolution: {integrity: sha512-WURSVir6ZepU8xwUhwREoxrhbLCwmX3gIlwX18heNPT6dnZ/axTYfyWyI2lBpdepbtlfMhvDxp/rggV71gqFVQ==} + react-server-dom-turbopack@19.2.0-canary-223f81d8-20250707: + resolution: {integrity: sha512-S1I2CYTiKXwaieiOIiYhPkbsmAX7yk/BCxngEiNTEhWNKMgRZPQJ6rTNxTU9BtSN0ALa23qR9Dg36lOyCl3mQg==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 - react-server-dom-webpack@0.0.0-experimental-5d87cd22-20250704: - resolution: {integrity: sha512-CnTzIdIDbY6t1eWsXQyiQvE7lOYSWNCYKJCFUUHvKmtkuUHiZOpcYEspUpVgYeOjKMIxCth2+MGS0+Iu5tyDUQ==} + react-server-dom-webpack@0.0.0-experimental-223f81d8-20250707: + resolution: {integrity: sha512-T0Pi6rXxEnD/o9nzJAfuBv6/2MINsKwLnZ4ynWQzz0Dc3feyJ6BwTPk5cQu1gpTgovmeqdo2vAsj5ocn6jpdzA==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 webpack: 5.98.0 - react-server-dom-webpack@19.2.0-canary-5d87cd22-20250704: - resolution: {integrity: sha512-IwHyVZSY1C9HGQe2p5G6mSNz0aRacXDJHEMutY5oRUIfPnx7XgikLcUUclLgVrmErqm4zsvdE7Tbm2CepjzqRw==} + react-server-dom-webpack@19.2.0-canary-223f81d8-20250707: + resolution: {integrity: sha512-Km9nN+ibmC3N47wnYBDbqR4ah4xgut81ypX9xILTwpZyHh6KYKgSnZQHW0CUEh1d3VdMPWSyi74X1ZmISmh1+Q==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 webpack: 5.98.0 react-shallow-renderer@16.15.0: resolution: {integrity: sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 react-ssr-prepass@1.0.8: resolution: {integrity: sha512-O0gfRA1SaK+9ITKxqfnXsej2jF+OHGP/+GxD4unROQaM/0/UczGF9fuF+wTboxaQoKdIf4FvS3h/OigWh704VA==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-is: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-is: 19.2.0-canary-223f81d8-20250707 react-style-singleton@2.2.1: resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==} engines: {node: '>=10'} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -14119,26 +14119,26 @@ packages: react-test-renderer@18.2.0: resolution: {integrity: sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 react-textarea-autosize@8.5.3: resolution: {integrity: sha512-XT1024o2pqCuZSuBt9FwHlaDeNtVrtCXu0Rnz88t1jUGheCLa3PhjE1GH8Ctm2axEtvdCl5SUHYschyQ0L5QHQ==} engines: {node: '>=10'} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 react-virtualized@9.22.3: resolution: {integrity: sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707 - react@0.0.0-experimental-5d87cd22-20250704: - resolution: {integrity: sha512-dodPMWskWzT3hWldDau5g2crOk7VLG2RpIk4TdfwGrbf2b4x4nOFVOhbu7yJgu3TAM6IqO9014MVO+elH2S01g==} + react@0.0.0-experimental-223f81d8-20250707: + resolution: {integrity: sha512-vENiNfbC9MRrXBkClGAYFu1lh+Yw167fdM5vGpM+xofG38L6KqwQzxVfwI7uMNgkYlET9i3ODiGn6fqLo4bzdg==} engines: {node: '>=0.10.0'} - react@19.2.0-canary-5d87cd22-20250704: - resolution: {integrity: sha512-GlXCQxdCvJkUi0cOsijnmT36bLOhdhWIpJ8OWqGWz85IoNVTTBdmnrb64Q6N/Z2vj7yeONlA2q74YfzzF8TGpQ==} + react@19.2.0-canary-223f81d8-20250707: + resolution: {integrity: sha512-PXwfP4qVXFHqicGUiBLtoVGgIZ4tDA/czUu6lTydwd5NekllrOIz9JwrUr4E/Smm+jerwYa0N5igLMvWNlR6Mg==} engines: {node: '>=0.10.0'} react@19.2.0-canary-fa3feba6-20250623: @@ -14691,11 +14691,11 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - scheduler@0.0.0-experimental-5d87cd22-20250704: - resolution: {integrity: sha512-8140YS9oDWGaFqZCCj4fROh3Pdw4b3ZS5ZABSAIUMM3MXyy9s49RZvIqHwwS81zJp+JEcDy39l/t5LjhQ3hIWA==} + scheduler@0.0.0-experimental-223f81d8-20250707: + resolution: {integrity: sha512-GxzWW5EdXDeMfW55TvNOs/dZ8X49xVq0mQ2yBQA4sB1XyIZKJWYALRLSwhk7+9R9tqw2KpFCftKbb+S8VhSLzg==} - scheduler@0.27.0-canary-5d87cd22-20250704: - resolution: {integrity: sha512-FzegThyI6vhlr2Z1sC9LcpnTu2BTfhhhEyqY7mUaUf586KoRtmJesGXBVZ/Lhf5dfBd16kwwuzszGdaPTYrBpw==} + scheduler@0.27.0-canary-223f81d8-20250707: + resolution: {integrity: sha512-eXqeFWGk5uZxfJzqeYx0POI5Ls/zCWArfToF7gdvgwWvVMMiHPgk/X3ehIxyULh6Du9urpZ9cJi10DG1tukg5g==} schema-utils@2.7.1: resolution: {integrity: sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==} @@ -15354,7 +15354,7 @@ packages: peerDependencies: '@babel/core': '*' babel-plugin-macros: '*' - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@babel/core': optional: true @@ -15435,7 +15435,7 @@ packages: swr@2.2.4: resolution: {integrity: sha512-njiZ/4RiIhoOlAaLYDqwz5qH/KZXVilRLvomrx83HjzCWTfa+InyfAjv05PSFxnmLzZkNO9ZfvgoqzAaEI4sGQ==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 symbol-observable@1.0.1: resolution: {integrity: sha512-Kb3PrPYz4HanVF1LVGuAdW6LoVgIwjUYJGzFe7NDrBLCN4lsV/5J0MFurV+ygS4bRVwrCEt2c7MQ1R2a72oJDw==} @@ -16227,7 +16227,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -16235,13 +16235,13 @@ packages: use-composed-ref@1.3.0: resolution: {integrity: sha512-GLMG0Jc/jiKov/3Ulid1wbv3r54K9HlMW29IWcDFPEqFkSO2nS0MuefWgMJpeHQ9YJeXDL3ZUF+P3jdXlZX/cQ==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 use-isomorphic-layout-effect@1.1.2: resolution: {integrity: sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==} peerDependencies: '@types/react': '*' - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -16250,7 +16250,7 @@ packages: resolution: {integrity: sha512-xA+AVm/Wlg3e2P/JiItTziwS7FK92LWrDB0p+hgXloIMuVCeJJ8v6f0eeHyPZaJrM+usM1FkFfbNCrJGs8A/zw==} peerDependencies: '@types/react': '*' - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -16260,7 +16260,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': ^19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 peerDependenciesMeta: '@types/react': optional: true @@ -16268,12 +16268,12 @@ packages: use-sync-external-store@1.2.0: resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 use-sync-external-store@1.5.0: resolution: {integrity: sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==} peerDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -17963,16 +17963,16 @@ snapshots: '@babel/helper-string-parser': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@base-ui-components/react@1.0.0-beta.1(@types/react@19.1.1)(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)': + '@base-ui-components/react@1.0.0-beta.1(@types/react@19.1.1)(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)': dependencies: '@babel/runtime': 7.27.6 - '@floating-ui/react-dom': 2.1.4(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704) + '@floating-ui/react-dom': 2.1.4(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707) '@floating-ui/utils': 0.2.10 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) reselect: 5.1.1 tabbable: 6.2.0 - use-sync-external-store: 1.5.0(react@19.2.0-canary-5d87cd22-20250704) + use-sync-external-store: 1.5.0(react@19.2.0-canary-223f81d8-20250707) optionalDependencies: '@types/react': 19.1.1 @@ -18289,17 +18289,17 @@ snapshots: '@emotion/memoize@0.8.1': {} - '@emotion/react@11.11.1(@types/react@19.1.1)(react@19.2.0-canary-5d87cd22-20250704)': + '@emotion/react@11.11.1(@types/react@19.1.1)(react@19.2.0-canary-223f81d8-20250707)': dependencies: '@babel/runtime': 7.27.0 '@emotion/babel-plugin': 11.11.0 '@emotion/cache': 11.11.0 '@emotion/serialize': 1.1.2 - '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.2.0-canary-5d87cd22-20250704) + '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.2.0-canary-223f81d8-20250707) '@emotion/utils': 1.2.1 '@emotion/weak-memoize': 0.3.1 hoist-non-react-statics: 3.3.2 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 optionalDependencies: '@types/react': 19.1.1 transitivePeerDependencies: @@ -18317,9 +18317,9 @@ snapshots: '@emotion/unitless@0.8.1': {} - '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.2.0-canary-5d87cd22-20250704)': + '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.2.0-canary-223f81d8-20250707)': dependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 '@emotion/utils@1.2.1': {} @@ -18838,11 +18838,11 @@ snapshots: react: 19.2.0-canary-fa3feba6-20250623 react-dom: 19.2.0-canary-fa3feba6-20250623(react@19.2.0-canary-fa3feba6-20250623) - '@floating-ui/react-dom@2.1.4(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)': + '@floating-ui/react-dom@2.1.4(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)': dependencies: '@floating-ui/dom': 1.7.2 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) '@floating-ui/react@0.26.16(react-dom@19.2.0-canary-fa3feba6-20250623(react@19.2.0-canary-fa3feba6-20250623))(react@19.2.0-canary-fa3feba6-20250623)': dependencies: @@ -19987,11 +19987,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@mdx-js/react@2.2.1(react@19.2.0-canary-5d87cd22-20250704)': + '@mdx-js/react@2.2.1(react@19.2.0-canary-223f81d8-20250707)': dependencies: '@types/mdx': 2.0.3 '@types/react': 19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 '@mdx-js/react@2.2.1(react@19.2.0-canary-fa3feba6-20250623)': dependencies: @@ -19999,11 +19999,11 @@ snapshots: '@types/react': 19.1.1 react: 19.2.0-canary-fa3feba6-20250623 - '@mdx-js/react@3.1.0(@types/react@19.1.1)(react@19.2.0-canary-5d87cd22-20250704)': + '@mdx-js/react@3.1.0(@types/react@19.1.1)(react@19.2.0-canary-223f81d8-20250707)': dependencies: '@types/mdx': 2.0.3 '@types/react': 19.1.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 '@module-federation/error-codes@0.14.0': {} @@ -20751,12 +20751,12 @@ snapshots: '@storybook/addon-docs@8.6.0(@types/react@19.1.1)(storybook@8.6.0(prettier@3.3.3))': dependencies: - '@mdx-js/react': 3.1.0(@types/react@19.1.1)(react@19.2.0-canary-5d87cd22-20250704) - '@storybook/blocks': 8.6.0(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3)) + '@mdx-js/react': 3.1.0(@types/react@19.1.1)(react@19.2.0-canary-223f81d8-20250707) + '@storybook/blocks': 8.6.0(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3)) '@storybook/csf-plugin': 8.6.0(storybook@8.6.0(prettier@3.3.3)) - '@storybook/react-dom-shim': 8.6.0(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3)) - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + '@storybook/react-dom-shim': 8.6.0(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3)) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) storybook: 8.6.0(prettier@3.3.3) ts-dedent: 2.2.0 transitivePeerDependencies: @@ -20821,14 +20821,14 @@ snapshots: - '@swc/helpers' - webpack - '@storybook/blocks@8.6.0(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))': + '@storybook/blocks@8.6.0(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))': dependencies: - '@storybook/icons': 1.3.0(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704) + '@storybook/icons': 1.3.0(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707) storybook: 8.6.0(prettier@3.3.3) ts-dedent: 2.2.0 optionalDependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) '@storybook/builder-webpack5@8.6.0(@rspack/core@1.3.12(@swc/helpers@0.5.15))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2)': dependencies: @@ -20907,10 +20907,10 @@ snapshots: '@storybook/global@5.0.0': {} - '@storybook/icons@1.3.0(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)': + '@storybook/icons@1.3.0(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)': dependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) '@storybook/instrumenter@8.6.0(storybook@8.6.0(prettier@3.3.3))': dependencies: @@ -20922,17 +20922,17 @@ snapshots: dependencies: storybook: 8.6.0(prettier@3.3.3) - '@storybook/preset-react-webpack@8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2)': + '@storybook/preset-react-webpack@8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2)': dependencies: '@storybook/core-webpack': 8.6.0(storybook@8.6.0(prettier@3.3.3)) - '@storybook/react': 8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2) + '@storybook/react': 8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2) '@storybook/react-docgen-typescript-plugin': 1.0.6--canary.9.0c3f3b7.0(typescript@5.8.2)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)) '@types/semver': 7.5.6 find-up: 5.0.0 magic-string: 0.30.17 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 react-docgen: 7.1.0 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) resolve: 1.22.8 semver: 7.6.3 storybook: 8.6.0(prettier@3.3.3) @@ -20966,19 +20966,19 @@ snapshots: transitivePeerDependencies: - supports-color - '@storybook/react-dom-shim@8.6.0(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))': + '@storybook/react-dom-shim@8.6.0(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))': dependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) storybook: 8.6.0(prettier@3.3.3) - '@storybook/react-webpack5@8.6.0(@rspack/core@1.3.12(@swc/helpers@0.5.15))(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2)': + '@storybook/react-webpack5@8.6.0(@rspack/core@1.3.12(@swc/helpers@0.5.15))(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2)': dependencies: '@storybook/builder-webpack5': 8.6.0(@rspack/core@1.3.12(@swc/helpers@0.5.15))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2) - '@storybook/preset-react-webpack': 8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2) - '@storybook/react': 8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2) - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + '@storybook/preset-react-webpack': 8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2)(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2) + '@storybook/react': 8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) storybook: 8.6.0(prettier@3.3.3) optionalDependencies: typescript: 5.8.2 @@ -20991,16 +20991,16 @@ snapshots: - uglify-js - webpack-cli - '@storybook/react@8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2)': + '@storybook/react@8.6.0(@storybook/test@8.6.0(storybook@8.6.0(prettier@3.3.3)))(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3))(typescript@5.8.2)': dependencies: '@storybook/components': 8.6.0(storybook@8.6.0(prettier@3.3.3)) '@storybook/global': 5.0.0 '@storybook/manager-api': 8.6.0(storybook@8.6.0(prettier@3.3.3)) '@storybook/preview-api': 8.6.0(storybook@8.6.0(prettier@3.3.3)) - '@storybook/react-dom-shim': 8.6.0(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(storybook@8.6.0(prettier@3.3.3)) + '@storybook/react-dom-shim': 8.6.0(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(storybook@8.6.0(prettier@3.3.3)) '@storybook/theming': 8.6.0(storybook@8.6.0(prettier@3.3.3)) - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) storybook: 8.6.0(prettier@3.3.3) optionalDependencies: '@storybook/test': 8.6.0(storybook@8.6.0(prettier@3.3.3)) @@ -21207,13 +21207,13 @@ snapshots: lodash: 4.17.21 redent: 3.0.0 - '@testing-library/react@15.0.7(@types/react@19.1.1)(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)': + '@testing-library/react@15.0.7(@types/react@19.1.1)(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)': dependencies: '@babel/runtime': 7.27.0 '@testing-library/dom': 10.1.0 '@types/react-dom': 19.1.2(@types/react@19.1.1) - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) optionalDependencies: '@types/react': 19.1.1 @@ -26955,7 +26955,7 @@ snapshots: hoist-non-react-statics@3.3.2: dependencies: - react-is: 19.2.0-canary-5d87cd22-20250704 + react-is: 19.2.0-canary-223f81d8-20250707 homedir-polyfill@1.0.3: dependencies: @@ -31883,25 +31883,25 @@ snapshots: dependencies: ansi-regex: 5.0.1 ansi-styles: 5.2.0 - react-is: 19.2.0-canary-5d87cd22-20250704 + react-is: 19.2.0-canary-223f81d8-20250707 pretty-format@29.5.0: dependencies: '@jest/schemas': 29.4.3 ansi-styles: 5.2.0 - react-is: 19.2.0-canary-5d87cd22-20250704 + react-is: 19.2.0-canary-223f81d8-20250707 pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 - react-is: 19.2.0-canary-5d87cd22-20250704 + react-is: 19.2.0-canary-223f81d8-20250707 pretty-format@30.0.0-alpha.6: dependencies: '@jest/schemas': 30.0.0-alpha.6 ansi-styles: 5.2.0 - react-is: 19.2.0-canary-5d87cd22-20250704 + react-is: 19.2.0-canary-223f81d8-20250707 pretty-ms@7.0.0: dependencies: @@ -31964,7 +31964,7 @@ snapshots: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react-is: 19.2.0-canary-5d87cd22-20250704 + react-is: 19.2.0-canary-223f81d8-20250707 property-information@5.6.0: dependencies: @@ -32175,22 +32175,22 @@ snapshots: transitivePeerDependencies: - supports-color - react-dom@0.0.0-experimental-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704): + react-dom@0.0.0-experimental-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707): dependencies: - react: 19.2.0-canary-5d87cd22-20250704 - scheduler: 0.27.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + scheduler: 0.27.0-canary-223f81d8-20250707 - react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704): + react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707): dependencies: - react: 19.2.0-canary-5d87cd22-20250704 - scheduler: 0.27.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + scheduler: 0.27.0-canary-223f81d8-20250707 react-dom@19.2.0-canary-fa3feba6-20250623(react@19.2.0-canary-fa3feba6-20250623): dependencies: react: 19.2.0-canary-fa3feba6-20250623 - scheduler: 0.27.0-canary-5d87cd22-20250704 + scheduler: 0.27.0-canary-223f81d8-20250707 - react-is@19.2.0-canary-5d87cd22-20250704: {} + react-is@19.2.0-canary-223f81d8-20250707: {} react-is@19.2.0-canary-fa3feba6-20250623: {} @@ -32223,48 +32223,48 @@ snapshots: optionalDependencies: '@types/react': 19.1.1 - react-server-dom-turbopack@0.0.0-experimental-5d87cd22-20250704(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704): + react-server-dom-turbopack@0.0.0-experimental-223f81d8-20250707(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) - react-server-dom-turbopack@19.2.0-canary-5d87cd22-20250704(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704): + react-server-dom-turbopack@19.2.0-canary-223f81d8-20250707(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) - react-server-dom-webpack@0.0.0-experimental-5d87cd22-20250704(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))): + react-server-dom-webpack@0.0.0-experimental-223f81d8-20250707(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) webpack: 5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-server-dom-webpack@19.2.0-canary-5d87cd22-20250704(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))): + react-server-dom-webpack@19.2.0-canary-223f81d8-20250707(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) webpack: 5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-shallow-renderer@16.15.0(react@19.2.0-canary-5d87cd22-20250704): + react-shallow-renderer@16.15.0(react@19.2.0-canary-223f81d8-20250707): dependencies: object-assign: 4.1.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-is: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-is: 19.2.0-canary-223f81d8-20250707 - react-ssr-prepass@1.0.8(react-is@19.2.0-canary-fa3feba6-20250623)(react@19.2.0-canary-5d87cd22-20250704): + react-ssr-prepass@1.0.8(react-is@19.2.0-canary-fa3feba6-20250623)(react@19.2.0-canary-223f81d8-20250707): dependencies: object-is: 1.0.2 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 react-is: 19.2.0-canary-fa3feba6-20250623 react-style-singleton@2.2.1(@types/react@19.1.1)(react@19.2.0-canary-fa3feba6-20250623): @@ -32276,12 +32276,12 @@ snapshots: optionalDependencies: '@types/react': 19.1.1 - react-test-renderer@18.2.0(react@19.2.0-canary-5d87cd22-20250704): + react-test-renderer@18.2.0(react@19.2.0-canary-223f81d8-20250707): dependencies: - react: 19.2.0-canary-5d87cd22-20250704 - react-is: 19.2.0-canary-5d87cd22-20250704 - react-shallow-renderer: 16.15.0(react@19.2.0-canary-5d87cd22-20250704) - scheduler: 0.27.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 + react-is: 19.2.0-canary-223f81d8-20250707 + react-shallow-renderer: 16.15.0(react@19.2.0-canary-223f81d8-20250707) + scheduler: 0.27.0-canary-223f81d8-20250707 react-textarea-autosize@8.5.3(@types/react@19.1.1)(react@19.2.0-canary-fa3feba6-20250623): dependencies: @@ -32292,20 +32292,20 @@ snapshots: transitivePeerDependencies: - '@types/react' - react-virtualized@9.22.3(react-dom@19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704))(react@19.2.0-canary-5d87cd22-20250704): + react-virtualized@9.22.3(react-dom@19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707))(react@19.2.0-canary-223f81d8-20250707): dependencies: '@babel/runtime': 7.27.0 clsx: 1.1.1 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 - react: 19.2.0-canary-5d87cd22-20250704 - react-dom: 19.2.0-canary-5d87cd22-20250704(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + react-dom: 19.2.0-canary-223f81d8-20250707(react@19.2.0-canary-223f81d8-20250707) react-lifecycles-compat: 3.0.4 - react@0.0.0-experimental-5d87cd22-20250704: {} + react@0.0.0-experimental-223f81d8-20250707: {} - react@19.2.0-canary-5d87cd22-20250704: {} + react@19.2.0-canary-223f81d8-20250707: {} react@19.2.0-canary-fa3feba6-20250623: {} @@ -33068,9 +33068,9 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.0.0-experimental-5d87cd22-20250704: {} + scheduler@0.0.0-experimental-223f81d8-20250707: {} - scheduler@0.27.0-canary-5d87cd22-20250704: {} + scheduler@0.27.0-canary-223f81d8-20250707: {} schema-utils@2.7.1: dependencies: @@ -33869,10 +33869,10 @@ snapshots: postcss: 7.0.32 postcss-load-plugins: 2.3.0 - styled-jsx@5.1.6(@babel/core@7.26.10)(babel-plugin-macros@3.1.0)(react@19.2.0-canary-5d87cd22-20250704): + styled-jsx@5.1.6(@babel/core@7.26.10)(babel-plugin-macros@3.1.0)(react@19.2.0-canary-223f81d8-20250707): dependencies: client-only: 0.0.1 - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 optionalDependencies: '@babel/core': 7.26.10 babel-plugin-macros: 3.1.0 @@ -33966,11 +33966,11 @@ snapshots: '@swc/counter': 0.1.3 webpack: 5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.15))(esbuild@0.24.2) - swr@2.2.4(react@19.2.0-canary-5d87cd22-20250704): + swr@2.2.4(react@19.2.0-canary-223f81d8-20250707): dependencies: client-only: 0.0.1 - react: 19.2.0-canary-5d87cd22-20250704 - use-sync-external-store: 1.2.0(react@19.2.0-canary-5d87cd22-20250704) + react: 19.2.0-canary-223f81d8-20250707 + use-sync-external-store: 1.2.0(react@19.2.0-canary-223f81d8-20250707) symbol-observable@1.0.1: {} @@ -34767,9 +34767,9 @@ snapshots: unist-util-is: 6.0.0 unist-util-visit-parents: 6.0.1 - unistore@3.4.1(react@19.2.0-canary-5d87cd22-20250704): + unistore@3.4.1(react@19.2.0-canary-223f81d8-20250707): optionalDependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 universal-github-app-jwt@1.1.1: dependencies: @@ -34895,13 +34895,13 @@ snapshots: optionalDependencies: '@types/react': 19.1.1 - use-sync-external-store@1.2.0(react@19.2.0-canary-5d87cd22-20250704): + use-sync-external-store@1.2.0(react@19.2.0-canary-223f81d8-20250707): dependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 - use-sync-external-store@1.5.0(react@19.2.0-canary-5d87cd22-20250704): + use-sync-external-store@1.5.0(react@19.2.0-canary-223f81d8-20250707): dependencies: - react: 19.2.0-canary-5d87cd22-20250704 + react: 19.2.0-canary-223f81d8-20250707 util-deprecate@1.0.2: {}