From d42cf6a40a8ba69a1ca05f6003e05734bb940850 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Wed, 11 Dec 2024 16:48:33 +0000 Subject: [PATCH 1/8] Update `react@experimental` --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index fb5d3003e22f1..c8c857648da2b 100644 --- a/package.json +++ b/package.json @@ -211,13 +211,13 @@ "react-builtin": "npm:react@19.0.0-rc-7283a213-20241206", "react-dom": "19.0.0", "react-dom-builtin": "npm:react-dom@19.0.0-rc-7283a213-20241206", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-7283a213-20241206", - "react-experimental-builtin": "npm:react@0.0.0-experimental-7283a213-20241206", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-79ddf5b5-20241210", + "react-experimental-builtin": "npm:react@0.0.0-experimental-79ddf5b5-20241210", "react-is-builtin": "npm:react-is@19.0.0-rc-7283a213-20241206", "react-server-dom-turbopack": "19.0.0-rc-7283a213-20241206", - "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-7283a213-20241206", + "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-79ddf5b5-20241210", "react-server-dom-webpack": "19.0.0-rc-7283a213-20241206", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-7283a213-20241206", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-79ddf5b5-20241210", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -228,7 +228,7 @@ "sass": "1.54.0", "satori": "0.10.9", "scheduler-builtin": "npm:scheduler@0.25.0-rc-7283a213-20241206", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-7283a213-20241206", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-79ddf5b5-20241210", "seedrandom": "3.0.5", "semver": "7.3.7", "shell-quote": "1.7.3", From f92caab570da9e14d1db6971ab472d8bbc9e71b1 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Wed, 11 Dec 2024 16:48:33 +0000 Subject: [PATCH 2/8] Update `react@rc` --- package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index c8c857648da2b..ee7d5160e08de 100644 --- a/package.json +++ b/package.json @@ -208,15 +208,15 @@ "pretty-ms": "7.0.0", "random-seed": "0.3.0", "react": "19.0.0", - "react-builtin": "npm:react@19.0.0-rc-7283a213-20241206", + "react-builtin": "npm:react@19.0.0-rc-79ddf5b5-20241210", "react-dom": "19.0.0", - "react-dom-builtin": "npm:react-dom@19.0.0-rc-7283a213-20241206", + "react-dom-builtin": "npm:react-dom@19.0.0-rc-79ddf5b5-20241210", "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-79ddf5b5-20241210", "react-experimental-builtin": "npm:react@0.0.0-experimental-79ddf5b5-20241210", - "react-is-builtin": "npm:react-is@19.0.0-rc-7283a213-20241206", - "react-server-dom-turbopack": "19.0.0-rc-7283a213-20241206", + "react-is-builtin": "npm:react-is@19.0.0-rc-79ddf5b5-20241210", + "react-server-dom-turbopack": "19.0.0-rc-79ddf5b5-20241210", "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-79ddf5b5-20241210", - "react-server-dom-webpack": "19.0.0-rc-7283a213-20241206", + "react-server-dom-webpack": "19.0.0-rc-79ddf5b5-20241210", "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-79ddf5b5-20241210", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", @@ -227,7 +227,7 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.10.9", - "scheduler-builtin": "npm:scheduler@0.25.0-rc-7283a213-20241206", + "scheduler-builtin": "npm:scheduler@0.25.0-rc-79ddf5b5-20241210", "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-79ddf5b5-20241210", "seedrandom": "3.0.5", "semver": "7.3.7", @@ -269,10 +269,10 @@ "@types/react": "19.0.0", "@types/react-dom": "19.0.0", "jest-snapshot": "30.0.0-alpha.6", - "react": "19.0.0-rc-7283a213-20241206", - "react-dom": "19.0.0-rc-7283a213-20241206", - "react-is": "19.0.0-rc-7283a213-20241206", - "scheduler": "0.25.0-rc-7283a213-20241206" + "react": "19.0.0-rc-79ddf5b5-20241210", + "react-dom": "19.0.0-rc-79ddf5b5-20241210", + "react-is": "19.0.0-rc-79ddf5b5-20241210", + "scheduler": "0.25.0-rc-79ddf5b5-20241210" }, "patchedDependencies": { "webpack-sources@3.2.3": "patches/webpack-sources@3.2.3.patch" From 80be940b4007ec9254a3d42af1ca928532c89598 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Wed, 11 Dec 2024 16:48:34 +0000 Subject: [PATCH 3/8] Updated peer dependency references in apps From f0a255810062100fbf215d51aa9fb0102c2bb004 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Wed, 11 Dec 2024 16:48:34 +0000 Subject: [PATCH 4/8] Updated peer dependency references in libraries From 68522f53e3bd6cb7306f129bdbd8a71c3308af2d Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Wed, 11 Dec 2024 16:48:46 +0000 Subject: [PATCH 5/8] Update lockfile --- pnpm-lock.yaml | 368 ++++++++++++++++++++++++------------------------- 1 file changed, 184 insertions(+), 184 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03c94eeba2c8b..b2e8b59d9c23c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,10 +16,10 @@ overrides: '@types/react': 19.0.0 '@types/react-dom': 19.0.0 jest-snapshot: 30.0.0-alpha.6 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 - react-is: 19.0.0-rc-7283a213-20241206 - scheduler: 0.25.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 + react-is: 19.0.0-rc-79ddf5b5-20241210 + scheduler: 0.25.0-rc-79ddf5b5-20241210 patchedDependencies: webpack-sources@3.2.3: @@ -68,7 +68,7 @@ importers: version: 11.11.0 '@emotion/react': specifier: 11.11.1 - version: 11.11.1(@types/react@19.0.0)(react@19.0.0-rc-7283a213-20241206) + version: 11.11.1(@types/react@19.0.0)(react@19.0.0-rc-79ddf5b5-20241210) '@fullhuman/postcss-purgecss': specifier: 1.3.0 version: 1.3.0 @@ -77,7 +77,7 @@ importers: version: 2.2.1(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))) '@mdx-js/react': specifier: 2.2.1 - version: 2.2.1(react@19.0.0-rc-7283a213-20241206) + version: 2.2.1(react@19.0.0-rc-79ddf5b5-20241210) '@next/bundle-analyzer': specifier: workspace:* version: link:packages/next-bundle-analyzer @@ -137,7 +137,7 @@ importers: version: 6.1.2(@jest/globals@29.7.0)(@types/jest@29.5.5)(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0)) '@testing-library/react': specifier: ^15.0.5 - version: 15.0.7(@types/react@19.0.0)(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206) + version: 15.0.7(@types/react@19.0.0)(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210) '@types/busboy': specifier: 1.5.3 version: 1.5.3 @@ -448,44 +448,44 @@ importers: specifier: 0.3.0 version: 0.3.0 react: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206 + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210 react-builtin: - specifier: npm:react@19.0.0-rc-7283a213-20241206 - version: react@19.0.0-rc-7283a213-20241206 + specifier: npm:react@19.0.0-rc-79ddf5b5-20241210 + version: react@19.0.0-rc-79ddf5b5-20241210 react-dom: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) react-dom-builtin: - specifier: npm:react-dom@19.0.0-rc-7283a213-20241206 - version: react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + specifier: npm:react-dom@19.0.0-rc-79ddf5b5-20241210 + version: react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) react-dom-experimental-builtin: - specifier: npm:react-dom@0.0.0-experimental-7283a213-20241206 - version: react-dom@0.0.0-experimental-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + specifier: npm:react-dom@0.0.0-experimental-79ddf5b5-20241210 + version: react-dom@0.0.0-experimental-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) react-experimental-builtin: - specifier: npm:react@0.0.0-experimental-7283a213-20241206 - version: react@0.0.0-experimental-7283a213-20241206 + specifier: npm:react@0.0.0-experimental-79ddf5b5-20241210 + version: react@0.0.0-experimental-79ddf5b5-20241210 react-is-builtin: - specifier: npm:react-is@19.0.0-rc-7283a213-20241206 - version: react-is@19.0.0-rc-7283a213-20241206 + specifier: npm:react-is@19.0.0-rc-79ddf5b5-20241210 + version: react-is@19.0.0-rc-79ddf5b5-20241210 react-server-dom-turbopack: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206) + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210) react-server-dom-turbopack-experimental: - specifier: npm:react-server-dom-turbopack@0.0.0-experimental-7283a213-20241206 - version: react-server-dom-turbopack@0.0.0-experimental-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206) + specifier: npm:react-server-dom-turbopack@0.0.0-experimental-79ddf5b5-20241210 + version: react-server-dom-turbopack@0.0.0-experimental-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210) react-server-dom-webpack: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))) + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))) react-server-dom-webpack-experimental: - specifier: npm:react-server-dom-webpack@0.0.0-experimental-7283a213-20241206 - version: react-server-dom-webpack@0.0.0-experimental-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))) + specifier: npm:react-server-dom-webpack@0.0.0-experimental-79ddf5b5-20241210 + version: react-server-dom-webpack@0.0.0-experimental-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))) react-ssr-prepass: specifier: 1.0.8 - version: 1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-7283a213-20241206) + version: 1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-79ddf5b5-20241210) react-virtualized: specifier: 9.22.3 - version: 9.22.3(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206) + version: 9.22.3(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210) relay-compiler: specifier: 13.0.2 version: 13.0.2 @@ -508,11 +508,11 @@ importers: specifier: 0.10.9 version: 0.10.9 scheduler-builtin: - specifier: npm:scheduler@0.25.0-rc-7283a213-20241206 - version: scheduler@0.25.0-rc-7283a213-20241206 + specifier: npm:scheduler@0.25.0-rc-79ddf5b5-20241210 + version: scheduler@0.25.0-rc-79ddf5b5-20241210 scheduler-experimental-builtin: - specifier: npm:scheduler@0.0.0-experimental-7283a213-20241206 - version: scheduler@0.0.0-experimental-7283a213-20241206 + specifier: npm:scheduler@0.0.0-experimental-79ddf5b5-20241210 + version: scheduler@0.0.0-experimental-79ddf5b5-20241210 seedrandom: specifier: 3.0.5 version: 3.0.5 @@ -527,16 +527,16 @@ importers: version: 6.0.0 styled-components: specifier: 6.0.0-rc.3 - version: 6.0.0-rc.3(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206) + version: 6.0.0-rc.3(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210) styled-jsx: specifier: 5.1.6 - version: 5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-7283a213-20241206) + version: 5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-79ddf5b5-20241210) styled-jsx-plugin-postcss: specifier: 3.0.2 version: 3.0.2 swr: specifier: ^2.2.4 - version: 2.2.4(react@19.0.0-rc-7283a213-20241206) + version: 2.2.4(react@19.0.0-rc-79ddf5b5-20241210) tailwindcss: specifier: 3.2.7 version: 3.2.7(postcss@8.4.31) @@ -863,17 +863,17 @@ importers: specifier: 8.4.31 version: 8.4.31 react: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206 + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210 react-dom: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) sass: specifier: ^1.3.0 version: 1.77.8 styled-jsx: specifier: 5.1.6 - version: 5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-7283a213-20241206) + version: 5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-79ddf5b5-20241210) optionalDependencies: sharp: specifier: ^0.33.5 @@ -1454,7 +1454,7 @@ importers: version: 1.0.35 unistore: specifier: 3.4.1 - version: 3.4.1(react@19.0.0-rc-7283a213-20241206) + version: 3.4.1(react@19.0.0-rc-79ddf5b5-20241210) util: specifier: 0.12.4 version: 0.12.4 @@ -1612,8 +1612,8 @@ importers: packages/third-parties: dependencies: react: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206 + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210 third-party-capital: specifier: 1.0.20 version: 1.0.20 @@ -1676,14 +1676,14 @@ importers: specifier: 29.5.0 version: 29.5.0 react: - specifier: 19.0.0-rc-7283a213-20241206 - version: 19.0.0-rc-7283a213-20241206 + specifier: 19.0.0-rc-79ddf5b5-20241210 + version: 19.0.0-rc-79ddf5b5-20241210 react-test-renderer: specifier: 18.2.0 - version: 18.2.0(react@19.0.0-rc-7283a213-20241206) + version: 18.2.0(react@19.0.0-rc-79ddf5b5-20241210) styled-jsx: specifier: ^5.1.2 - version: 5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-7283a213-20241206) + version: 5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-79ddf5b5-20241210) turbopack/packages/devlow-bench: dependencies: @@ -3422,7 +3422,7 @@ packages: resolution: {integrity: sha512-5mlW1DquU5HaxjLkfkGN1GA/fvVGdyHURRiX/0FHl2cfIfRxSOfmxEH5YS43edp0OldZrZ+dkBKbngxcNCdZvA==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -3439,7 +3439,7 @@ packages: '@emotion/use-insertion-effect-with-fallbacks@1.0.1': resolution: {integrity: sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 '@emotion/utils@1.2.1': resolution: {integrity: sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==} @@ -3788,14 +3788,14 @@ packages: '@floating-ui/react-dom@2.1.0': resolution: {integrity: sha512-lNzj5EQmEKn5FFKc04+zasr09h/uX8RtJRNj5gUXsSQIXHVWTVh+hVAg1vOMCexkX8EgvemMvIFpQfkosnVNyA==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 '@floating-ui/react@0.26.16': resolution: {integrity: sha512-HEf43zxZNAI/E781QIVpYSF3K2VH4TTYZpqecjdsFkjsaU1EbaWcM++kw0HXFffj7gDUcBFevX8s0rQGQpxkow==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 '@floating-ui/utils@0.2.2': resolution: {integrity: sha512-J4yDIIthosAsRZ5CPYP/jQvUAQtlZTTD/4suA08/FEnlxqW3sKS9iAhgsa9VYLZ6vDHn/ixJgIqRQPotoBjxIw==} @@ -4450,13 +4450,13 @@ packages: resolution: {integrity: sha512-l9ypojKN3PjwO1CSLIsqxi7mA25+7w+xc71Q+JuCCREI0tuGwkZsKbIOpuTATIJOjPh8ycLiW7QxX1LYsRTq6w==} peerDependencies: '@mantine/hooks': 7.10.1 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 '@mantine/hooks@7.11.2': resolution: {integrity: sha512-jhyVe/sbDEG2U8rr2lMecUPgQxcfr5hh9HazqGfkS7ZRIMDO7uJ947yAcTMGGkp5Lxtt5TBFt1Cb6tiB2/1agg==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 '@mapbox/node-pre-gyp@1.0.5': resolution: {integrity: sha512-4srsKPXWlIxp5Vbqz5uLfBN+du2fJChBoYn/f2h991WLdk7jUvcSk/McVLSv/X+xQIPI8eGD5GjrnygdyHnhPA==} @@ -4473,7 +4473,7 @@ packages: '@mdx-js/react@2.2.1': resolution: {integrity: sha512-YdXcMcEnqZhzql98RNrqYo9cEhTTesBiCclEtoiQUbJwx87q9453GTapYU6kJ8ZZ2ek1Vp25SiAXEFy5O/eAPw==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 '@mswjs/cookies@1.1.0': resolution: {integrity: sha512-0ZcCVQxifZmhwNBoQIrystCb+2sWBY2Zw8lpfJBPCHGCA/HWqehITeCRVIv4VMy8MPlaHo2w2pTHFV2pFfqKPw==} @@ -5065,8 +5065,8 @@ packages: engines: {node: '>=18'} peerDependencies: '@types/react': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -10548,7 +10548,7 @@ packages: lucide-react@0.383.0: resolution: {integrity: sha512-13xlG0CQCJtzjSQYwwJ3WRqMHtRj3EXmLlorrARt7y+IHnxUCp3XyFNL1DfaGySWxHObDvnu1u1dV+0VMKHUSg==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} @@ -12749,23 +12749,23 @@ packages: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true - react-dom@0.0.0-experimental-7283a213-20241206: - resolution: {integrity: sha512-w1P8sybEM3BWnXelZxeKQ2390vlVVO/yXx5LdJUPF6fSP/gJoauTFCT2co1is4L9m7J3Sn3FSn3eZr5AlIWqhg==} + react-dom@0.0.0-experimental-79ddf5b5-20241210: + resolution: {integrity: sha512-bAB3yL0kntJWIC01+WprH/XAp7KATXSZ0kc6lUN9A1jMMDYTDOBmN0ghCMnDe/5lalJJouqGAmRd5bkji9HqwQ==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 - react-dom@19.0.0-rc-7283a213-20241206: - resolution: {integrity: sha512-SmMSvpa+J1XfHyEX8gwBTeKh/FewFdwCTvFVPMkAIEDnZsFt+yNXSAJNSKqXvgVSFU7UL+awN9sDneffJJwr1Q==} + react-dom@19.0.0-rc-79ddf5b5-20241210: + resolution: {integrity: sha512-WZWhhKSjz1VKmh3S74R0fgyoaS2J6wKOK4IO1PamlQGSnxzjAGUAMnY6IB4x2rWh0I6xxkBLNlk2pPBfbO5+Jw==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 react-dom@19.0.0-rc-f90a6bcc-20240827: resolution: {integrity: sha512-oUa/reDvGtjRcxi8u+GYHaDHanudaO28+G+Wvxm50CItW1xwIFN2Nn7foJxxDS9lFLGdRWZvjxldZEPAUSuXbg==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 - react-is@19.0.0-rc-7283a213-20241206: - resolution: {integrity: sha512-A4ZRE1X34Tz0QtZhWUSTlRBe03zF0Na8nCEio7Q2MmwaXEIqIlRtDUY89La25dwwCpu/1XJWplSbjvDob/7tmQ==} + react-is@19.0.0-rc-79ddf5b5-20241210: + resolution: {integrity: sha512-e+EUccABmK45HHLr0dEXO23tx/lvIOzIP0IFFsQNPHK9xofRZLtH5Z+EDx15tD2Ec24CofSTKa02wtL4cXn8/g==} react-is@19.0.0-rc-f90a6bcc-20240827: resolution: {integrity: sha512-1tXoLFzVbqHAQeY3CwpyF5IYbkwgSoNHhrhS8qOrfiZIh2461h/C1BP/JVIxwyL51wHhUgLsAc/M8g0OcEhV1A==} @@ -12776,8 +12776,8 @@ packages: react-number-format@5.4.0: resolution: {integrity: sha512-NWdICrqLhI7rAS8yUeLVd6Wr4cN7UjJ9IBTS0f/a9i7UB4x4Ti70kGnksBtZ7o4Z7YRbvCMMR/jQmkoOBa/4fg==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 react-refresh@0.12.0: resolution: {integrity: sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A==} @@ -12788,7 +12788,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -12798,58 +12798,58 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true - react-server-dom-turbopack@0.0.0-experimental-7283a213-20241206: - resolution: {integrity: sha512-E0R0xI/CP1ubUkD+u7EA+JzDUO5J2hW4iPkllvppDcn8FdsjBoZCPMmsGX/vdJ7qf2lZ9BgqpaaaLbt1ACn58A==} + react-server-dom-turbopack@0.0.0-experimental-79ddf5b5-20241210: + resolution: {integrity: sha512-1wn8WapvHowAnc9Hn3CBdVJDyIP6vN8VgQFpfsoWCjwgLaKDLRgt4z4QNiO6Z/BHjWudBEona1DbEtCrP9TjyQ==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 - react-server-dom-turbopack@19.0.0-rc-7283a213-20241206: - resolution: {integrity: sha512-yqved4QJLsyYx5UCYb+JwrtyXKQX2ffPUei9r07Q/Yvm+W5IU9oJfJwd91hoyGiteebYIw7Ks/E9Qp3KaGDRxg==} + react-server-dom-turbopack@19.0.0-rc-79ddf5b5-20241210: + resolution: {integrity: sha512-zJpQDG62FTsDzNQItOQR6uHRm4mK5TkT4Uin9vy0/h30fenLo7VcmKJxDz9Xsz5n2zQMu58CcUANpYkh/msbOw==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 - react-server-dom-webpack@0.0.0-experimental-7283a213-20241206: - resolution: {integrity: sha512-tSLSIDHC6usnR0wW6ynr4+hqBPaytSu9hFxqIS2qnpmxHDXEH0IBNTwxwo+gVOo9uC5NlszQYZvg2MwULNaEjQ==} + react-server-dom-webpack@0.0.0-experimental-79ddf5b5-20241210: + resolution: {integrity: sha512-GIzh38PiMl86BqsOBvsJEYGebZl1YH/AANhCq3Myz23/KQdbld6nk8yDKmG105J3674LCWnOSLtqo6W06GKeJA==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 webpack: 5.96.1 - react-server-dom-webpack@19.0.0-rc-7283a213-20241206: - resolution: {integrity: sha512-O0k1TQRI71LHt7uO15jDmzDuTlB+HkQoknJhzSNw/SbMZuNYGWk7dCvOjzdi7fshurZzQf7TIxO/MaKcn0Fo4Q==} + react-server-dom-webpack@19.0.0-rc-79ddf5b5-20241210: + resolution: {integrity: sha512-11XZHrDsN7lfnl0VgWiQczxnsXTZQHG9/YuycHfgondHT4AHSvE5MT09sAqEyMi+cgaWLJBleuPNS4p1Tugy0A==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 webpack: 5.96.1 react-shallow-renderer@16.15.0: resolution: {integrity: sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 react-ssr-prepass@1.0.8: resolution: {integrity: sha512-O0gfRA1SaK+9ITKxqfnXsej2jF+OHGP/+GxD4unROQaM/0/UczGF9fuF+wTboxaQoKdIf4FvS3h/OigWh704VA==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-is: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-is: 19.0.0-rc-79ddf5b5-20241210 react-style-singleton@2.2.1: resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==} engines: {node: '>=10'} peerDependencies: '@types/react': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -12857,26 +12857,26 @@ packages: react-test-renderer@18.2.0: resolution: {integrity: sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 react-textarea-autosize@8.5.3: resolution: {integrity: sha512-XT1024o2pqCuZSuBt9FwHlaDeNtVrtCXu0Rnz88t1jUGheCLa3PhjE1GH8Ctm2axEtvdCl5SUHYschyQ0L5QHQ==} engines: {node: '>=10'} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 react-virtualized@9.22.3: resolution: {integrity: sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 - react@0.0.0-experimental-7283a213-20241206: - resolution: {integrity: sha512-t6ZYhZUTG4QehY7+tsxJetYkEhptwOpXMJy4Gd/LVeZ/mORSVaPZPltiOhuUg/NJH4+UqHqZAwq9I4GufK7VkQ==} + react@0.0.0-experimental-79ddf5b5-20241210: + resolution: {integrity: sha512-+e7TiHmfdCEzR942m4ukOBf/4jd41Mc8M/ExOGYT7LtbrXCX/HCw9RqffaYZXdMd3+QD/nBzx9f/DTDLzP8FLA==} engines: {node: '>=0.10.0'} - react@19.0.0-rc-7283a213-20241206: - resolution: {integrity: sha512-Jl/WSFghvrXr58g29BOBctG+uh3qvB05O149bsYVzv1OAOWe8ADElQn0ujSHjxcWAgU5UzsCqqRauzngjd/hgw==} + react@19.0.0-rc-79ddf5b5-20241210: + resolution: {integrity: sha512-iJSAL1G73xbxyrgEo46l958FFA0fCUaloPPNY7JX4PTSMLVpZrOqjvhglf8PY5zxPPnvyxUsZbOoTFfrs73i/Q==} engines: {node: '>=0.10.0'} react@19.0.0-rc-f90a6bcc-20240827: @@ -13396,11 +13396,11 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - scheduler@0.0.0-experimental-7283a213-20241206: - resolution: {integrity: sha512-+BceoijzR3mR0l3LXdW6IFi/xiq+2NNadK5QaxXNBW+jfq1g0xX+UZNGjNPN/aEsl4pBcySF3imH7WjDf+Mpmw==} + scheduler@0.0.0-experimental-79ddf5b5-20241210: + resolution: {integrity: sha512-Rg1aDzPQWVLENsVBlZbIS1buG55XTCEN7tOz0qk+pCnhswwa7h0VzGFVmX8CLuWnTYQYWw9ldFrjKLDM1Q1k3g==} - scheduler@0.25.0-rc-7283a213-20241206: - resolution: {integrity: sha512-rv6fUiCpVctRLUSnlq+WKfX60AqAoVG4lVM+HuSCkaCIAolRcL0QpzeUcnsyxWfI//lzRPtAdlNwD5l6l58z3Q==} + scheduler@0.25.0-rc-79ddf5b5-20241210: + resolution: {integrity: sha512-66xzzWBIrUnCLqkQsDDQ0I3f838Dhqa88GvBNBiKZ0j3FSnpmWKddwsBhCoSs5YLW/dd8MR3lnxDT4nhkOqT0w==} schema-utils@2.7.1: resolution: {integrity: sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==} @@ -13945,8 +13945,8 @@ packages: engines: {node: '>= 16'} peerDependencies: babel-plugin-styled-components: '>= 2' - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: babel-plugin-styled-components: optional: true @@ -13960,7 +13960,7 @@ packages: peerDependencies: '@babel/core': '*' babel-plugin-macros: '*' - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@babel/core': optional: true @@ -14034,7 +14034,7 @@ packages: swr@2.2.4: resolution: {integrity: sha512-njiZ/4RiIhoOlAaLYDqwz5qH/KZXVilRLvomrx83HjzCWTfa+InyfAjv05PSFxnmLzZkNO9ZfvgoqzAaEI4sGQ==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 symbol-observable@1.0.1: resolution: {integrity: sha512-Kb3PrPYz4HanVF1LVGuAdW6LoVgIwjUYJGzFe7NDrBLCN4lsV/5J0MFurV+ygS4bRVwrCEt2c7MQ1R2a72oJDw==} @@ -14748,7 +14748,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -14756,13 +14756,13 @@ packages: use-composed-ref@1.3.0: resolution: {integrity: sha512-GLMG0Jc/jiKov/3Ulid1wbv3r54K9HlMW29IWcDFPEqFkSO2nS0MuefWgMJpeHQ9YJeXDL3ZUF+P3jdXlZX/cQ==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 use-isomorphic-layout-effect@1.1.2: resolution: {integrity: sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -14771,7 +14771,7 @@ packages: resolution: {integrity: sha512-xA+AVm/Wlg3e2P/JiItTziwS7FK92LWrDB0p+hgXloIMuVCeJJ8v6f0eeHyPZaJrM+usM1FkFfbNCrJGs8A/zw==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -14781,7 +14781,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 peerDependenciesMeta: '@types/react': optional: true @@ -14789,7 +14789,7 @@ packages: use-sync-external-store@1.2.0: resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} peerDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -17436,17 +17436,17 @@ snapshots: '@emotion/memoize@0.8.1': {} - '@emotion/react@11.11.1(@types/react@19.0.0)(react@19.0.0-rc-7283a213-20241206)': + '@emotion/react@11.11.1(@types/react@19.0.0)(react@19.0.0-rc-79ddf5b5-20241210)': dependencies: '@babel/runtime': 7.22.5 '@emotion/babel-plugin': 11.11.0 '@emotion/cache': 11.11.0 '@emotion/serialize': 1.1.2 - '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-7283a213-20241206) + '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-79ddf5b5-20241210) '@emotion/utils': 1.2.1 '@emotion/weak-memoize': 0.3.1 hoist-non-react-statics: 3.3.2 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 optionalDependencies: '@types/react': 19.0.0 transitivePeerDependencies: @@ -17464,9 +17464,9 @@ snapshots: '@emotion/unitless@0.8.1': {} - '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-7283a213-20241206)': + '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-79ddf5b5-20241210)': dependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 '@emotion/utils@1.2.1': {} @@ -18906,11 +18906,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@mdx-js/react@2.2.1(react@19.0.0-rc-7283a213-20241206)': + '@mdx-js/react@2.2.1(react@19.0.0-rc-79ddf5b5-20241210)': dependencies: '@types/mdx': 2.0.3 '@types/react': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 '@mdx-js/react@2.2.1(react@19.0.0-rc-f90a6bcc-20240827)': dependencies: @@ -19602,13 +19602,13 @@ snapshots: '@types/jest': 29.5.5 jest: 29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0) - '@testing-library/react@15.0.7(@types/react@19.0.0)(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206)': + '@testing-library/react@15.0.7(@types/react@19.0.0)(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210)': dependencies: '@babel/runtime': 7.22.5 '@testing-library/dom': 10.1.0 '@types/react-dom': 19.0.0 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) optionalDependencies: '@types/react': 19.0.0 @@ -24736,7 +24736,7 @@ snapshots: hoist-non-react-statics@3.3.2: dependencies: - react-is: 19.0.0-rc-7283a213-20241206 + react-is: 19.0.0-rc-79ddf5b5-20241210 homedir-polyfill@1.0.3: dependencies: @@ -28907,31 +28907,31 @@ snapshots: '@jest/types': 24.9.0 ansi-regex: 4.1.0 ansi-styles: 3.2.1 - react-is: 19.0.0-rc-7283a213-20241206 + react-is: 19.0.0-rc-79ddf5b5-20241210 pretty-format@27.5.1: dependencies: ansi-regex: 5.0.1 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-7283a213-20241206 + react-is: 19.0.0-rc-79ddf5b5-20241210 pretty-format@29.5.0: dependencies: '@jest/schemas': 29.4.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-7283a213-20241206 + react-is: 19.0.0-rc-79ddf5b5-20241210 pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-7283a213-20241206 + react-is: 19.0.0-rc-79ddf5b5-20241210 pretty-format@30.0.0-alpha.6: dependencies: '@jest/schemas': 30.0.0-alpha.6 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-7283a213-20241206 + react-is: 19.0.0-rc-79ddf5b5-20241210 pretty-ms@7.0.0: dependencies: @@ -28988,7 +28988,7 @@ snapshots: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react-is: 19.0.0-rc-7283a213-20241206 + react-is: 19.0.0-rc-79ddf5b5-20241210 property-information@5.6.0: dependencies: @@ -29152,22 +29152,22 @@ snapshots: minimist: 1.2.8 strip-json-comments: 2.0.1 - react-dom@0.0.0-experimental-7283a213-20241206(react@19.0.0-rc-7283a213-20241206): + react-dom@0.0.0-experimental-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210): dependencies: - react: 19.0.0-rc-7283a213-20241206 - scheduler: 0.25.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + scheduler: 0.25.0-rc-79ddf5b5-20241210 - react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206): + react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210): dependencies: - react: 19.0.0-rc-7283a213-20241206 - scheduler: 0.25.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + scheduler: 0.25.0-rc-79ddf5b5-20241210 react-dom@19.0.0-rc-f90a6bcc-20240827(react@19.0.0-rc-f90a6bcc-20240827): dependencies: react: 19.0.0-rc-f90a6bcc-20240827 - scheduler: 0.25.0-rc-7283a213-20241206 + scheduler: 0.25.0-rc-79ddf5b5-20241210 - react-is@19.0.0-rc-7283a213-20241206: {} + react-is@19.0.0-rc-79ddf5b5-20241210: {} react-is@19.0.0-rc-f90a6bcc-20240827: {} @@ -29200,48 +29200,48 @@ snapshots: optionalDependencies: '@types/react': 19.0.0 - react-server-dom-turbopack@0.0.0-experimental-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206): + react-server-dom-turbopack@0.0.0-experimental-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) - react-server-dom-turbopack@19.0.0-rc-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206): + react-server-dom-turbopack@19.0.0-rc-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) - react-server-dom-webpack@0.0.0-experimental-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))): + react-server-dom-webpack@0.0.0-experimental-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) webpack: 5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-server-dom-webpack@19.0.0-rc-7283a213-20241206(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))): + react-server-dom-webpack@19.0.0-rc-79ddf5b5-20241210(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210)(webpack@5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) webpack: 5.96.1(@swc/core@1.9.3(@swc/helpers@0.5.15)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-shallow-renderer@16.15.0(react@19.0.0-rc-7283a213-20241206): + react-shallow-renderer@16.15.0(react@19.0.0-rc-79ddf5b5-20241210): dependencies: object-assign: 4.1.1 - react: 19.0.0-rc-7283a213-20241206 - react-is: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-is: 19.0.0-rc-79ddf5b5-20241210 - react-ssr-prepass@1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-7283a213-20241206): + react-ssr-prepass@1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-79ddf5b5-20241210): dependencies: object-is: 1.0.2 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 react-is: 19.0.0-rc-f90a6bcc-20240827 react-style-singleton@2.2.1(@types/react@19.0.0)(react@19.0.0-rc-f90a6bcc-20240827): @@ -29253,12 +29253,12 @@ snapshots: optionalDependencies: '@types/react': 19.0.0 - react-test-renderer@18.2.0(react@19.0.0-rc-7283a213-20241206): + react-test-renderer@18.2.0(react@19.0.0-rc-79ddf5b5-20241210): dependencies: - react: 19.0.0-rc-7283a213-20241206 - react-is: 19.0.0-rc-7283a213-20241206 - react-shallow-renderer: 16.15.0(react@19.0.0-rc-7283a213-20241206) - scheduler: 0.25.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 + react-is: 19.0.0-rc-79ddf5b5-20241210 + react-shallow-renderer: 16.15.0(react@19.0.0-rc-79ddf5b5-20241210) + scheduler: 0.25.0-rc-79ddf5b5-20241210 react-textarea-autosize@8.5.3(@types/react@19.0.0)(react@19.0.0-rc-f90a6bcc-20240827): dependencies: @@ -29269,20 +29269,20 @@ snapshots: transitivePeerDependencies: - '@types/react' - react-virtualized@9.22.3(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206): + react-virtualized@9.22.3(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210): dependencies: '@babel/runtime': 7.22.5 clsx: 1.1.1 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) react-lifecycles-compat: 3.0.4 - react@0.0.0-experimental-7283a213-20241206: {} + react@0.0.0-experimental-79ddf5b5-20241210: {} - react@19.0.0-rc-7283a213-20241206: {} + react@19.0.0-rc-79ddf5b5-20241210: {} react@19.0.0-rc-f90a6bcc-20240827: {} @@ -29985,9 +29985,9 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.0.0-experimental-7283a213-20241206: {} + scheduler@0.0.0-experimental-79ddf5b5-20241210: {} - scheduler@0.25.0-rc-7283a213-20241206: {} + scheduler@0.25.0-rc-79ddf5b5-20241210: {} schema-utils@2.7.1: dependencies: @@ -30594,7 +30594,7 @@ snapshots: dependencies: inline-style-parser: 0.1.1 - styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206))(react@19.0.0-rc-7283a213-20241206): + styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210))(react@19.0.0-rc-79ddf5b5-20241210): dependencies: '@babel/cli': 7.21.5(@babel/core@7.22.5) '@babel/core': 7.22.5 @@ -30609,8 +30609,8 @@ snapshots: '@emotion/unitless': 0.8.1 css-to-react-native: 3.2.0 postcss: 8.4.31 - react: 19.0.0-rc-7283a213-20241206 - react-dom: 19.0.0-rc-7283a213-20241206(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + react-dom: 19.0.0-rc-79ddf5b5-20241210(react@19.0.0-rc-79ddf5b5-20241210) shallowequal: 1.1.0 stylis: 4.2.0 tslib: 2.5.3 @@ -30622,10 +30622,10 @@ snapshots: postcss: 7.0.32 postcss-load-plugins: 2.3.0 - styled-jsx@5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-7283a213-20241206): + styled-jsx@5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-79ddf5b5-20241210): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 optionalDependencies: '@babel/core': 7.22.5 babel-plugin-macros: 3.1.0 @@ -30713,11 +30713,11 @@ snapshots: csso: 5.0.5 picocolors: 1.0.1 - swr@2.2.4(react@19.0.0-rc-7283a213-20241206): + swr@2.2.4(react@19.0.0-rc-79ddf5b5-20241210): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-7283a213-20241206 - use-sync-external-store: 1.2.0(react@19.0.0-rc-7283a213-20241206) + react: 19.0.0-rc-79ddf5b5-20241210 + use-sync-external-store: 1.2.0(react@19.0.0-rc-79ddf5b5-20241210) symbol-observable@1.0.1: {} @@ -31370,9 +31370,9 @@ snapshots: unist-util-is: 5.2.0 unist-util-visit-parents: 5.1.3 - unistore@3.4.1(react@19.0.0-rc-7283a213-20241206): + unistore@3.4.1(react@19.0.0-rc-79ddf5b5-20241210): optionalDependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 universal-github-app-jwt@1.1.1: dependencies: @@ -31488,9 +31488,9 @@ snapshots: optionalDependencies: '@types/react': 19.0.0 - use-sync-external-store@1.2.0(react@19.0.0-rc-7283a213-20241206): + use-sync-external-store@1.2.0(react@19.0.0-rc-79ddf5b5-20241210): dependencies: - react: 19.0.0-rc-7283a213-20241206 + react: 19.0.0-rc-79ddf5b5-20241210 util-deprecate@1.0.2: {} From 4f237254bbb3f4cfd00e68716de189039323d8ba Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Wed, 11 Dec 2024 16:49:22 +0000 Subject: [PATCH 6/8] ncc-compiled --- .../cjs/react-dom-client.development.js | 11 +- .../cjs/react-dom-client.production.js | 11 +- .../cjs/react-dom-profiling.development.js | 11 +- .../cjs/react-dom-profiling.profiling.js | 11 +- ...t-dom-server-legacy.browser.development.js | 2 +- ...ct-dom-server-legacy.browser.production.js | 2 +- ...eact-dom-server-legacy.node.development.js | 2 +- ...react-dom-server-legacy.node.production.js | 2 +- .../react-dom-server.browser.development.js | 6 +- .../react-dom-server.browser.production.js | 6 +- .../cjs/react-dom-server.bun.production.js | 6 +- .../cjs/react-dom-server.edge.development.js | 6 +- .../cjs/react-dom-server.edge.production.js | 6 +- .../cjs/react-dom-server.node.development.js | 6 +- .../cjs/react-dom-server.node.production.js | 6 +- .../react-dom-unstable_testing.development.js | 11 +- .../react-dom-unstable_testing.production.js | 11 +- .../cjs/react-dom.development.js | 2 +- .../cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 2 +- .../cjs/react-dom.react-server.production.js | 2 +- .../react-dom-experimental/package.json | 4 +- .../cjs/react-dom-client.development.js | 11 +- .../cjs/react-dom-client.production.js | 11 +- .../cjs/react-dom-profiling.development.js | 11 +- .../cjs/react-dom-profiling.profiling.js | 11 +- ...t-dom-server-legacy.browser.development.js | 2 +- ...ct-dom-server-legacy.browser.production.js | 2 +- ...eact-dom-server-legacy.node.development.js | 2 +- ...react-dom-server-legacy.node.production.js | 2 +- .../react-dom-server.browser.development.js | 6 +- .../react-dom-server.browser.production.js | 6 +- .../cjs/react-dom-server.bun.production.js | 6 +- .../cjs/react-dom-server.edge.development.js | 6 +- .../cjs/react-dom-server.edge.production.js | 6 +- .../cjs/react-dom-server.node.development.js | 6 +- .../cjs/react-dom-server.node.production.js | 6 +- .../react-dom/cjs/react-dom.development.js | 2 +- .../react-dom/cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 2 +- .../cjs/react-dom.react-server.production.js | 2 +- .../next/src/compiled/react-dom/package.json | 4 +- .../cjs/react.development.js | 2 +- .../cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 2 +- .../cjs/react.react-server.production.js | 2 +- .../next/src/compiled/react-is/package.json | 2 +- ...om-turbopack-client.browser.development.js | 29 +- ...dom-turbopack-client.browser.production.js | 1 + ...r-dom-turbopack-client.edge.development.js | 25 +- ...er-dom-turbopack-client.edge.production.js | 1 + ...r-dom-turbopack-client.node.development.js | 25 +- ...er-dom-turbopack-client.node.production.js | 1 + ...om-turbopack-server.browser.development.js | 644 ++++++++---------- ...dom-turbopack-server.browser.production.js | 598 +++++++--------- ...r-dom-turbopack-server.edge.development.js | 644 ++++++++---------- ...er-dom-turbopack-server.edge.production.js | 598 +++++++--------- ...r-dom-turbopack-server.node.development.js | 632 ++++++++--------- ...er-dom-turbopack-server.node.production.js | 588 +++++++--------- .../package.json | 4 +- .../static.browser.js | 4 +- .../static.edge.js | 4 +- .../static.node.js | 4 +- ...om-turbopack-client.browser.development.js | 8 +- ...dom-turbopack-client.browser.production.js | 1 + ...r-dom-turbopack-client.edge.development.js | 4 +- ...er-dom-turbopack-client.edge.production.js | 1 + ...r-dom-turbopack-client.node.development.js | 4 +- ...er-dom-turbopack-client.node.production.js | 1 + ...om-turbopack-server.browser.development.js | 378 +++++----- ...dom-turbopack-server.browser.production.js | 294 ++++---- ...r-dom-turbopack-server.edge.development.js | 378 +++++----- ...er-dom-turbopack-server.edge.production.js | 294 ++++---- ...r-dom-turbopack-server.node.development.js | 365 +++++----- ...er-dom-turbopack-server.node.production.js | 286 ++++---- .../react-server-dom-turbopack/package.json | 4 +- .../static.browser.js | 4 +- .../react-server-dom-turbopack/static.edge.js | 4 +- .../react-server-dom-turbopack/static.node.js | 4 +- ...-dom-webpack-client.browser.development.js | 29 +- ...r-dom-webpack-client.browser.production.js | 1 + ...ver-dom-webpack-client.edge.development.js | 25 +- ...rver-dom-webpack-client.edge.production.js | 1 + ...ver-dom-webpack-client.node.development.js | 25 +- ...rver-dom-webpack-client.node.production.js | 1 + ...bpack-client.node.unbundled.development.js | 25 +- ...ebpack-client.node.unbundled.production.js | 1 + ...-dom-webpack-server.browser.development.js | 644 ++++++++---------- ...r-dom-webpack-server.browser.production.js | 598 +++++++--------- ...ver-dom-webpack-server.edge.development.js | 644 ++++++++---------- ...rver-dom-webpack-server.edge.production.js | 598 +++++++--------- ...ver-dom-webpack-server.node.development.js | 632 ++++++++--------- ...rver-dom-webpack-server.node.production.js | 584 +++++++--------- ...bpack-server.node.unbundled.development.js | 632 ++++++++--------- ...ebpack-server.node.unbundled.production.js | 584 +++++++--------- .../package.json | 4 +- .../static.browser.js | 4 +- .../static.edge.js | 4 +- .../static.node.js | 4 +- .../static.node.unbundled.js | 4 +- ...-dom-webpack-client.browser.development.js | 8 +- ...r-dom-webpack-client.browser.production.js | 1 + ...ver-dom-webpack-client.edge.development.js | 4 +- ...rver-dom-webpack-client.edge.production.js | 1 + ...ver-dom-webpack-client.node.development.js | 4 +- ...rver-dom-webpack-client.node.production.js | 1 + ...bpack-client.node.unbundled.development.js | 4 +- ...ebpack-client.node.unbundled.production.js | 1 + ...-dom-webpack-server.browser.development.js | 378 +++++----- ...r-dom-webpack-server.browser.production.js | 294 ++++---- ...ver-dom-webpack-server.edge.development.js | 378 +++++----- ...rver-dom-webpack-server.edge.production.js | 294 ++++---- ...ver-dom-webpack-server.node.development.js | 365 +++++----- ...rver-dom-webpack-server.node.production.js | 282 ++++---- ...bpack-server.node.unbundled.development.js | 365 +++++----- ...ebpack-server.node.unbundled.production.js | 282 ++++---- .../react-server-dom-webpack/package.json | 4 +- .../static.browser.js | 4 +- .../react-server-dom-webpack/static.edge.js | 4 +- .../react-server-dom-webpack/static.node.js | 4 +- .../static.node.unbundled.js | 4 +- .../compiled/react/cjs/react.development.js | 2 +- .../compiled/react/cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 2 +- .../cjs/react.react-server.production.js | 2 +- .../next/src/compiled/unistore/unistore.js | 2 +- 126 files changed, 6648 insertions(+), 7164 deletions(-) diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js index 643269fdb0259..80722fdf8543f 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 @@ -25291,11 +25291,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25332,11 +25332,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206" + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25478,7 +25477,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; "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 df49790f340c5..3ad7bd0faaa73 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 @@ -15264,14 +15264,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1676 = React.version; if ( - "19.0.0-experimental-7283a213-20241206" !== + "19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion$jscomp$inline_1676 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1676, - "19.0.0-experimental-7283a213-20241206" + "19.0.0-experimental-79ddf5b5-20241210" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15293,11 +15293,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2146 = { bundleType: 0, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206" + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2147 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15401,4 +15400,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 894a13db08621..c4f4d14c1e76a 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 @@ -25348,11 +25348,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25389,11 +25389,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206" + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25865,7 +25864,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; "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 08905f33ea0f8..b8856fa37ba1c 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 @@ -16382,14 +16382,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1783 = React.version; if ( - "19.0.0-experimental-7283a213-20241206" !== + "19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion$jscomp$inline_1783 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1783, - "19.0.0-experimental-7283a213-20241206" + "19.0.0-experimental-79ddf5b5-20241210" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -16411,11 +16411,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2225 = { bundleType: 0, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206" + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2226 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16680,7 +16679,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; "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 e28dc62426401..749236b200e0f 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 @@ -9295,5 +9295,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 d04c19bb94c91..efe11bf749fa0 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 @@ -6060,4 +6060,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 7ab77fa01dd36..0fa2c137577b8 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 @@ -9295,5 +9295,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 9602f1e00b640..60a49af56687d 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 @@ -6152,4 +6152,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 c6525dc86dfb0..3fdcd3e78e6c0 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 @@ -8193,11 +8193,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -9977,5 +9977,5 @@ startWork(request); }); }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 143283ea51d41..b8eb1ad86a779 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 @@ -6589,12 +6589,12 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-experimental-7283a213-20241206" + "19.0.0-experimental-79ddf5b5-20241210" ) ); } @@ -6849,4 +6849,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 b86acb4a9d640..8735210b7d0ed 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 @@ -6071,13 +6071,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_779 = React.version; if ( - "19.0.0-experimental-7283a213-20241206" !== + "19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion$jscomp$inline_779 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_779 + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -6168,4 +6168,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 05c2437eb07b2..8cbfb2d6b05f1 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 @@ -8216,11 +8216,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -10007,5 +10007,5 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 be9b31778bd1a..589c9c2294bcb 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 @@ -6696,11 +6696,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6965,4 +6965,4 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 d865e03b333d8..60c591877b89d 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 @@ -8080,11 +8080,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -9857,5 +9857,5 @@ } }; }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 d5553d98e6cd6..38652ba0689a7 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 @@ -6575,11 +6575,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6830,4 +6830,4 @@ exports.resumeToPipeableStream = function (children, postponedState, options) { } }; }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 f81d32745597b..b6d08cefd3728 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 @@ -25625,11 +25625,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25666,11 +25666,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206" + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25978,5 +25977,5 @@ } }; }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 07659116fca9b..b4d26c62a3e06 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 @@ -15593,14 +15593,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1705 = React.version; if ( - "19.0.0-experimental-7283a213-20241206" !== + "19.0.0-experimental-79ddf5b5-20241210" !== isomorphicReactPackageVersion$jscomp$inline_1705 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1705, - "19.0.0-experimental-7283a213-20241206" + "19.0.0-experimental-79ddf5b5-20241210" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15622,11 +15622,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2180 = { bundleType: 0, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206" + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2181 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15881,4 +15880,4 @@ exports.observeVisibleRects = function ( } }; }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 877f783fc8d2f..0f8b9296ddd03 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.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; "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 414419b985be5..ea6cb3368d32b 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.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 db2dcbe181cbf..7d906f0e66c48 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.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 90928b0b2b1f1..335ad768eb098 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.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; diff --git a/packages/next/src/compiled/react-dom-experimental/package.json b/packages/next/src/compiled/react-dom-experimental/package.json index 02dc9e964d578..3309b4a812290 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-7283a213-20241206" + "scheduler": "0.0.0-experimental-79ddf5b5-20241210" }, "peerDependencies": { - "react": "0.0.0-experimental-7283a213-20241206" + "react": "0.0.0-experimental-79ddf5b5-20241210" }, "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 feb16d93c4b91..fd491c0447d9d 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 @@ -24575,11 +24575,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24616,11 +24616,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-7283a213-20241206", + version: "19.0.0-rc-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-7283a213-20241206" + reconcilerVersion: "19.0.0-rc-79ddf5b5-20241210" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -24764,7 +24763,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; "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 4266a52a46d72..45c048ba39960 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 @@ -15102,14 +15102,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1683 = React.version; if ( - "19.0.0-rc-7283a213-20241206" !== + "19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion$jscomp$inline_1683 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1683, - "19.0.0-rc-7283a213-20241206" + "19.0.0-rc-79ddf5b5-20241210" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15131,11 +15131,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_2159 = { bundleType: 0, - version: "19.0.0-rc-7283a213-20241206", + version: "19.0.0-rc-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-7283a213-20241206" + reconcilerVersion: "19.0.0-rc-79ddf5b5-20241210" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2160 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15239,4 +15238,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 46cb76b533391..582efee6196ad 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 @@ -24632,11 +24632,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24673,11 +24673,10 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-7283a213-20241206", + version: "19.0.0-rc-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-7283a213-20241206" + reconcilerVersion: "19.0.0-rc-79ddf5b5-20241210" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25151,7 +25150,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; "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 079da0fb7e681..cc1636516d467 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 @@ -15752,14 +15752,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { }; var isomorphicReactPackageVersion$jscomp$inline_1774 = React.version; if ( - "19.0.0-rc-7283a213-20241206" !== + "19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion$jscomp$inline_1774 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_1774, - "19.0.0-rc-7283a213-20241206" + "19.0.0-rc-79ddf5b5-20241210" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15781,11 +15781,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { }; var internals$jscomp$inline_1781 = { bundleType: 0, - version: "19.0.0-rc-7283a213-20241206", + version: "19.0.0-rc-79ddf5b5-20241210", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, - findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-7283a213-20241206", + reconcilerVersion: "19.0.0-rc-79ddf5b5-20241210", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$279 = 0; @@ -16065,7 +16064,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; "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 dab6bfa85f046..ab1c32a86134a 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 @@ -8570,5 +8570,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; })(); 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 fcb31bf6e560e..a7cf7a8a6bdea 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 @@ -5623,4 +5623,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 b26e780eed493..5b50d4c090400 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 @@ -8570,5 +8570,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; })(); 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 5879c05f8ab99..248e3a1dfdfd5 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 @@ -5701,4 +5701,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 40411d9df4cbf..5f783b0f6a8f3 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 @@ -7296,11 +7296,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -8952,5 +8952,5 @@ startWork(request); }); }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; })(); 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 a9c138372b34b..5db709fba6628 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 @@ -5956,12 +5956,12 @@ function abort(request, reason) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-rc-7283a213-20241206" + "19.0.0-rc-79ddf5b5-20241210" ) ); } @@ -6108,4 +6108,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 194b665dfe999..ee4f452ca6a7c 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 @@ -5594,13 +5594,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_731 = React.version; if ( - "19.0.0-rc-7283a213-20241206" !== + "19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion$jscomp$inline_731 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_731 + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -5691,4 +5691,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 d8af0e152a14e..f2fdbac19e898 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 @@ -7319,11 +7319,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react"), @@ -8982,5 +8982,5 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; })(); 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 c236e18b1fb97..fd302944396b5 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 @@ -6049,11 +6049,11 @@ function abort(request, reason) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6210,4 +6210,4 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 ce98976fa467d..b629334bc65b8 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 @@ -7194,11 +7194,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -8845,5 +8845,5 @@ } }; }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; })(); 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 afb60159da3fb..cb660a3499b40 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 @@ -5941,11 +5941,11 @@ function abort(request, reason) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-7283a213-20241206" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-79ddf5b5-20241210" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-7283a213-20241206\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-79ddf5b5-20241210\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6094,4 +6094,4 @@ exports.renderToPipeableStream = function (children, options) { } }; }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 2f645e745540d..5f512dd2cf05d 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.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; "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 f0c724e6759ce..9b8505fc3d3c9 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.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 f5daf41bedabf..fb1a20d562c5b 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.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; })(); 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 8ba7ccc149b93..ca43fd0c5c895 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.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; diff --git a/packages/next/src/compiled/react-dom/package.json b/packages/next/src/compiled/react-dom/package.json index ef6d1e3d8c160..857c9a4b65e98 100644 --- a/packages/next/src/compiled/react-dom/package.json +++ b/packages/next/src/compiled/react-dom/package.json @@ -67,10 +67,10 @@ "./package.json": "./package.json" }, "dependencies": { - "scheduler": "0.25.0-rc-7283a213-20241206" + "scheduler": "0.25.0-rc-79ddf5b5-20241210" }, "peerDependencies": { - "react": "19.0.0-rc-7283a213-20241206" + "react": "19.0.0-rc-79ddf5b5-20241210" }, "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 aca82b81c0d27..792deeb17060f 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.development.js @@ -1244,7 +1244,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; "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 35361c7726f9c..7044a16eb1200 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.production.js @@ -567,4 +567,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; 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 8232ce13cc926..6a4170801f9bf 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 @@ -984,5 +984,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-experimental-7283a213-20241206"; + exports.version = "19.0.0-experimental-79ddf5b5-20241210"; })(); 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 8bd6cddec61a9..c1cb185dea6c7 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 @@ -566,4 +566,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-experimental-7283a213-20241206"; +exports.version = "19.0.0-experimental-79ddf5b5-20241210"; diff --git a/packages/next/src/compiled/react-is/package.json b/packages/next/src/compiled/react-is/package.json index 5731832680404..2866cc68992cc 100644 --- a/packages/next/src/compiled/react-is/package.json +++ b/packages/next/src/compiled/react-is/package.json @@ -1,6 +1,6 @@ { "name": "react-is", - "version": "19.0.0-rc-7283a213-20241206", + "version": "19.0.0-rc-79ddf5b5-20241210", "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 608ae49cb389b..d5a8844e80ba3 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 @@ -1530,6 +1530,7 @@ this._rowLength = this._rowTag = this._rowID = this._rowState = 0; this._buffer = []; this._tempRefs = temporaryReferences; + this._timeOrigin = 0; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2023,15 +2024,20 @@ initializeFakeStack(response, debugInfo.owner)); } function resolveDebugInfo(response, id, debugInfo) { - initializeFakeTask( - response, - debugInfo, - void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env - ); + var env = + void 0 === debugInfo.env + ? response._rootEnvironmentName + : debugInfo.env; + void 0 !== debugInfo.stack && + initializeFakeTask(response, debugInfo, env); null === debugInfo.owner && null != response._debugRootOwner - ? ((debugInfo.owner = response._debugRootOwner), - (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + ? ((env = debugInfo), + (env.owner = response._debugRootOwner), + (env.debugStack = response._debugRootStack)) + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); + "number" === typeof debugInfo.time && + (debugInfo = { time: debugInfo.time + response._timeOrigin }); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2219,6 +2225,9 @@ case 84: resolveText(response, id, row); break; + case 78: + response._timeOrigin = +row - performance.timeOrigin; + break; case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); @@ -2654,10 +2663,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206", + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 2c8abea2bc14d..cfbbd84685322 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 @@ -1396,6 +1396,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 60cb6037c0808..6e4abd5ef7619 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 @@ -1744,6 +1744,7 @@ this._rowLength = this._rowTag = this._rowID = this._rowState = 0; this._buffer = []; this._tempRefs = temporaryReferences; + this._timeOrigin = 0; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2242,15 +2243,20 @@ initializeFakeStack(response, debugInfo.owner)); } function resolveDebugInfo(response, id, debugInfo) { - initializeFakeTask( - response, - debugInfo, - void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env - ); + var env = + void 0 === debugInfo.env + ? response._rootEnvironmentName + : debugInfo.env; + void 0 !== debugInfo.stack && + initializeFakeTask(response, debugInfo, env); null === debugInfo.owner && null != response._debugRootOwner - ? ((debugInfo.owner = response._debugRootOwner), - (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + ? ((env = debugInfo), + (env.owner = response._debugRootOwner), + (env.debugStack = response._debugRootStack)) + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); + "number" === typeof debugInfo.time && + (debugInfo = { time: debugInfo.time + response._timeOrigin }); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2438,6 +2444,9 @@ case 84: resolveText(response, id, row); break; + case 78: + response._timeOrigin = +row - performance.timeOrigin; + break; case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 f3305084b2b62..c904363dcd9a6 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 @@ -1568,6 +1568,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 d21327491a6c9..77fad2e16dbc8 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 @@ -1744,6 +1744,7 @@ this._rowLength = this._rowTag = this._rowID = this._rowState = 0; this._buffer = []; this._tempRefs = temporaryReferences; + this._timeOrigin = 0; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2242,15 +2243,20 @@ initializeFakeStack(response, debugInfo.owner)); } function resolveDebugInfo(response, id, debugInfo) { - initializeFakeTask( - response, - debugInfo, - void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env - ); + var env = + void 0 === debugInfo.env + ? response._rootEnvironmentName + : debugInfo.env; + void 0 !== debugInfo.stack && + initializeFakeTask(response, debugInfo, env); null === debugInfo.owner && null != response._debugRootOwner - ? ((debugInfo.owner = response._debugRootOwner), - (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + ? ((env = debugInfo), + (env.owner = response._debugRootOwner), + (env.debugStack = response._debugRootStack)) + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); + "number" === typeof debugInfo.time && + (debugInfo = { time: debugInfo.time + response._timeOrigin }); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2438,6 +2444,9 @@ case 84: resolveText(response, id, row); break; + case 78: + response._timeOrigin = +row - performance.timeOrigin; + break; case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 9937c062e699b..f1dd22594a74f 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 @@ -1569,6 +1569,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: 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 97549ed3df36e..35fedef13543c 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 @@ -293,14 +293,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -711,8 +703,10 @@ ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; - type = createTask(this, model, null, !1, abortSet, null, null, null); - pingedTasks.push(type); + type = this.timeOrigin = performance.now(); + emitTimeOriginChunk(this, type + performance.timeOrigin); + model = createTask(this, model, null, !1, abortSet, null, null, null); + pingedTasks.push(model); } function noop() {} function serializeThenable(request, task, thenable) { @@ -736,21 +730,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - if ( - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id, task); - else { - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -782,24 +762,11 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id, reason); - else { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); + newTask.timed = !0; return newTask.id; } function serializeReadableStream(request, task, stream) { @@ -823,38 +790,21 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -918,40 +868,23 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -1034,6 +967,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent( request, task, @@ -1066,12 +1064,16 @@ componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; outlineComponentInfo(request, componentDebugInfo); + task.timed = !0; + emitTimingChunk(request, componentDebugID, performance.now()); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && warnForMissingKey(request, key, componentDebugInfo, task.debugTask); } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = task.debugTask ? task.debugTask.run( callComponentInDEV.bind(null, Component, props, componentDebugInfo) @@ -1086,74 +1088,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - validated = props; - validated.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === validated.status) return validated.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - validated = task.keyPath; - prevThenableState = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + validated = task.implicitSlot; null !== key - ? (task.keyPath = null === validated ? key : validated + "," + key) - : null === validated && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = validated; - task.implicitSlot = prevThenableState; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = validated; + return request; } function warnForMissingKey(request, key, componentDebugInfo, debugTask) { function logKeyError() { @@ -1350,6 +1299,7 @@ return task; } function pingTask(request, task) { + task.timed = !0; var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && @@ -1414,7 +1364,8 @@ }); return renderModel(request, task, parent, parentPropertyName, value); }, - thenableState: null + thenableState: null, + timed: !1 }; task.environmentName = request.environmentName(); task.debugOwner = debugOwner; @@ -1588,38 +1539,21 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -1667,45 +1601,42 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks, - task.debugOwner, - task.debugStack, - task.debugTask - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent - ? serializeLazyID(request.id) - : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value, key), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } + if ( + "object" === typeof key && + null !== key && + "function" === typeof key.then + ) + return ( + (request = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks, + task.debugOwner, + task.debugStack, + task.debugTask + )), + (value = request.ping), + key.then(value, value), + (request.thenableState = getThenableStateAfterSuspending()), + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + parent + ? serializeLazyID(request.id) + : serializeByValueID(request.id) + ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; request.pendingChunks++; prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task, key); + "object" === typeof key && + null !== key && + key.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, key.message, task), + emitPostponeChunk(request, prevKeyPath, key)) + : ((task = logRecoverableError(request, key, task)), + emitErrorChunk(request, prevKeyPath, task, key)); return parent ? serializeLazyID(prevKeyPath) : serializeByValueID(prevKeyPath); @@ -2473,12 +2404,26 @@ methodName = stringToChunk(":W" + json + "\n"); request.completedRegularChunks.push(methodName); } + function emitTimeOriginChunk(request, timeOrigin) { + request.pendingChunks++; + timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); + request.completedRegularChunks.push(timeOrigin); + } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" === typeof debugInfo[i].time + ? emitTimingChunk(request, id, debugInfo[i].time) + : ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); + } + function emitTimingChunk(request, id, timestamp) { + request.pendingChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedRegularChunks.push(id); } function emitChunk(request, task, value) { var id = task.id; @@ -2515,6 +2460,22 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + task.timed && emitTimingChunk(request, task.id, performance.now()); + request.abortableTasks.delete(task); + task.status = ERRORED$1; + if ( + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ) + logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id, error); + else { + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2533,22 +2494,19 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + task.timed && emitTimingChunk(request, task.id, performance.now()); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2570,26 +2528,16 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = PENDING$1; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id, x); - return; - } - } - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = PENDING$1; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2633,6 +2581,7 @@ function abortTask(task, request, errorId) { task.status !== RENDERING && ((task.status = ABORTED), + task.timed && emitTimingChunk(request, task.id, performance.now()), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); @@ -2739,29 +2688,25 @@ 11 >= request.status && (request.status = ABORTING); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (request.type === PRERENDER) + abortableTasks.forEach(function (task) { + task.status !== RENDERING && + ((task.status = ABORTED), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ( - (logPostpone(request, reason.message, null), - request.type === PRERENDER) - ) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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( @@ -2774,21 +2719,14 @@ "The render was aborted by the server with a promise." ) : reason, - digest = logRecoverableError(request, error, null); - if (request.type === PRERENDER) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - } + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -4086,53 +4024,6 @@ close(body); return turbopackMap; }; - exports.prerender = function (model, turbopackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - PRERENDER, - model, - turbopackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - options ? options.environmentName : void 0, - options ? options.filterStackFrame : void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); - }; exports.registerClientReference = function ( proxyImplementation, id, @@ -4198,4 +4089,51 @@ { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 350a8b86827f7..82adf870205ad 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 @@ -801,19 +801,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = thenable.reason), - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((task = logRecoverableError(request, task, null)), - emitErrorChunk(request, newTask.id, task)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -846,16 +834,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ("object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -876,43 +855,26 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -967,45 +929,28 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$10) { - error(x$10); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1058,63 +1003,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$11 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$11[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1210,7 +1149,79 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { return pingTask(request, task); }, toJSON: function (parentPropertyName, value) { - return renderModel(request, task, this, parentPropertyName, value); + var prevKeyPath = task.keyPath, + prevImplicitSlot = task.implicitSlot; + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = task.model), + (parentPropertyName = + "object" === typeof parentPropertyName && + null !== parentPropertyName && + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE || + parentPropertyName.$$typeof === REACT_LAZY_TYPE)), + 12 === request.status) + ) + (task.status = 3), + 21 === request.type + ? ((prevKeyPath = request.nextChunkId++), + (prevKeyPath = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)), + (JSCompiler_inline_result = prevKeyPath)) + : ((prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); + else if ( + ((value = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + "object" === typeof value && + null !== value && + "function" === typeof value.then) + ) { + JSCompiler_inline_result = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + value.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + task.keyPath = prevKeyPath; + task.implicitSlot = prevImplicitSlot; + JSCompiler_inline_result = parentPropertyName + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + "object" === typeof value && + null !== value && + value.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, value.message, task), + emitPostponeChunk(request, prevKeyPath)) + : ((prevImplicitSlot = logRecoverableError(request, value, task)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot)), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)); + } + return JSCompiler_inline_result; }, thenableState: null }; @@ -1220,9 +1231,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeLazyID(id) { - return "$L" + id.toString(16); -} function encodeReferenceChunk(request, id, reference) { request = stringify(reference); id = id.toString(16) + ":" + request + "\n"; @@ -1241,7 +1249,7 @@ function serializeClientReference( existingId = writtenClientReferences.get(clientReferenceKey); if (void 0 !== existingId) return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(existingId) + ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { var config = request.bundlerConfig, @@ -1279,7 +1287,7 @@ function serializeClientReference( request.completedImportChunks.push(processedChunk); writtenClientReferences.set(clientReferenceKey, importId); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(importId) + ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( @@ -1315,37 +1323,21 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id), enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1356,70 +1348,6 @@ function serializeBlob(request, blob) { return "$B" + newTask.id.toString(16); } var modelRoot = !1; -function renderModel(request, task, parent, key, value) { - var prevKeyPath = task.keyPath, - prevImplicitSlot = task.implicitSlot; - try { - return renderModelDestructive(request, task, parent, key, value); - } catch (thrownValue) { - parent = task.model; - parent = - "object" === typeof parent && - null !== parent && - (parent.$$typeof === REACT_ELEMENT_TYPE || - parent.$$typeof === REACT_LAZY_TYPE); - if (12 === request.status) { - task.status = 3; - if (21 === request.type) - return ( - (task = request.nextChunkId++), - (task = parent ? serializeLazyID(task) : serializeByValueID(task)), - task - ); - task = request.fatalError; - return parent ? serializeLazyID(task) : serializeByValueID(task); - } - key = - thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(request.id) : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } - task.keyPath = prevKeyPath; - task.implicitSlot = prevImplicitSlot; - request.pendingChunks++; - prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task); - return parent - ? serializeLazyID(prevKeyPath) - : serializeByValueID(prevKeyPath); - } -} function renderModelDestructive( request, task, @@ -1853,6 +1781,17 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id)) + : ((error = logRecoverableError(request, error, task)), + emitErrorChunk(request, task.id, error)); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1895,26 +1834,16 @@ function retryTask(request, task) { thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = 0; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = 4; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id); - return; - } - } - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = 0; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { } @@ -2030,25 +1959,24 @@ function abort(request, reason) { 11 >= request.status && (request.status = 12); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (21 === request.type) + abortableTasks.forEach(function (task) { + 5 !== task.status && ((task.status = 3), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ((logPostpone(request, reason.message, null), 21 === request.type)) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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.") @@ -2057,20 +1985,14 @@ function abort(request, reason) { "function" === typeof reason.then ? Error("The render was aborted by the server with a promise.") : reason, - digest = logRecoverableError(request, error, null); - if (21 === request.type) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } + digest = logRecoverableError(request, error, null), + errorId$25 = request.nextChunkId++; + request.fatalError = errorId$25; + request.pendingChunks++; + emitErrorChunk(request, errorId$25, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$25); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -2078,7 +2000,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$28 = + var error$26 = "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE @@ -2091,14 +2013,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$28); + return callback(error$26); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$29) { - logRecoverableError(request, error$29, null), fatalError(request, error$29); + } catch (error$27) { + logRecoverableError(request, error$27, null), fatalError(request, error$27); } } function resolveServerReference(bundlerConfig, id) { @@ -2540,8 +2462,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$32 = createPendingChunk(response); - chunk$32.then( + var chunk$30 = createPendingChunk(response); + chunk$30.then( function (v) { return controller.enqueue(v); }, @@ -2549,10 +2471,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$32; + previousBlockedChunk = chunk$30; chunk.then(function () { - previousBlockedChunk === chunk$32 && (previousBlockedChunk = null); - resolveModelChunk(chunk$32, json, -1); + previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); + resolveModelChunk(chunk$30, json, -1); }); } }, @@ -2870,53 +2792,6 @@ exports.decodeReply = function (body, turbopackMap, options) { close(body); return turbopackMap; }; -exports.prerender = function (model, turbopackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - 21, - model, - turbopackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - void 0, - void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); -}; exports.registerClientReference = function ( proxyImplementation, id, @@ -2981,3 +2856,50 @@ exports.renderToReadableStream = function (model, turbopackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 d303ba5d34a39..7bf019057d0e2 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 @@ -295,14 +295,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -718,8 +710,10 @@ ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; - type = createTask(this, model, null, !1, abortSet, null, null, null); - pingedTasks.push(type); + type = this.timeOrigin = performance.now(); + emitTimeOriginChunk(this, type + performance.timeOrigin); + model = createTask(this, model, null, !1, abortSet, null, null, null); + pingedTasks.push(model); } function noop() {} function resolveRequest() { @@ -751,21 +745,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - if ( - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id, task); - else { - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -797,24 +777,11 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id, reason); - else { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); + newTask.timed = !0; return newTask.id; } function serializeReadableStream(request, task, stream) { @@ -838,38 +805,21 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -933,40 +883,23 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -1049,6 +982,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent( request, task, @@ -1081,12 +1079,16 @@ componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; outlineComponentInfo(request, componentDebugInfo); + task.timed = !0; + emitTimingChunk(request, componentDebugID, performance.now()); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && warnForMissingKey(request, key, componentDebugInfo, task.debugTask); } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = supportsComponentStorage ? task.debugTask ? task.debugTask.run( @@ -1125,74 +1127,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - validated = props; - validated.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === validated.status) return validated.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - validated = task.keyPath; - prevThenableState = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + validated = task.implicitSlot; null !== key - ? (task.keyPath = null === validated ? key : validated + "," + key) - : null === validated && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = validated; - task.implicitSlot = prevThenableState; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = validated; + return request; } function warnForMissingKey(request, key, componentDebugInfo, debugTask) { function logKeyError() { @@ -1413,6 +1362,7 @@ return task; } function pingTask(request, task) { + task.timed = !0; var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && @@ -1477,7 +1427,8 @@ }); return renderModel(request, task, parent, parentPropertyName, value); }, - thenableState: null + thenableState: null, + timed: !1 }; task.environmentName = request.environmentName(); task.debugOwner = debugOwner; @@ -1651,38 +1602,21 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -1730,45 +1664,42 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks, - task.debugOwner, - task.debugStack, - task.debugTask - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent - ? serializeLazyID(request.id) - : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value, key), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } + if ( + "object" === typeof key && + null !== key && + "function" === typeof key.then + ) + return ( + (request = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks, + task.debugOwner, + task.debugStack, + task.debugTask + )), + (value = request.ping), + key.then(value, value), + (request.thenableState = getThenableStateAfterSuspending()), + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + parent + ? serializeLazyID(request.id) + : serializeByValueID(request.id) + ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; request.pendingChunks++; prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task, key); + "object" === typeof key && + null !== key && + key.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, key.message, task), + emitPostponeChunk(request, prevKeyPath, key)) + : ((task = logRecoverableError(request, key, task)), + emitErrorChunk(request, prevKeyPath, task, key)); return parent ? serializeLazyID(prevKeyPath) : serializeByValueID(prevKeyPath); @@ -2558,12 +2489,26 @@ methodName = stringToChunk(":W" + json + "\n"); request.completedRegularChunks.push(methodName); } + function emitTimeOriginChunk(request, timeOrigin) { + request.pendingChunks++; + timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); + request.completedRegularChunks.push(timeOrigin); + } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" === typeof debugInfo[i].time + ? emitTimingChunk(request, id, debugInfo[i].time) + : ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); + } + function emitTimingChunk(request, id, timestamp) { + request.pendingChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedRegularChunks.push(id); } function emitChunk(request, task, value) { var id = task.id; @@ -2600,6 +2545,22 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + task.timed && emitTimingChunk(request, task.id, performance.now()); + request.abortableTasks.delete(task); + task.status = ERRORED$1; + if ( + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ) + logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id, error); + else { + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2618,22 +2579,19 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + task.timed && emitTimingChunk(request, task.id, performance.now()); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2655,26 +2613,16 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = PENDING$1; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id, x); - return; - } - } - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = PENDING$1; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2718,6 +2666,7 @@ function abortTask(task, request, errorId) { task.status !== RENDERING && ((task.status = ABORTED), + task.timed && emitTimingChunk(request, task.id, performance.now()), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); @@ -2828,29 +2777,25 @@ 11 >= request.status && (request.status = ABORTING); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (request.type === PRERENDER) + abortableTasks.forEach(function (task) { + task.status !== RENDERING && + ((task.status = ABORTED), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ( - (logPostpone(request, reason.message, null), - request.type === PRERENDER) - ) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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( @@ -2863,21 +2808,14 @@ "The render was aborted by the server with a promise." ) : reason, - digest = logRecoverableError(request, error, null); - if (request.type === PRERENDER) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - } + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -4190,53 +4128,6 @@ close(body); return turbopackMap; }; - exports.prerender = function (model, turbopackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - PRERENDER, - model, - turbopackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - options ? options.environmentName : void 0, - options ? options.filterStackFrame : void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); - }; exports.registerClientReference = function ( proxyImplementation, id, @@ -4313,4 +4204,51 @@ const setTimeoutOrImmediate = { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 2b5ae9f7f5a81..2e22257e2c079 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 @@ -806,19 +806,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = thenable.reason), - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((task = logRecoverableError(request, task, null)), - emitErrorChunk(request, newTask.id, task)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -851,16 +839,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ("object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -881,43 +860,26 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -972,45 +934,28 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$10) { - error(x$10); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1063,63 +1008,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$11 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$11[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1215,7 +1154,79 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { return pingTask(request, task); }, toJSON: function (parentPropertyName, value) { - return renderModel(request, task, this, parentPropertyName, value); + var prevKeyPath = task.keyPath, + prevImplicitSlot = task.implicitSlot; + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = task.model), + (parentPropertyName = + "object" === typeof parentPropertyName && + null !== parentPropertyName && + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE || + parentPropertyName.$$typeof === REACT_LAZY_TYPE)), + 12 === request.status) + ) + (task.status = 3), + 21 === request.type + ? ((prevKeyPath = request.nextChunkId++), + (prevKeyPath = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)), + (JSCompiler_inline_result = prevKeyPath)) + : ((prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); + else if ( + ((value = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + "object" === typeof value && + null !== value && + "function" === typeof value.then) + ) { + JSCompiler_inline_result = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + value.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + task.keyPath = prevKeyPath; + task.implicitSlot = prevImplicitSlot; + JSCompiler_inline_result = parentPropertyName + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + "object" === typeof value && + null !== value && + value.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, value.message, task), + emitPostponeChunk(request, prevKeyPath)) + : ((prevImplicitSlot = logRecoverableError(request, value, task)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot)), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)); + } + return JSCompiler_inline_result; }, thenableState: null }; @@ -1225,9 +1236,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeLazyID(id) { - return "$L" + id.toString(16); -} function encodeReferenceChunk(request, id, reference) { request = stringify(reference); id = id.toString(16) + ":" + request + "\n"; @@ -1246,7 +1254,7 @@ function serializeClientReference( existingId = writtenClientReferences.get(clientReferenceKey); if (void 0 !== existingId) return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(existingId) + ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { var config = request.bundlerConfig, @@ -1284,7 +1292,7 @@ function serializeClientReference( request.completedImportChunks.push(processedChunk); writtenClientReferences.set(clientReferenceKey, importId); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(importId) + ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( @@ -1320,37 +1328,21 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id), enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1361,70 +1353,6 @@ function serializeBlob(request, blob) { return "$B" + newTask.id.toString(16); } var modelRoot = !1; -function renderModel(request, task, parent, key, value) { - var prevKeyPath = task.keyPath, - prevImplicitSlot = task.implicitSlot; - try { - return renderModelDestructive(request, task, parent, key, value); - } catch (thrownValue) { - parent = task.model; - parent = - "object" === typeof parent && - null !== parent && - (parent.$$typeof === REACT_ELEMENT_TYPE || - parent.$$typeof === REACT_LAZY_TYPE); - if (12 === request.status) { - task.status = 3; - if (21 === request.type) - return ( - (task = request.nextChunkId++), - (task = parent ? serializeLazyID(task) : serializeByValueID(task)), - task - ); - task = request.fatalError; - return parent ? serializeLazyID(task) : serializeByValueID(task); - } - key = - thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(request.id) : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } - task.keyPath = prevKeyPath; - task.implicitSlot = prevImplicitSlot; - request.pendingChunks++; - prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task); - return parent - ? serializeLazyID(prevKeyPath) - : serializeByValueID(prevKeyPath); - } -} function renderModelDestructive( request, task, @@ -1862,6 +1790,17 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id)) + : ((error = logRecoverableError(request, error, task)), + emitErrorChunk(request, task.id, error)); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1904,26 +1843,16 @@ function retryTask(request, task) { thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = 0; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = 4; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id); - return; - } - } - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = 0; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { } @@ -2043,25 +1972,24 @@ function abort(request, reason) { 11 >= request.status && (request.status = 12); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (21 === request.type) + abortableTasks.forEach(function (task) { + 5 !== task.status && ((task.status = 3), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ((logPostpone(request, reason.message, null), 21 === request.type)) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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.") @@ -2070,20 +1998,14 @@ function abort(request, reason) { "function" === typeof reason.then ? Error("The render was aborted by the server with a promise.") : reason, - digest = logRecoverableError(request, error, null); - if (21 === request.type) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } + digest = logRecoverableError(request, error, null), + errorId$25 = request.nextChunkId++; + request.fatalError = errorId$25; + request.pendingChunks++; + emitErrorChunk(request, errorId$25, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$25); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -2091,7 +2013,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$28 = + var error$26 = "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE @@ -2104,14 +2026,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$28); + return callback(error$26); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$29) { - logRecoverableError(request, error$29, null), fatalError(request, error$29); + } catch (error$27) { + logRecoverableError(request, error$27, null), fatalError(request, error$27); } } function resolveServerReference(bundlerConfig, id) { @@ -2553,8 +2475,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$32 = createPendingChunk(response); - chunk$32.then( + var chunk$30 = createPendingChunk(response); + chunk$30.then( function (v) { return controller.enqueue(v); }, @@ -2562,10 +2484,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$32; + previousBlockedChunk = chunk$30; chunk.then(function () { - previousBlockedChunk === chunk$32 && (previousBlockedChunk = null); - resolveModelChunk(chunk$32, json, -1); + previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); + resolveModelChunk(chunk$30, json, -1); }); } }, @@ -2883,53 +2805,6 @@ exports.decodeReply = function (body, turbopackMap, options) { close(body); return turbopackMap; }; -exports.prerender = function (model, turbopackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - 21, - model, - turbopackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - void 0, - void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); -}; exports.registerClientReference = function ( proxyImplementation, id, @@ -3005,3 +2880,50 @@ exports.renderToReadableStream = function (model, turbopackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 24fd5530b6255..2b7af8668990d 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 @@ -322,14 +322,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -742,8 +734,10 @@ ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; - type = createTask(this, model, null, !1, abortSet, null, null, null); - pingedTasks.push(type); + type = this.timeOrigin = performance.now(); + emitTimeOriginChunk(this, type + performance.timeOrigin); + model = createTask(this, model, null, !1, abortSet, null, null, null); + pingedTasks.push(model); } function noop() {} function resolveRequest() { @@ -772,21 +766,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - if ( - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id, task); - else { - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -818,24 +798,11 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id, reason); - else { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); + newTask.timed = !0; return newTask.id; } function serializeReadableStream(request, task, stream) { @@ -859,38 +826,21 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -954,40 +904,23 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -1069,6 +1002,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent( request, task, @@ -1101,12 +1099,16 @@ componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; outlineComponentInfo(request, componentDebugInfo); + task.timed = !0; + emitTimingChunk(request, componentDebugID, performance.now()); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && warnForMissingKey(request, key, componentDebugInfo, task.debugTask); } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = task.debugTask ? task.debugTask.run( componentStorage.run.bind( @@ -1134,74 +1136,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - validated = props; - validated.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === validated.status) return validated.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - validated = task.keyPath; - prevThenableState = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + validated = task.implicitSlot; null !== key - ? (task.keyPath = null === validated ? key : validated + "," + key) - : null === validated && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = validated; - task.implicitSlot = prevThenableState; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = validated; + return request; } function warnForMissingKey(request, key, componentDebugInfo, debugTask) { function logKeyError() { @@ -1411,6 +1360,7 @@ return task; } function pingTask(request, task) { + task.timed = !0; var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && @@ -1475,7 +1425,8 @@ }); return renderModel(request, task, parent, parentPropertyName, value); }, - thenableState: null + thenableState: null, + timed: !1 }; task.environmentName = request.environmentName(); task.debugOwner = debugOwner; @@ -1647,38 +1598,21 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -1726,45 +1660,42 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks, - task.debugOwner, - task.debugStack, - task.debugTask - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent - ? serializeLazyID(request.id) - : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value, key), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } + if ( + "object" === typeof key && + null !== key && + "function" === typeof key.then + ) + return ( + (request = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks, + task.debugOwner, + task.debugStack, + task.debugTask + )), + (value = request.ping), + key.then(value, value), + (request.thenableState = getThenableStateAfterSuspending()), + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + parent + ? serializeLazyID(request.id) + : serializeByValueID(request.id) + ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; request.pendingChunks++; prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task, key); + "object" === typeof key && + null !== key && + key.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, key.message, task), + emitPostponeChunk(request, prevKeyPath, key)) + : ((task = logRecoverableError(request, key, task)), + emitErrorChunk(request, prevKeyPath, task, key)); return parent ? serializeLazyID(prevKeyPath) : serializeByValueID(prevKeyPath); @@ -2535,12 +2466,24 @@ } request.completedRegularChunks.push(":W" + json + "\n"); } + function emitTimeOriginChunk(request, timeOrigin) { + request.pendingChunks++; + request.completedRegularChunks.push(":N" + timeOrigin + "\n"); + } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" === typeof debugInfo[i].time + ? emitTimingChunk(request, id, debugInfo[i].time) + : ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); + } + function emitTimingChunk(request, id, timestamp) { + request.pendingChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + request.completedRegularChunks.push(id); } function emitChunk(request, task, value) { var id = task.id; @@ -2577,6 +2520,22 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + task.timed && emitTimingChunk(request, task.id, performance.now()); + request.abortableTasks.delete(task); + task.status = ERRORED$1; + if ( + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ) + logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id, error); + else { + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2595,22 +2554,19 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + task.timed && emitTimingChunk(request, task.id, performance.now()); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2632,26 +2588,16 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = PENDING$1; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id, x); - return; - } - } - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = PENDING$1; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2695,6 +2641,7 @@ function abortTask(task, request, errorId) { task.status !== RENDERING && ((task.status = ABORTED), + task.timed && emitTimingChunk(request, task.id, performance.now()), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); @@ -2801,29 +2748,25 @@ 11 >= request.status && (request.status = ABORTING); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (request.type === PRERENDER) + abortableTasks.forEach(function (task) { + task.status !== RENDERING && + ((task.status = ABORTED), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ( - (logPostpone(request, reason.message, null), - request.type === PRERENDER) - ) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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( @@ -2836,21 +2779,14 @@ "The render was aborted by the server with a promise." ) : reason, - digest = logRecoverableError(request, error, null); - if (request.type === PRERENDER) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - } + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -4207,12 +4143,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_146 = []; + var JSCompiler_object_inline_chunks_153 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_146.push(chunk); + JSCompiler_object_inline_chunks_153.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_146, { + var blob = new Blob(JSCompiler_object_inline_chunks_153, { type: mimeType }); response._formData.append(name, blob, filename); @@ -4236,43 +4172,6 @@ }); return getChunk(response, 0); }; - exports.prerenderToNodeStream = function (model, turbopackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - PRERENDER, - model, - turbopackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - options ? options.environmentName : void 0, - options ? options.filterStackFrame : void 0, - function () { - var readable = new stream.Readable({ - read: function () { - startFlowing(request, writable); - } - }), - writable = createFakeWritable(readable); - resolve({ prelude: readable }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); - }; exports.registerClientReference = function ( proxyImplementation, id, @@ -4339,4 +4238,45 @@ } }; }; + exports.unstable_prerenderToNodeStream = function ( + model, + turbopackMap, + options + ) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); + }; })(); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js index a61a031085a95..10519b001946f 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 @@ -823,19 +823,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = thenable.reason), - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((task = logRecoverableError(request, task, null)), - emitErrorChunk(request, newTask.id, task)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -868,16 +856,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ("object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -898,43 +877,26 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -989,45 +951,28 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$10) { - error(x$10); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1079,63 +1024,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$11 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$11[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1231,7 +1170,79 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { return pingTask(request, task); }, toJSON: function (parentPropertyName, value) { - return renderModel(request, task, this, parentPropertyName, value); + var prevKeyPath = task.keyPath, + prevImplicitSlot = task.implicitSlot; + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = task.model), + (parentPropertyName = + "object" === typeof parentPropertyName && + null !== parentPropertyName && + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE || + parentPropertyName.$$typeof === REACT_LAZY_TYPE)), + 12 === request.status) + ) + (task.status = 3), + 21 === request.type + ? ((prevKeyPath = request.nextChunkId++), + (prevKeyPath = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)), + (JSCompiler_inline_result = prevKeyPath)) + : ((prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); + else if ( + ((value = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + "object" === typeof value && + null !== value && + "function" === typeof value.then) + ) { + JSCompiler_inline_result = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + value.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + task.keyPath = prevKeyPath; + task.implicitSlot = prevImplicitSlot; + JSCompiler_inline_result = parentPropertyName + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + "object" === typeof value && + null !== value && + value.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, value.message, task), + emitPostponeChunk(request, prevKeyPath)) + : ((prevImplicitSlot = logRecoverableError(request, value, task)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot)), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)); + } + return JSCompiler_inline_result; }, thenableState: null }; @@ -1241,9 +1252,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeLazyID(id) { - return "$L" + id.toString(16); -} function encodeReferenceChunk(request, id, reference) { request = stringify(reference); return id.toString(16) + ":" + request + "\n"; @@ -1261,7 +1269,7 @@ function serializeClientReference( existingId = writtenClientReferences.get(clientReferenceKey); if (void 0 !== existingId) return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(existingId) + ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { var config = request.bundlerConfig, @@ -1298,7 +1306,7 @@ function serializeClientReference( request.completedImportChunks.push(processedChunk); writtenClientReferences.set(clientReferenceKey, importId); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(importId) + ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( @@ -1334,37 +1342,21 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id), enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1375,70 +1367,6 @@ function serializeBlob(request, blob) { return "$B" + newTask.id.toString(16); } var modelRoot = !1; -function renderModel(request, task, parent, key, value) { - var prevKeyPath = task.keyPath, - prevImplicitSlot = task.implicitSlot; - try { - return renderModelDestructive(request, task, parent, key, value); - } catch (thrownValue) { - parent = task.model; - parent = - "object" === typeof parent && - null !== parent && - (parent.$$typeof === REACT_ELEMENT_TYPE || - parent.$$typeof === REACT_LAZY_TYPE); - if (12 === request.status) { - task.status = 3; - if (21 === request.type) - return ( - (task = request.nextChunkId++), - (task = parent ? serializeLazyID(task) : serializeByValueID(task)), - task - ); - task = request.fatalError; - return parent ? serializeLazyID(task) : serializeByValueID(task); - } - key = - thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(request.id) : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } - task.keyPath = prevKeyPath; - task.implicitSlot = prevImplicitSlot; - request.pendingChunks++; - prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task); - return parent - ? serializeLazyID(prevKeyPath) - : serializeByValueID(prevKeyPath); - } -} function renderModelDestructive( request, task, @@ -1863,6 +1791,17 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id)) + : ((error = logRecoverableError(request, error, task)), + emitErrorChunk(request, task.id, error)); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1905,26 +1844,16 @@ function retryTask(request, task) { thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = 0; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = 4; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id); - return; - } - } - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = 0; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { } @@ -2064,25 +1993,24 @@ function abort(request, reason) { 11 >= request.status && (request.status = 12); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (21 === request.type) + abortableTasks.forEach(function (task) { + 5 !== task.status && ((task.status = 3), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ((logPostpone(request, reason.message, null), 21 === request.type)) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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.") @@ -2091,20 +2019,14 @@ function abort(request, reason) { "function" === typeof reason.then ? Error("The render was aborted by the server with a promise.") : reason, - digest = logRecoverableError(request, error, null); - if (21 === request.type) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } + digest = logRecoverableError(request, error, null), + errorId$25 = request.nextChunkId++; + request.fatalError = errorId$25; + request.pendingChunks++; + emitErrorChunk(request, errorId$25, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$25); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -2112,7 +2034,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$28 = + var error$26 = "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE @@ -2125,14 +2047,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$28); + return callback(error$26); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$29) { - logRecoverableError(request, error$29, null), fatalError(request, error$29); + } catch (error$27) { + logRecoverableError(request, error$27, null), fatalError(request, error$27); } } function resolveServerReference(bundlerConfig, id) { @@ -2574,8 +2496,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$32 = createPendingChunk(response); - chunk$32.then( + var chunk$30 = createPendingChunk(response); + chunk$30.then( function (v) { return controller.enqueue(v); }, @@ -2583,10 +2505,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$32; + previousBlockedChunk = chunk$30; chunk.then(function () { - previousBlockedChunk === chunk$32 && (previousBlockedChunk = null); - resolveModelChunk(chunk$32, json, -1); + previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); + resolveModelChunk(chunk$30, json, -1); }); } }, @@ -2957,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_232 = []; + var JSCompiler_object_inline_chunks_234 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_232.push(chunk); + JSCompiler_object_inline_chunks_234.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_232, { + var blob = new Blob(JSCompiler_object_inline_chunks_234, { type: mimeType }); response._formData.append(name, blob, filename); @@ -2982,43 +2904,6 @@ exports.decodeReplyFromBusboy = function (busboyStream, turbopackMap, options) { }); return getChunk(response, 0); }; -exports.prerenderToNodeStream = function (model, turbopackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - 21, - model, - turbopackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - void 0, - void 0, - function () { - var readable = new stream.Readable({ - read: function () { - startFlowing(request, writable); - } - }), - writable = createFakeWritable(readable); - resolve({ prelude: readable }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); -}; exports.registerClientReference = function ( proxyImplementation, id, @@ -3084,3 +2969,44 @@ exports.renderToPipeableStream = function (model, turbopackMap, options) { } }; }; +exports.unstable_prerenderToNodeStream = function ( + model, + turbopackMap, + options +) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 b0931a14962c0..e31f1e8d7fbb3 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-7283a213-20241206", - "react-dom": "0.0.0-experimental-7283a213-20241206" + "react": "0.0.0-experimental-79ddf5b5-20241210", + "react-dom": "0.0.0-experimental-79ddf5b5-20241210" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.browser.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.browser.js index edc104a459383..d04d771c2d3b6 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.browser.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.browser.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-turbopack-server.browser.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.edge.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.edge.js index c074f8ffe7ee4..6d9ca4b3e8b84 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.edge.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.edge.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-turbopack-server.edge.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.node.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.node.js index 84083a965189b..544a15530d24f 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.node.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/static.node.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-turbopack-server.node.development.js'); } -if (s.prerenderToNodeStream) { - exports.prerenderToNodeStream = s.prerenderToNodeStream; +if (s.unstable_prerenderToNodeStream) { + exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream; } 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 699edc869316e..4c3fef534717c 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 @@ -1936,7 +1936,8 @@ null === debugInfo.owner && null != response._debugRootOwner ? ((debugInfo.owner = response._debugRootOwner), (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2072,6 +2073,7 @@ case 84: resolveText(response, id, row); break; + case 78: case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); @@ -2450,10 +2452,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-7283a213-20241206", + version: "19.0.0-rc-79ddf5b5-20241210", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-7283a213-20241206", + reconcilerVersion: "19.0.0-rc-79ddf5b5-20241210", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 f447c6d4fed5e..20203298afe97 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 @@ -1395,6 +1395,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 c6e0a4250fd92..d0cb01f17f228 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 @@ -2149,7 +2149,8 @@ null === debugInfo.owner && null != response._debugRootOwner ? ((debugInfo.owner = response._debugRootOwner), (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2285,6 +2286,7 @@ case 84: resolveText(response, id, row); break; + case 78: case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 c62a559932fc7..e4baa13f7aac9 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 @@ -1567,6 +1567,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 4e66b4f4e236c..46b061135bc85 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 @@ -2149,7 +2149,8 @@ null === debugInfo.owner && null != response._debugRootOwner ? ((debugInfo.owner = response._debugRootOwner), (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2285,6 +2286,7 @@ case 84: resolveText(response, id, row); break; + case 78: case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 009713ef92e71..5c0645aa097d8 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 @@ -1568,6 +1568,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: 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 954bb27845f58..3283ab95c7280 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 @@ -293,14 +293,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -664,12 +656,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -699,13 +686,8 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -731,24 +713,20 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -810,26 +788,22 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -903,6 +877,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; @@ -925,7 +964,9 @@ emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = callComponentInDEV(Component, props, componentDebugInfo); if (request.status === ABORTING) throw ( @@ -936,76 +977,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - prevThenableState = props; - prevThenableState.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === prevThenableState.status) - return prevThenableState.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - prevThenableState = task.keyPath; - componentDebugID = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = - null === prevThenableState ? key : prevThenableState + "," + key) - : null === prevThenableState && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = prevThenableState; - task.implicitSlot = componentDebugID; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = prevThenableState; + return request; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { @@ -1354,24 +1340,20 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -2136,9 +2118,10 @@ function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" !== typeof debugInfo[i].time && + ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); } function emitChunk(request, task, value) { var id = task.id; @@ -2173,6 +2156,12 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = ERRORED$1; + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2191,22 +2180,18 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2231,12 +2216,7 @@ task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); - } + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2360,6 +2340,19 @@ destination && flushCompletedChunks(request, destination); })); } + function startFlowing(request, destination) { + if (request.status === CLOSING) + (request.status = CLOSED), + closeWithError(destination, request.fatalError); + else if (request.status !== CLOSED && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + } function abort(request, reason) { try { 11 >= request.status && (request.status = ABORTING); @@ -3726,21 +3719,7 @@ startWork(request); }, pull: function (controller) { - if (request.status === CLOSING) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.destination - ) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -3750,4 +3729,51 @@ { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 3b974caa0c0e1..23db671c64d12 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 @@ -777,13 +777,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = logRecoverableError(request, thenable.reason, null)), - emitErrorChunk(request, newTask.id, task), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -814,11 +808,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -839,29 +829,25 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -916,31 +902,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -993,63 +975,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$10 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$10[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1308,24 +1284,20 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1727,6 +1699,12 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + error = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, error); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1772,12 +1750,7 @@ function retryTask(request, task) { task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); - } + } else erroredTask(request, task, x); } } finally { } @@ -1866,6 +1839,18 @@ function enqueueFlush(request) { destination && flushCompletedChunks(request, destination); })); } +function startFlowing(request, destination) { + if (13 === request.status) + (request.status = 14), closeWithError(destination, request.fatalError); + else if (14 !== request.status && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } +} function abort(request, reason) { try { 11 >= request.status && (request.status = 12); @@ -1898,7 +1883,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$23 = + var error$22 = void 0 === reason ? Error("The render was aborted by the server without a reason.") : "object" === typeof reason && @@ -1907,14 +1892,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$23); + return callback(error$22); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error$23) { + logRecoverableError(request, error$23, null), fatalError(request, error$23); } } function resolveServerReference(bundlerConfig, id) { @@ -2356,8 +2341,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$27 = createPendingChunk(response); - chunk$27.then( + var chunk$26 = createPendingChunk(response); + chunk$26.then( function (v) { return controller.enqueue(v); }, @@ -2365,10 +2350,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$27; + previousBlockedChunk = chunk$26; chunk.then(function () { - previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); - resolveModelChunk(chunk$27, json, -1); + previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); + resolveModelChunk(chunk$26, json, -1); }); } }, @@ -2740,17 +2725,7 @@ exports.renderToReadableStream = function (model, turbopackMap, options) { startWork(request); }, pull: function (controller) { - if (13 === request.status) - (request.status = 14), closeWithError(controller, request.fatalError); - else if (14 !== request.status && null === request.destination) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -2760,3 +2735,50 @@ exports.renderToReadableStream = function (model, turbopackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 6a118c2765cb1..c321636948821 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 @@ -295,14 +295,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -679,12 +671,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -714,13 +701,8 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -746,24 +728,20 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -825,26 +803,22 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -918,6 +892,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; @@ -940,7 +979,9 @@ emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = supportsComponentStorage ? componentStorage.run( componentDebugInfo, @@ -959,76 +1000,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - prevThenableState = props; - prevThenableState.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === prevThenableState.status) - return prevThenableState.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - prevThenableState = task.keyPath; - componentDebugID = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = - null === prevThenableState ? key : prevThenableState + "," + key) - : null === prevThenableState && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = prevThenableState; - task.implicitSlot = componentDebugID; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = prevThenableState; + return request; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { @@ -1377,24 +1363,20 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -2170,9 +2152,10 @@ function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" !== typeof debugInfo[i].time && + ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); } function emitChunk(request, task, value) { var id = task.id; @@ -2207,6 +2190,12 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = ERRORED$1; + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2225,22 +2214,18 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2265,12 +2250,7 @@ task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); - } + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2398,6 +2378,19 @@ destination && flushCompletedChunks(request, destination); }, 0)); } + function startFlowing(request, destination) { + if (request.status === CLOSING) + (request.status = CLOSED), + closeWithError(destination, request.fatalError); + else if (request.status !== CLOSED && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + } function abort(request, reason) { try { 11 >= request.status && (request.status = ABORTING); @@ -3779,21 +3772,7 @@ const setTimeoutOrImmediate = startWork(request); }, pull: function (controller) { - if (request.status === CLOSING) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.destination - ) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -3803,4 +3782,51 @@ const setTimeoutOrImmediate = { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 70bd5f2333cdb..6962984acfb50 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 @@ -782,13 +782,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = logRecoverableError(request, thenable.reason, null)), - emitErrorChunk(request, newTask.id, task), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -819,11 +813,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -844,29 +834,25 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -921,31 +907,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -998,63 +980,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$10 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$10[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1313,24 +1289,20 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1734,6 +1706,12 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + error = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, error); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1779,12 +1757,7 @@ function retryTask(request, task) { task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); - } + } else erroredTask(request, task, x); } } finally { } @@ -1877,6 +1850,18 @@ function enqueueFlush(request) { destination && flushCompletedChunks(request, destination); }, 0)); } +function startFlowing(request, destination) { + if (13 === request.status) + (request.status = 14), closeWithError(destination, request.fatalError); + else if (14 !== request.status && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } +} function abort(request, reason) { try { 11 >= request.status && (request.status = 12); @@ -1909,7 +1894,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$23 = + var error$22 = void 0 === reason ? Error("The render was aborted by the server without a reason.") : "object" === typeof reason && @@ -1918,14 +1903,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$23); + return callback(error$22); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error$23) { + logRecoverableError(request, error$23, null), fatalError(request, error$23); } } function resolveServerReference(bundlerConfig, id) { @@ -2367,8 +2352,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$27 = createPendingChunk(response); - chunk$27.then( + var chunk$26 = createPendingChunk(response); + chunk$26.then( function (v) { return controller.enqueue(v); }, @@ -2376,10 +2361,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$27; + previousBlockedChunk = chunk$26; chunk.then(function () { - previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); - resolveModelChunk(chunk$27, json, -1); + previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); + resolveModelChunk(chunk$26, json, -1); }); } }, @@ -2762,17 +2747,7 @@ exports.renderToReadableStream = function (model, turbopackMap, options) { startWork(request); }, pull: function (controller) { - if (13 === request.status) - (request.status = 14), closeWithError(controller, request.fatalError); - else if (14 !== request.status && null === request.destination) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -2782,3 +2757,50 @@ exports.renderToReadableStream = function (model, turbopackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, turbopackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 86d2f7eae6804..eaaa2ad78cf88 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 @@ -322,14 +322,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -700,12 +692,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -735,13 +722,8 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -767,24 +749,20 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -846,26 +824,22 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -938,6 +912,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; @@ -960,7 +999,9 @@ emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = componentStorage.run( componentDebugInfo, callComponentInDEV, @@ -977,76 +1018,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - prevThenableState = props; - prevThenableState.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === prevThenableState.status) - return prevThenableState.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - prevThenableState = task.keyPath; - componentDebugID = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = - null === prevThenableState ? key : prevThenableState + "," + key) - : null === prevThenableState && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = prevThenableState; - task.implicitSlot = componentDebugID; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = prevThenableState; + return request; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { @@ -1393,24 +1379,20 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -2172,9 +2154,10 @@ function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" !== typeof debugInfo[i].time && + ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); } function emitChunk(request, task, value) { var id = task.id; @@ -2209,6 +2192,12 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = ERRORED$1; + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2227,22 +2216,18 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2267,12 +2252,7 @@ task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); - } + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -3219,7 +3199,21 @@ abort(request, Error(reason)); }; } - var util = require("util"); + function createFakeWritable(readable) { + return { + write: function (chunk) { + return readable.push(chunk); + }, + end: function () { + readable.push(null); + }, + destroy: function (error) { + readable.destroy(error); + } + }; + } + var stream = require("stream"), + util = require("util"); require("crypto"); var async_hooks = require("async_hooks"), ReactDOM = require("react-dom"), @@ -3754,12 +3748,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_140 = []; + var JSCompiler_object_inline_chunks_143 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_140.push(chunk); + JSCompiler_object_inline_chunks_143.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_140, { + var blob = new Blob(JSCompiler_object_inline_chunks_143, { type: mimeType }); response._formData.append(name, blob, filename); @@ -3849,4 +3843,45 @@ } }; }; + exports.unstable_prerenderToNodeStream = function ( + model, + turbopackMap, + options + ) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); + }; })(); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js index 47099e7909433..fd1d8d8c18f88 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 @@ -9,7 +9,8 @@ */ "use strict"; -var util = require("util"); +var stream = require("stream"), + util = require("util"); require("crypto"); var async_hooks = require("async_hooks"), ReactDOM = require("react-dom"), @@ -798,13 +799,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = logRecoverableError(request, thenable.reason, null)), - emitErrorChunk(request, newTask.id, task), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -835,11 +830,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -860,29 +851,25 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -937,31 +924,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1013,63 +996,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$10 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$10[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1326,24 +1303,20 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1738,6 +1711,12 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + error = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, error); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1783,12 +1762,7 @@ function retryTask(request, task) { task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); - } + } else erroredTask(request, task, x); } } finally { } @@ -1945,7 +1919,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$23 = + var error$22 = void 0 === reason ? Error("The render was aborted by the server without a reason.") : "object" === typeof reason && @@ -1954,14 +1928,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$23); + return callback(error$22); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error$23) { + logRecoverableError(request, error$23, null), fatalError(request, error$23); } } function resolveServerReference(bundlerConfig, id) { @@ -2403,8 +2377,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$27 = createPendingChunk(response); - chunk$27.then( + var chunk$26 = createPendingChunk(response); + chunk$26.then( function (v) { return controller.enqueue(v); }, @@ -2412,10 +2386,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$27; + previousBlockedChunk = chunk$26; chunk.then(function () { - previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); - resolveModelChunk(chunk$27, json, -1); + previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); + resolveModelChunk(chunk$26, json, -1); }); } }, @@ -2692,6 +2666,19 @@ function createCancelHandler(request, reason) { abort(request, Error(reason)); }; } +function createFakeWritable(readable) { + return { + write: function (chunk) { + return readable.push(chunk); + }, + end: function () { + readable.push(null); + }, + destroy: function (error) { + readable.destroy(error); + } + }; +} exports.createClientModuleProxy = function (moduleId) { moduleId = registerClientReferenceImpl({}, moduleId, !1); return new Proxy(moduleId, proxyHandlers$1); @@ -2773,12 +2760,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_215 = []; + var JSCompiler_object_inline_chunks_214 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_215.push(chunk); + JSCompiler_object_inline_chunks_214.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_215, { + var blob = new Blob(JSCompiler_object_inline_chunks_214, { type: mimeType }); response._formData.append(name, blob, filename); @@ -2863,3 +2850,44 @@ exports.renderToPipeableStream = function (model, turbopackMap, options) { } }; }; +exports.unstable_prerenderToNodeStream = function ( + model, + turbopackMap, + options +) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + turbopackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 18c9a7b991d39..11cf85fdf5187 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.0.0-rc-7283a213-20241206", - "react-dom": "19.0.0-rc-7283a213-20241206" + "react": "19.0.0-rc-79ddf5b5-20241210", + "react-dom": "19.0.0-rc-79ddf5b5-20241210" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-turbopack/static.browser.js b/packages/next/src/compiled/react-server-dom-turbopack/static.browser.js index edc104a459383..d04d771c2d3b6 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/static.browser.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/static.browser.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-turbopack-server.browser.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-turbopack/static.edge.js b/packages/next/src/compiled/react-server-dom-turbopack/static.edge.js index c074f8ffe7ee4..6d9ca4b3e8b84 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/static.edge.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/static.edge.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-turbopack-server.edge.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-turbopack/static.node.js b/packages/next/src/compiled/react-server-dom-turbopack/static.node.js index 84083a965189b..544a15530d24f 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/static.node.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/static.node.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-turbopack-server.node.development.js'); } -if (s.prerenderToNodeStream) { - exports.prerenderToNodeStream = s.prerenderToNodeStream; +if (s.unstable_prerenderToNodeStream) { + exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream; } 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 21da6d59188f1..b7c2216dfa097 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 @@ -1537,6 +1537,7 @@ this._rowLength = this._rowTag = this._rowID = this._rowState = 0; this._buffer = []; this._tempRefs = temporaryReferences; + this._timeOrigin = 0; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2030,15 +2031,20 @@ initializeFakeStack(response, debugInfo.owner)); } function resolveDebugInfo(response, id, debugInfo) { - initializeFakeTask( - response, - debugInfo, - void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env - ); + var env = + void 0 === debugInfo.env + ? response._rootEnvironmentName + : debugInfo.env; + void 0 !== debugInfo.stack && + initializeFakeTask(response, debugInfo, env); null === debugInfo.owner && null != response._debugRootOwner - ? ((debugInfo.owner = response._debugRootOwner), - (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + ? ((env = debugInfo), + (env.owner = response._debugRootOwner), + (env.debugStack = response._debugRootStack)) + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); + "number" === typeof debugInfo.time && + (debugInfo = { time: debugInfo.time + response._timeOrigin }); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2226,6 +2232,9 @@ case 84: resolveText(response, id, row); break; + case 78: + response._timeOrigin = +row - performance.timeOrigin; + break; case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); @@ -2669,10 +2678,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-7283a213-20241206", + version: "19.0.0-experimental-79ddf5b5-20241210", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-7283a213-20241206", + reconcilerVersion: "19.0.0-experimental-79ddf5b5-20241210", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 d026c84779836..62620be87fa4b 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 @@ -1408,6 +1408,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 2be6459ca729e..a44b949fd12a5 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 @@ -1747,6 +1747,7 @@ this._rowLength = this._rowTag = this._rowID = this._rowState = 0; this._buffer = []; this._tempRefs = temporaryReferences; + this._timeOrigin = 0; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2245,15 +2246,20 @@ initializeFakeStack(response, debugInfo.owner)); } function resolveDebugInfo(response, id, debugInfo) { - initializeFakeTask( - response, - debugInfo, - void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env - ); + var env = + void 0 === debugInfo.env + ? response._rootEnvironmentName + : debugInfo.env; + void 0 !== debugInfo.stack && + initializeFakeTask(response, debugInfo, env); null === debugInfo.owner && null != response._debugRootOwner - ? ((debugInfo.owner = response._debugRootOwner), - (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + ? ((env = debugInfo), + (env.owner = response._debugRootOwner), + (env.debugStack = response._debugRootStack)) + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); + "number" === typeof debugInfo.time && + (debugInfo = { time: debugInfo.time + response._timeOrigin }); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2441,6 +2447,9 @@ case 84: resolveText(response, id, row); break; + case 78: + response._timeOrigin = +row - performance.timeOrigin; + break; case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 116d3e81a96de..f52524e17399e 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 @@ -1571,6 +1571,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 cab7fd2e57157..7406455f26820 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 @@ -1747,6 +1747,7 @@ this._rowLength = this._rowTag = this._rowID = this._rowState = 0; this._buffer = []; this._tempRefs = temporaryReferences; + this._timeOrigin = 0; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2245,15 +2246,20 @@ initializeFakeStack(response, debugInfo.owner)); } function resolveDebugInfo(response, id, debugInfo) { - initializeFakeTask( - response, - debugInfo, - void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env - ); + var env = + void 0 === debugInfo.env + ? response._rootEnvironmentName + : debugInfo.env; + void 0 !== debugInfo.stack && + initializeFakeTask(response, debugInfo, env); null === debugInfo.owner && null != response._debugRootOwner - ? ((debugInfo.owner = response._debugRootOwner), - (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + ? ((env = debugInfo), + (env.owner = response._debugRootOwner), + (env.debugStack = response._debugRootStack)) + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); + "number" === typeof debugInfo.time && + (debugInfo = { time: debugInfo.time + response._timeOrigin }); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2441,6 +2447,9 @@ case 84: resolveText(response, id, row); break; + case 78: + response._timeOrigin = +row - performance.timeOrigin; + break; case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 7c85c60fc1dc9..4907f98eae26c 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 @@ -1574,6 +1574,7 @@ function processFullStringRow(response, id, tag, row) { ? chunk.reason.enqueueValue(row) : tag.set(id, new ReactPromise("fulfilled", row, null, response)); break; + case 78: case 68: case 87: 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 a1d6011f081b4..8c7b9eb4a0b06 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 @@ -1709,6 +1709,7 @@ this._rowLength = this._rowTag = this._rowID = this._rowState = 0; this._buffer = []; this._tempRefs = temporaryReferences; + this._timeOrigin = 0; this._debugRootOwner = bundlerConfig = void 0 === ReactSharedInteralsServer || null === ReactSharedInteralsServer.A @@ -2207,15 +2208,20 @@ initializeFakeStack(response, debugInfo.owner)); } function resolveDebugInfo(response, id, debugInfo) { - initializeFakeTask( - response, - debugInfo, - void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env - ); + var env = + void 0 === debugInfo.env + ? response._rootEnvironmentName + : debugInfo.env; + void 0 !== debugInfo.stack && + initializeFakeTask(response, debugInfo, env); null === debugInfo.owner && null != response._debugRootOwner - ? ((debugInfo.owner = response._debugRootOwner), - (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + ? ((env = debugInfo), + (env.owner = response._debugRootOwner), + (env.debugStack = response._debugRootStack)) + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); + "number" === typeof debugInfo.time && + (debugInfo = { time: debugInfo.time + response._timeOrigin }); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2403,6 +2409,9 @@ case 84: resolveText(response, id, row); break; + case 78: + response._timeOrigin = +row - performance.timeOrigin; + break; case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 25218701acc9e..463172b2881f9 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 @@ -1539,6 +1539,7 @@ function processFullStringRow(response, id, tag, row) { ? chunk.reason.enqueueValue(row) : tag.set(id, new ReactPromise("fulfilled", row, null, response)); break; + case 78: case 68: case 87: 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 f0c4c55288ad7..98cab1df09045 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 @@ -293,14 +293,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -711,8 +703,10 @@ ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; - type = createTask(this, model, null, !1, abortSet, null, null, null); - pingedTasks.push(type); + type = this.timeOrigin = performance.now(); + emitTimeOriginChunk(this, type + performance.timeOrigin); + model = createTask(this, model, null, !1, abortSet, null, null, null); + pingedTasks.push(model); } function noop() {} function serializeThenable(request, task, thenable) { @@ -736,21 +730,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - if ( - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id, task); - else { - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -782,24 +762,11 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id, reason); - else { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); + newTask.timed = !0; return newTask.id; } function serializeReadableStream(request, task, stream) { @@ -823,38 +790,21 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -918,40 +868,23 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -1034,6 +967,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent( request, task, @@ -1066,12 +1064,16 @@ componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; outlineComponentInfo(request, componentDebugInfo); + task.timed = !0; + emitTimingChunk(request, componentDebugID, performance.now()); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && warnForMissingKey(request, key, componentDebugInfo, task.debugTask); } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = task.debugTask ? task.debugTask.run( callComponentInDEV.bind(null, Component, props, componentDebugInfo) @@ -1086,74 +1088,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - validated = props; - validated.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === validated.status) return validated.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - validated = task.keyPath; - prevThenableState = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + validated = task.implicitSlot; null !== key - ? (task.keyPath = null === validated ? key : validated + "," + key) - : null === validated && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = validated; - task.implicitSlot = prevThenableState; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = validated; + return request; } function warnForMissingKey(request, key, componentDebugInfo, debugTask) { function logKeyError() { @@ -1350,6 +1299,7 @@ return task; } function pingTask(request, task) { + task.timed = !0; var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && @@ -1414,7 +1364,8 @@ }); return renderModel(request, task, parent, parentPropertyName, value); }, - thenableState: null + thenableState: null, + timed: !1 }; task.environmentName = request.environmentName(); task.debugOwner = debugOwner; @@ -1588,38 +1539,21 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -1667,45 +1601,42 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks, - task.debugOwner, - task.debugStack, - task.debugTask - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent - ? serializeLazyID(request.id) - : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value, key), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } + if ( + "object" === typeof key && + null !== key && + "function" === typeof key.then + ) + return ( + (request = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks, + task.debugOwner, + task.debugStack, + task.debugTask + )), + (value = request.ping), + key.then(value, value), + (request.thenableState = getThenableStateAfterSuspending()), + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + parent + ? serializeLazyID(request.id) + : serializeByValueID(request.id) + ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; request.pendingChunks++; prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task, key); + "object" === typeof key && + null !== key && + key.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, key.message, task), + emitPostponeChunk(request, prevKeyPath, key)) + : ((task = logRecoverableError(request, key, task)), + emitErrorChunk(request, prevKeyPath, task, key)); return parent ? serializeLazyID(prevKeyPath) : serializeByValueID(prevKeyPath); @@ -2473,12 +2404,26 @@ methodName = stringToChunk(":W" + json + "\n"); request.completedRegularChunks.push(methodName); } + function emitTimeOriginChunk(request, timeOrigin) { + request.pendingChunks++; + timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); + request.completedRegularChunks.push(timeOrigin); + } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" === typeof debugInfo[i].time + ? emitTimingChunk(request, id, debugInfo[i].time) + : ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); + } + function emitTimingChunk(request, id, timestamp) { + request.pendingChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedRegularChunks.push(id); } function emitChunk(request, task, value) { var id = task.id; @@ -2515,6 +2460,22 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + task.timed && emitTimingChunk(request, task.id, performance.now()); + request.abortableTasks.delete(task); + task.status = ERRORED$1; + if ( + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ) + logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id, error); + else { + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2533,22 +2494,19 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + task.timed && emitTimingChunk(request, task.id, performance.now()); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2570,26 +2528,16 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = PENDING$1; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id, x); - return; - } - } - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = PENDING$1; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2633,6 +2581,7 @@ function abortTask(task, request, errorId) { task.status !== RENDERING && ((task.status = ABORTED), + task.timed && emitTimingChunk(request, task.id, performance.now()), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); @@ -2739,29 +2688,25 @@ 11 >= request.status && (request.status = ABORTING); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (request.type === PRERENDER) + abortableTasks.forEach(function (task) { + task.status !== RENDERING && + ((task.status = ABORTED), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ( - (logPostpone(request, reason.message, null), - request.type === PRERENDER) - ) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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( @@ -2774,21 +2719,14 @@ "The render was aborted by the server with a promise." ) : reason, - digest = logRecoverableError(request, error, null); - if (request.type === PRERENDER) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - } + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -4101,53 +4039,6 @@ close(body); return webpackMap; }; - exports.prerender = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - PRERENDER, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - options ? options.environmentName : void 0, - options ? options.filterStackFrame : void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); - }; exports.registerClientReference = function ( proxyImplementation, id, @@ -4213,4 +4104,51 @@ { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 cae9573c05f4c..4cc7c6ec3a6ff 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 @@ -801,19 +801,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = thenable.reason), - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((task = logRecoverableError(request, task, null)), - emitErrorChunk(request, newTask.id, task)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -846,16 +834,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ("object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -876,43 +855,26 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -967,45 +929,28 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$10) { - error(x$10); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1058,63 +1003,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$11 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$11[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1210,7 +1149,79 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { return pingTask(request, task); }, toJSON: function (parentPropertyName, value) { - return renderModel(request, task, this, parentPropertyName, value); + var prevKeyPath = task.keyPath, + prevImplicitSlot = task.implicitSlot; + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = task.model), + (parentPropertyName = + "object" === typeof parentPropertyName && + null !== parentPropertyName && + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE || + parentPropertyName.$$typeof === REACT_LAZY_TYPE)), + 12 === request.status) + ) + (task.status = 3), + 21 === request.type + ? ((prevKeyPath = request.nextChunkId++), + (prevKeyPath = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)), + (JSCompiler_inline_result = prevKeyPath)) + : ((prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); + else if ( + ((value = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + "object" === typeof value && + null !== value && + "function" === typeof value.then) + ) { + JSCompiler_inline_result = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + value.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + task.keyPath = prevKeyPath; + task.implicitSlot = prevImplicitSlot; + JSCompiler_inline_result = parentPropertyName + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + "object" === typeof value && + null !== value && + value.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, value.message, task), + emitPostponeChunk(request, prevKeyPath)) + : ((prevImplicitSlot = logRecoverableError(request, value, task)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot)), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)); + } + return JSCompiler_inline_result; }, thenableState: null }; @@ -1220,9 +1231,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeLazyID(id) { - return "$L" + id.toString(16); -} function encodeReferenceChunk(request, id, reference) { request = stringify(reference); id = id.toString(16) + ":" + request + "\n"; @@ -1241,7 +1249,7 @@ function serializeClientReference( existingId = writtenClientReferences.get(clientReferenceKey); if (void 0 !== existingId) return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(existingId) + ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { var config = request.bundlerConfig, @@ -1279,7 +1287,7 @@ function serializeClientReference( request.completedImportChunks.push(processedChunk); writtenClientReferences.set(clientReferenceKey, importId); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(importId) + ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( @@ -1315,37 +1323,21 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id), enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1356,70 +1348,6 @@ function serializeBlob(request, blob) { return "$B" + newTask.id.toString(16); } var modelRoot = !1; -function renderModel(request, task, parent, key, value) { - var prevKeyPath = task.keyPath, - prevImplicitSlot = task.implicitSlot; - try { - return renderModelDestructive(request, task, parent, key, value); - } catch (thrownValue) { - parent = task.model; - parent = - "object" === typeof parent && - null !== parent && - (parent.$$typeof === REACT_ELEMENT_TYPE || - parent.$$typeof === REACT_LAZY_TYPE); - if (12 === request.status) { - task.status = 3; - if (21 === request.type) - return ( - (task = request.nextChunkId++), - (task = parent ? serializeLazyID(task) : serializeByValueID(task)), - task - ); - task = request.fatalError; - return parent ? serializeLazyID(task) : serializeByValueID(task); - } - key = - thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(request.id) : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } - task.keyPath = prevKeyPath; - task.implicitSlot = prevImplicitSlot; - request.pendingChunks++; - prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task); - return parent - ? serializeLazyID(prevKeyPath) - : serializeByValueID(prevKeyPath); - } -} function renderModelDestructive( request, task, @@ -1853,6 +1781,17 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id)) + : ((error = logRecoverableError(request, error, task)), + emitErrorChunk(request, task.id, error)); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1895,26 +1834,16 @@ function retryTask(request, task) { thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = 0; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = 4; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id); - return; - } - } - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = 0; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { } @@ -2030,25 +1959,24 @@ function abort(request, reason) { 11 >= request.status && (request.status = 12); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (21 === request.type) + abortableTasks.forEach(function (task) { + 5 !== task.status && ((task.status = 3), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ((logPostpone(request, reason.message, null), 21 === request.type)) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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.") @@ -2057,20 +1985,14 @@ function abort(request, reason) { "function" === typeof reason.then ? Error("The render was aborted by the server with a promise.") : reason, - digest = logRecoverableError(request, error, null); - if (21 === request.type) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } + digest = logRecoverableError(request, error, null), + errorId$25 = request.nextChunkId++; + request.fatalError = errorId$25; + request.pendingChunks++; + emitErrorChunk(request, errorId$25, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$25); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -2078,7 +2000,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$28 = + var error$26 = "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE @@ -2091,14 +2013,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$28); + return callback(error$26); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$29) { - logRecoverableError(request, error$29, null), fatalError(request, error$29); + } catch (error$27) { + logRecoverableError(request, error$27, null), fatalError(request, error$27); } } function resolveServerReference(bundlerConfig, id) { @@ -2552,8 +2474,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$32 = createPendingChunk(response); - chunk$32.then( + var chunk$30 = createPendingChunk(response); + chunk$30.then( function (v) { return controller.enqueue(v); }, @@ -2561,10 +2483,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$32; + previousBlockedChunk = chunk$30; chunk.then(function () { - previousBlockedChunk === chunk$32 && (previousBlockedChunk = null); - resolveModelChunk(chunk$32, json, -1); + previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); + resolveModelChunk(chunk$30, json, -1); }); } }, @@ -2882,53 +2804,6 @@ exports.decodeReply = function (body, webpackMap, options) { close(body); return webpackMap; }; -exports.prerender = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - 21, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - void 0, - void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); -}; exports.registerClientReference = function ( proxyImplementation, id, @@ -2993,3 +2868,50 @@ exports.renderToReadableStream = function (model, webpackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 c4c59096bb9b3..1b529340442aa 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 @@ -295,14 +295,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -718,8 +710,10 @@ ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; - type = createTask(this, model, null, !1, abortSet, null, null, null); - pingedTasks.push(type); + type = this.timeOrigin = performance.now(); + emitTimeOriginChunk(this, type + performance.timeOrigin); + model = createTask(this, model, null, !1, abortSet, null, null, null); + pingedTasks.push(model); } function noop() {} function resolveRequest() { @@ -751,21 +745,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - if ( - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id, task); - else { - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -797,24 +777,11 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id, reason); - else { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); + newTask.timed = !0; return newTask.id; } function serializeReadableStream(request, task, stream) { @@ -838,38 +805,21 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -933,40 +883,23 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -1049,6 +982,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent( request, task, @@ -1081,12 +1079,16 @@ componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; outlineComponentInfo(request, componentDebugInfo); + task.timed = !0; + emitTimingChunk(request, componentDebugID, performance.now()); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && warnForMissingKey(request, key, componentDebugInfo, task.debugTask); } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = supportsComponentStorage ? task.debugTask ? task.debugTask.run( @@ -1125,74 +1127,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - validated = props; - validated.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === validated.status) return validated.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - validated = task.keyPath; - prevThenableState = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + validated = task.implicitSlot; null !== key - ? (task.keyPath = null === validated ? key : validated + "," + key) - : null === validated && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = validated; - task.implicitSlot = prevThenableState; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = validated; + return request; } function warnForMissingKey(request, key, componentDebugInfo, debugTask) { function logKeyError() { @@ -1413,6 +1362,7 @@ return task; } function pingTask(request, task) { + task.timed = !0; var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && @@ -1477,7 +1427,8 @@ }); return renderModel(request, task, parent, parentPropertyName, value); }, - thenableState: null + thenableState: null, + timed: !1 }; task.environmentName = request.environmentName(); task.debugOwner = debugOwner; @@ -1651,38 +1602,21 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -1730,45 +1664,42 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks, - task.debugOwner, - task.debugStack, - task.debugTask - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent - ? serializeLazyID(request.id) - : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value, key), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } + if ( + "object" === typeof key && + null !== key && + "function" === typeof key.then + ) + return ( + (request = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks, + task.debugOwner, + task.debugStack, + task.debugTask + )), + (value = request.ping), + key.then(value, value), + (request.thenableState = getThenableStateAfterSuspending()), + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + parent + ? serializeLazyID(request.id) + : serializeByValueID(request.id) + ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; request.pendingChunks++; prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task, key); + "object" === typeof key && + null !== key && + key.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, key.message, task), + emitPostponeChunk(request, prevKeyPath, key)) + : ((task = logRecoverableError(request, key, task)), + emitErrorChunk(request, prevKeyPath, task, key)); return parent ? serializeLazyID(prevKeyPath) : serializeByValueID(prevKeyPath); @@ -2558,12 +2489,26 @@ methodName = stringToChunk(":W" + json + "\n"); request.completedRegularChunks.push(methodName); } + function emitTimeOriginChunk(request, timeOrigin) { + request.pendingChunks++; + timeOrigin = stringToChunk(":N" + timeOrigin + "\n"); + request.completedRegularChunks.push(timeOrigin); + } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" === typeof debugInfo[i].time + ? emitTimingChunk(request, id, debugInfo[i].time) + : ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); + } + function emitTimingChunk(request, id, timestamp) { + request.pendingChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + id = stringToChunk(id); + request.completedRegularChunks.push(id); } function emitChunk(request, task, value) { var id = task.id; @@ -2600,6 +2545,22 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + task.timed && emitTimingChunk(request, task.id, performance.now()); + request.abortableTasks.delete(task); + task.status = ERRORED$1; + if ( + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ) + logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id, error); + else { + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2618,22 +2579,19 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + task.timed && emitTimingChunk(request, task.id, performance.now()); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2655,26 +2613,16 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = PENDING$1; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id, x); - return; - } - } - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = PENDING$1; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2718,6 +2666,7 @@ function abortTask(task, request, errorId) { task.status !== RENDERING && ((task.status = ABORTED), + task.timed && emitTimingChunk(request, task.id, performance.now()), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); @@ -2828,29 +2777,25 @@ 11 >= request.status && (request.status = ABORTING); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (request.type === PRERENDER) + abortableTasks.forEach(function (task) { + task.status !== RENDERING && + ((task.status = ABORTED), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ( - (logPostpone(request, reason.message, null), - request.type === PRERENDER) - ) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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( @@ -2863,21 +2808,14 @@ "The render was aborted by the server with a promise." ) : reason, - digest = logRecoverableError(request, error, null); - if (request.type === PRERENDER) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - } + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -4193,53 +4131,6 @@ close(body); return webpackMap; }; - exports.prerender = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - PRERENDER, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - options ? options.environmentName : void 0, - options ? options.filterStackFrame : void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); - }; exports.registerClientReference = function ( proxyImplementation, id, @@ -4316,4 +4207,51 @@ const setTimeoutOrImmediate = { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 af9903ece3e85..fa2258e81fbe8 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 @@ -806,19 +806,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = thenable.reason), - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((task = logRecoverableError(request, task, null)), - emitErrorChunk(request, newTask.id, task)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -851,16 +839,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ("object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -881,43 +860,26 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -972,45 +934,28 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$10) { - error(x$10); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1063,63 +1008,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$11 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$11[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1215,7 +1154,79 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { return pingTask(request, task); }, toJSON: function (parentPropertyName, value) { - return renderModel(request, task, this, parentPropertyName, value); + var prevKeyPath = task.keyPath, + prevImplicitSlot = task.implicitSlot; + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = task.model), + (parentPropertyName = + "object" === typeof parentPropertyName && + null !== parentPropertyName && + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE || + parentPropertyName.$$typeof === REACT_LAZY_TYPE)), + 12 === request.status) + ) + (task.status = 3), + 21 === request.type + ? ((prevKeyPath = request.nextChunkId++), + (prevKeyPath = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)), + (JSCompiler_inline_result = prevKeyPath)) + : ((prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); + else if ( + ((value = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + "object" === typeof value && + null !== value && + "function" === typeof value.then) + ) { + JSCompiler_inline_result = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + value.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + task.keyPath = prevKeyPath; + task.implicitSlot = prevImplicitSlot; + JSCompiler_inline_result = parentPropertyName + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + "object" === typeof value && + null !== value && + value.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, value.message, task), + emitPostponeChunk(request, prevKeyPath)) + : ((prevImplicitSlot = logRecoverableError(request, value, task)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot)), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)); + } + return JSCompiler_inline_result; }, thenableState: null }; @@ -1225,9 +1236,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeLazyID(id) { - return "$L" + id.toString(16); -} function encodeReferenceChunk(request, id, reference) { request = stringify(reference); id = id.toString(16) + ":" + request + "\n"; @@ -1246,7 +1254,7 @@ function serializeClientReference( existingId = writtenClientReferences.get(clientReferenceKey); if (void 0 !== existingId) return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(existingId) + ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { var config = request.bundlerConfig, @@ -1284,7 +1292,7 @@ function serializeClientReference( request.completedImportChunks.push(processedChunk); writtenClientReferences.set(clientReferenceKey, importId); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(importId) + ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( @@ -1320,37 +1328,21 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id), enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1361,70 +1353,6 @@ function serializeBlob(request, blob) { return "$B" + newTask.id.toString(16); } var modelRoot = !1; -function renderModel(request, task, parent, key, value) { - var prevKeyPath = task.keyPath, - prevImplicitSlot = task.implicitSlot; - try { - return renderModelDestructive(request, task, parent, key, value); - } catch (thrownValue) { - parent = task.model; - parent = - "object" === typeof parent && - null !== parent && - (parent.$$typeof === REACT_ELEMENT_TYPE || - parent.$$typeof === REACT_LAZY_TYPE); - if (12 === request.status) { - task.status = 3; - if (21 === request.type) - return ( - (task = request.nextChunkId++), - (task = parent ? serializeLazyID(task) : serializeByValueID(task)), - task - ); - task = request.fatalError; - return parent ? serializeLazyID(task) : serializeByValueID(task); - } - key = - thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(request.id) : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } - task.keyPath = prevKeyPath; - task.implicitSlot = prevImplicitSlot; - request.pendingChunks++; - prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task); - return parent - ? serializeLazyID(prevKeyPath) - : serializeByValueID(prevKeyPath); - } -} function renderModelDestructive( request, task, @@ -1862,6 +1790,17 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id)) + : ((error = logRecoverableError(request, error, task)), + emitErrorChunk(request, task.id, error)); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1904,26 +1843,16 @@ function retryTask(request, task) { thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = 0; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = 4; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id); - return; - } - } - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = 0; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { } @@ -2043,25 +1972,24 @@ function abort(request, reason) { 11 >= request.status && (request.status = 12); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (21 === request.type) + abortableTasks.forEach(function (task) { + 5 !== task.status && ((task.status = 3), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ((logPostpone(request, reason.message, null), 21 === request.type)) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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.") @@ -2070,20 +1998,14 @@ function abort(request, reason) { "function" === typeof reason.then ? Error("The render was aborted by the server with a promise.") : reason, - digest = logRecoverableError(request, error, null); - if (21 === request.type) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } + digest = logRecoverableError(request, error, null), + errorId$25 = request.nextChunkId++; + request.fatalError = errorId$25; + request.pendingChunks++; + emitErrorChunk(request, errorId$25, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$25); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -2091,7 +2013,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$28 = + var error$26 = "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE @@ -2104,14 +2026,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$28); + return callback(error$26); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$29) { - logRecoverableError(request, error$29, null), fatalError(request, error$29); + } catch (error$27) { + logRecoverableError(request, error$27, null), fatalError(request, error$27); } } function resolveServerReference(bundlerConfig, id) { @@ -2556,8 +2478,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$32 = createPendingChunk(response); - chunk$32.then( + var chunk$30 = createPendingChunk(response); + chunk$30.then( function (v) { return controller.enqueue(v); }, @@ -2565,10 +2487,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$32; + previousBlockedChunk = chunk$30; chunk.then(function () { - previousBlockedChunk === chunk$32 && (previousBlockedChunk = null); - resolveModelChunk(chunk$32, json, -1); + previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); + resolveModelChunk(chunk$30, json, -1); }); } }, @@ -2886,53 +2808,6 @@ exports.decodeReply = function (body, webpackMap, options) { close(body); return webpackMap; }; -exports.prerender = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - 21, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - void 0, - void 0, - function () { - var stream = new ReadableStream( - { - type: "bytes", - start: function () { - startWork(request); - }, - pull: function (controller) { - startFlowing(request, controller); - }, - cancel: function (reason) { - request.destination = null; - abort(request, reason); - } - }, - { highWaterMark: 0 } - ); - resolve({ prelude: stream }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); -}; exports.registerClientReference = function ( proxyImplementation, id, @@ -3008,3 +2883,50 @@ exports.renderToReadableStream = function (model, webpackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 be700eac35ed5..0436cb3760983 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 @@ -322,14 +322,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -742,8 +734,10 @@ ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; - type = createTask(this, model, null, !1, abortSet, null, null, null); - pingedTasks.push(type); + type = this.timeOrigin = performance.now(); + emitTimeOriginChunk(this, type + performance.timeOrigin); + model = createTask(this, model, null, !1, abortSet, null, null, null); + pingedTasks.push(model); } function noop() {} function resolveRequest() { @@ -772,21 +766,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - if ( - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id, task); - else { - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -818,24 +798,11 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id, reason); - else { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); + newTask.timed = !0; return newTask.id; } function serializeReadableStream(request, task, stream) { @@ -859,38 +826,21 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -954,40 +904,23 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -1069,6 +1002,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent( request, task, @@ -1101,12 +1099,16 @@ componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; outlineComponentInfo(request, componentDebugInfo); + task.timed = !0; + emitTimingChunk(request, componentDebugID, performance.now()); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && warnForMissingKey(request, key, componentDebugInfo, task.debugTask); } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = task.debugTask ? task.debugTask.run( componentStorage.run.bind( @@ -1134,74 +1136,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - validated = props; - validated.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === validated.status) return validated.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - validated = task.keyPath; - prevThenableState = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + validated = task.implicitSlot; null !== key - ? (task.keyPath = null === validated ? key : validated + "," + key) - : null === validated && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = validated; - task.implicitSlot = prevThenableState; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = validated; + return request; } function warnForMissingKey(request, key, componentDebugInfo, debugTask) { function logKeyError() { @@ -1411,6 +1360,7 @@ return task; } function pingTask(request, task) { + task.timed = !0; var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && @@ -1475,7 +1425,8 @@ }); return renderModel(request, task, parent, parentPropertyName, value); }, - thenableState: null + thenableState: null, + timed: !1 }; task.environmentName = request.environmentName(); task.debugOwner = debugOwner; @@ -1647,38 +1598,21 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -1726,45 +1660,42 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks, - task.debugOwner, - task.debugStack, - task.debugTask - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent - ? serializeLazyID(request.id) - : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value, key), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } + if ( + "object" === typeof key && + null !== key && + "function" === typeof key.then + ) + return ( + (request = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks, + task.debugOwner, + task.debugStack, + task.debugTask + )), + (value = request.ping), + key.then(value, value), + (request.thenableState = getThenableStateAfterSuspending()), + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + parent + ? serializeLazyID(request.id) + : serializeByValueID(request.id) + ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; request.pendingChunks++; prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task, key); + "object" === typeof key && + null !== key && + key.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, key.message, task), + emitPostponeChunk(request, prevKeyPath, key)) + : ((task = logRecoverableError(request, key, task)), + emitErrorChunk(request, prevKeyPath, task, key)); return parent ? serializeLazyID(prevKeyPath) : serializeByValueID(prevKeyPath); @@ -2535,12 +2466,24 @@ } request.completedRegularChunks.push(":W" + json + "\n"); } + function emitTimeOriginChunk(request, timeOrigin) { + request.pendingChunks++; + request.completedRegularChunks.push(":N" + timeOrigin + "\n"); + } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" === typeof debugInfo[i].time + ? emitTimingChunk(request, id, debugInfo[i].time) + : ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); + } + function emitTimingChunk(request, id, timestamp) { + request.pendingChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + request.completedRegularChunks.push(id); } function emitChunk(request, task, value) { var id = task.id; @@ -2577,6 +2520,22 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + task.timed && emitTimingChunk(request, task.id, performance.now()); + request.abortableTasks.delete(task); + task.status = ERRORED$1; + if ( + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ) + logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id, error); + else { + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2595,22 +2554,19 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + task.timed && emitTimingChunk(request, task.id, performance.now()); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2632,26 +2588,16 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = PENDING$1; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id, x); - return; - } - } - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = PENDING$1; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2695,6 +2641,7 @@ function abortTask(task, request, errorId) { task.status !== RENDERING && ((task.status = ABORTED), + task.timed && emitTimingChunk(request, task.id, performance.now()), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); @@ -2801,29 +2748,25 @@ 11 >= request.status && (request.status = ABORTING); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (request.type === PRERENDER) + abortableTasks.forEach(function (task) { + task.status !== RENDERING && + ((task.status = ABORTED), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ( - (logPostpone(request, reason.message, null), - request.type === PRERENDER) - ) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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( @@ -2836,21 +2779,14 @@ "The render was aborted by the server with a promise." ) : reason, - digest = logRecoverableError(request, error, null); - if (request.type === PRERENDER) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - } + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -4210,12 +4146,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_146 = []; + var JSCompiler_object_inline_chunks_153 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_146.push(chunk); + JSCompiler_object_inline_chunks_153.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_146, { + var blob = new Blob(JSCompiler_object_inline_chunks_153, { type: mimeType }); response._formData.append(name, blob, filename); @@ -4239,43 +4175,6 @@ }); return getChunk(response, 0); }; - exports.prerenderToNodeStream = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - PRERENDER, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - options ? options.environmentName : void 0, - options ? options.filterStackFrame : void 0, - function () { - var readable = new stream.Readable({ - read: function () { - startFlowing(request, writable); - } - }), - writable = createFakeWritable(readable); - resolve({ prelude: readable }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); - }; exports.registerClientReference = function ( proxyImplementation, id, @@ -4342,4 +4241,45 @@ } }; }; + exports.unstable_prerenderToNodeStream = function ( + model, + webpackMap, + options + ) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); + }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js index 4bd5a9fba255e..06ab0dbc38620 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 @@ -823,19 +823,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = thenable.reason), - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((task = logRecoverableError(request, task, null)), - emitErrorChunk(request, newTask.id, task)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -868,16 +856,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ("object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -898,43 +877,26 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -989,45 +951,28 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$10) { - error(x$10); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1079,63 +1024,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$11 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$11[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1231,7 +1170,79 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { return pingTask(request, task); }, toJSON: function (parentPropertyName, value) { - return renderModel(request, task, this, parentPropertyName, value); + var prevKeyPath = task.keyPath, + prevImplicitSlot = task.implicitSlot; + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = task.model), + (parentPropertyName = + "object" === typeof parentPropertyName && + null !== parentPropertyName && + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE || + parentPropertyName.$$typeof === REACT_LAZY_TYPE)), + 12 === request.status) + ) + (task.status = 3), + 21 === request.type + ? ((prevKeyPath = request.nextChunkId++), + (prevKeyPath = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)), + (JSCompiler_inline_result = prevKeyPath)) + : ((prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); + else if ( + ((value = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + "object" === typeof value && + null !== value && + "function" === typeof value.then) + ) { + JSCompiler_inline_result = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + value.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + task.keyPath = prevKeyPath; + task.implicitSlot = prevImplicitSlot; + JSCompiler_inline_result = parentPropertyName + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + "object" === typeof value && + null !== value && + value.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, value.message, task), + emitPostponeChunk(request, prevKeyPath)) + : ((prevImplicitSlot = logRecoverableError(request, value, task)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot)), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)); + } + return JSCompiler_inline_result; }, thenableState: null }; @@ -1241,9 +1252,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeLazyID(id) { - return "$L" + id.toString(16); -} function encodeReferenceChunk(request, id, reference) { request = stringify(reference); return id.toString(16) + ":" + request + "\n"; @@ -1261,7 +1269,7 @@ function serializeClientReference( existingId = writtenClientReferences.get(clientReferenceKey); if (void 0 !== existingId) return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(existingId) + ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { var config = request.bundlerConfig, @@ -1298,7 +1306,7 @@ function serializeClientReference( request.completedImportChunks.push(processedChunk); writtenClientReferences.set(clientReferenceKey, importId); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(importId) + ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( @@ -1334,37 +1342,21 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id), enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1375,70 +1367,6 @@ function serializeBlob(request, blob) { return "$B" + newTask.id.toString(16); } var modelRoot = !1; -function renderModel(request, task, parent, key, value) { - var prevKeyPath = task.keyPath, - prevImplicitSlot = task.implicitSlot; - try { - return renderModelDestructive(request, task, parent, key, value); - } catch (thrownValue) { - parent = task.model; - parent = - "object" === typeof parent && - null !== parent && - (parent.$$typeof === REACT_ELEMENT_TYPE || - parent.$$typeof === REACT_LAZY_TYPE); - if (12 === request.status) { - task.status = 3; - if (21 === request.type) - return ( - (task = request.nextChunkId++), - (task = parent ? serializeLazyID(task) : serializeByValueID(task)), - task - ); - task = request.fatalError; - return parent ? serializeLazyID(task) : serializeByValueID(task); - } - key = - thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(request.id) : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } - task.keyPath = prevKeyPath; - task.implicitSlot = prevImplicitSlot; - request.pendingChunks++; - prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task); - return parent - ? serializeLazyID(prevKeyPath) - : serializeByValueID(prevKeyPath); - } -} function renderModelDestructive( request, task, @@ -1863,6 +1791,17 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id)) + : ((error = logRecoverableError(request, error, task)), + emitErrorChunk(request, task.id, error)); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1905,26 +1844,16 @@ function retryTask(request, task) { thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = 0; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = 4; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id); - return; - } - } - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = 0; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { } @@ -2064,25 +1993,24 @@ function abort(request, reason) { 11 >= request.status && (request.status = 12); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (21 === request.type) + abortableTasks.forEach(function (task) { + 5 !== task.status && ((task.status = 3), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ((logPostpone(request, reason.message, null), 21 === request.type)) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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.") @@ -2091,20 +2019,14 @@ function abort(request, reason) { "function" === typeof reason.then ? Error("The render was aborted by the server with a promise.") : reason, - digest = logRecoverableError(request, error, null); - if (21 === request.type) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } + digest = logRecoverableError(request, error, null), + errorId$25 = request.nextChunkId++; + request.fatalError = errorId$25; + request.pendingChunks++; + emitErrorChunk(request, errorId$25, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$25); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -2112,7 +2034,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$28 = + var error$26 = "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE @@ -2125,14 +2047,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$28); + return callback(error$26); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$29) { - logRecoverableError(request, error$29, null), fatalError(request, error$29); + } catch (error$27) { + logRecoverableError(request, error$27, null), fatalError(request, error$27); } } function resolveServerReference(bundlerConfig, id) { @@ -2577,8 +2499,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$32 = createPendingChunk(response); - chunk$32.then( + var chunk$30 = createPendingChunk(response); + chunk$30.then( function (v) { return controller.enqueue(v); }, @@ -2586,10 +2508,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$32; + previousBlockedChunk = chunk$30; chunk.then(function () { - previousBlockedChunk === chunk$32 && (previousBlockedChunk = null); - resolveModelChunk(chunk$32, json, -1); + previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); + resolveModelChunk(chunk$30, json, -1); }); } }, @@ -2960,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_232 = []; + var JSCompiler_object_inline_chunks_234 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_232.push(chunk); + JSCompiler_object_inline_chunks_234.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_232, { + var blob = new Blob(JSCompiler_object_inline_chunks_234, { type: mimeType }); response._formData.append(name, blob, filename); @@ -2985,43 +2907,6 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { }); return getChunk(response, 0); }; -exports.prerenderToNodeStream = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - 21, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - void 0, - void 0, - function () { - var readable = new stream.Readable({ - read: function () { - startFlowing(request, writable); - } - }), - writable = createFakeWritable(readable); - resolve({ prelude: readable }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); -}; exports.registerClientReference = function ( proxyImplementation, id, @@ -3087,3 +2972,40 @@ exports.renderToPipeableStream = function (model, webpackMap, options) { } }; }; +exports.unstable_prerenderToNodeStream = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 8efa31fbfdb04..020cc48c6a9c0 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 @@ -322,14 +322,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -742,8 +734,10 @@ ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; - type = createTask(this, model, null, !1, abortSet, null, null, null); - pingedTasks.push(type); + type = this.timeOrigin = performance.now(); + emitTimeOriginChunk(this, type + performance.timeOrigin); + model = createTask(this, model, null, !1, abortSet, null, null, null); + pingedTasks.push(model); } function noop() {} function resolveRequest() { @@ -772,21 +766,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - if ( - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id, task); - else { - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -818,24 +798,11 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id, reason); - else { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - } - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); + newTask.timed = !0; return newTask.id; } function serializeReadableStream(request, task, stream) { @@ -859,38 +826,21 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -954,40 +904,23 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest, reason), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -1069,6 +1002,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent( request, task, @@ -1101,12 +1099,16 @@ componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; outlineComponentInfo(request, componentDebugInfo); + task.timed = !0; + emitTimingChunk(request, componentDebugID, performance.now()); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && warnForMissingKey(request, key, componentDebugInfo, task.debugTask); } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = task.debugTask ? task.debugTask.run( componentStorage.run.bind( @@ -1134,74 +1136,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - validated = props; - validated.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === validated.status) return validated.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - validated = task.keyPath; - prevThenableState = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + validated = task.implicitSlot; null !== key - ? (task.keyPath = null === validated ? key : validated + "," + key) - : null === validated && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = validated; - task.implicitSlot = prevThenableState; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = validated; + return request; } function warnForMissingKey(request, key, componentDebugInfo, debugTask) { function logKeyError() { @@ -1411,6 +1360,7 @@ return task; } function pingTask(request, task) { + task.timed = !0; var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && @@ -1475,7 +1425,8 @@ }); return renderModel(request, task, parent, parentPropertyName, value); }, - thenableState: null + thenableState: null, + timed: !1 }; task.environmentName = request.environmentName(); task.debugOwner = debugOwner; @@ -1647,38 +1598,21 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - request.type === PRERENDER - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id, reason), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - request.type === PRERENDER - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest, reason), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + request.type === PRERENDER + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -1726,45 +1660,42 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks, - task.debugOwner, - task.debugStack, - task.debugTask - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent - ? serializeLazyID(request.id) - : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value, key), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } + if ( + "object" === typeof key && + null !== key && + "function" === typeof key.then + ) + return ( + (request = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks, + task.debugOwner, + task.debugStack, + task.debugTask + )), + (value = request.ping), + key.then(value, value), + (request.thenableState = getThenableStateAfterSuspending()), + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + parent + ? serializeLazyID(request.id) + : serializeByValueID(request.id) + ); task.keyPath = prevKeyPath; task.implicitSlot = prevImplicitSlot; request.pendingChunks++; prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task, key); + "object" === typeof key && + null !== key && + key.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, key.message, task), + emitPostponeChunk(request, prevKeyPath, key)) + : ((task = logRecoverableError(request, key, task)), + emitErrorChunk(request, prevKeyPath, task, key)); return parent ? serializeLazyID(prevKeyPath) : serializeByValueID(prevKeyPath); @@ -2535,12 +2466,24 @@ } request.completedRegularChunks.push(":W" + json + "\n"); } + function emitTimeOriginChunk(request, timeOrigin) { + request.pendingChunks++; + request.completedRegularChunks.push(":N" + timeOrigin + "\n"); + } function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" === typeof debugInfo[i].time + ? emitTimingChunk(request, id, debugInfo[i].time) + : ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); + } + function emitTimingChunk(request, id, timestamp) { + request.pendingChunks++; + timestamp -= request.timeOrigin; + id = id.toString(16) + ':D{"time":' + timestamp + "}\n"; + request.completedRegularChunks.push(id); } function emitChunk(request, task, value) { var id = task.id; @@ -2577,6 +2520,22 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + task.timed && emitTimingChunk(request, task.id, performance.now()); + request.abortableTasks.delete(task); + task.status = ERRORED$1; + if ( + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ) + logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id, error); + else { + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2595,22 +2554,19 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + task.timed && emitTimingChunk(request, task.id, performance.now()); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2632,26 +2588,16 @@ thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = PENDING$1; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id, x); - return; - } - } - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = PENDING$1; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2695,6 +2641,7 @@ function abortTask(task, request, errorId) { task.status !== RENDERING && ((task.status = ABORTED), + task.timed && emitTimingChunk(request, task.id, performance.now()), (errorId = serializeByValueID(errorId)), (task = encodeReferenceChunk(request, task.id, errorId)), request.completedErrorChunks.push(task)); @@ -2801,29 +2748,25 @@ 11 >= request.status && (request.status = ABORTING); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (request.type === PRERENDER) + abortableTasks.forEach(function (task) { + task.status !== RENDERING && + ((task.status = ABORTED), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ( - (logPostpone(request, reason.message, null), - request.type === PRERENDER) - ) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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( @@ -2836,21 +2779,14 @@ "The render was aborted by the server with a promise." ) : reason, - digest = logRecoverableError(request, error, null); - if (request.type === PRERENDER) - abortableTasks.forEach(function (task) { - task.status !== RENDERING && - ((task.status = ABORTED), request.pendingChunks--); - }); - else { - var _errorId2 = request.nextChunkId++; - request.fatalError = _errorId2; - request.pendingChunks++; - emitErrorChunk(request, _errorId2, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, _errorId2); - }); - } + digest = logRecoverableError(request, error, null), + _errorId2 = request.nextChunkId++; + request.fatalError = _errorId2; + request.pendingChunks++; + emitErrorChunk(request, _errorId2, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, _errorId2); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -4173,12 +4109,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_146 = []; + var JSCompiler_object_inline_chunks_153 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_146.push(chunk); + JSCompiler_object_inline_chunks_153.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_146, { + var blob = new Blob(JSCompiler_object_inline_chunks_153, { type: mimeType }); response._formData.append(name, blob, filename); @@ -4202,43 +4138,6 @@ }); return getChunk(response, 0); }; - exports.prerenderToNodeStream = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - PRERENDER, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - options ? options.environmentName : void 0, - options ? options.filterStackFrame : void 0, - function () { - var readable = new stream.Readable({ - read: function () { - startFlowing(request, writable); - } - }), - writable = createFakeWritable(readable); - resolve({ prelude: readable }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); - }; exports.registerClientReference = function ( proxyImplementation, id, @@ -4305,4 +4204,45 @@ } }; }; + exports.unstable_prerenderToNodeStream = function ( + model, + webpackMap, + options + ) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); + }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js index a0fbe07a705c3..f3c8b2a9c5d72 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 @@ -823,19 +823,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = thenable.reason), - "object" === typeof task && - null !== task && - task.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, task.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((task = logRecoverableError(request, task, null)), - emitErrorChunk(request, newTask.id, task)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -868,16 +856,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ("object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ? (logPostpone(request, reason.message, newTask), - emitPostponeChunk(request, newTask.id)) - : ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason)), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -898,43 +877,26 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -989,45 +951,28 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$10) { - error(x$10); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, streamTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, streamTask.id), - enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, streamTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, streamTask.id, digest), - enqueueFlush(request)); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1079,63 +1024,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$11 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$11[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1231,7 +1170,79 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { return pingTask(request, task); }, toJSON: function (parentPropertyName, value) { - return renderModel(request, task, this, parentPropertyName, value); + var prevKeyPath = task.keyPath, + prevImplicitSlot = task.implicitSlot; + try { + var JSCompiler_inline_result = renderModelDestructive( + request, + task, + this, + parentPropertyName, + value + ); + } catch (thrownValue) { + if ( + ((parentPropertyName = task.model), + (parentPropertyName = + "object" === typeof parentPropertyName && + null !== parentPropertyName && + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE || + parentPropertyName.$$typeof === REACT_LAZY_TYPE)), + 12 === request.status) + ) + (task.status = 3), + 21 === request.type + ? ((prevKeyPath = request.nextChunkId++), + (prevKeyPath = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)), + (JSCompiler_inline_result = prevKeyPath)) + : ((prevKeyPath = request.fatalError), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath))); + else if ( + ((value = + thrownValue === SuspenseException + ? getSuspendedThenable() + : thrownValue), + "object" === typeof value && + null !== value && + "function" === typeof value.then) + ) { + JSCompiler_inline_result = createTask( + request, + task.model, + task.keyPath, + task.implicitSlot, + request.abortableTasks + ); + var ping = JSCompiler_inline_result.ping; + value.then(ping, ping); + JSCompiler_inline_result.thenableState = + getThenableStateAfterSuspending(); + task.keyPath = prevKeyPath; + task.implicitSlot = prevImplicitSlot; + JSCompiler_inline_result = parentPropertyName + ? "$L" + JSCompiler_inline_result.id.toString(16) + : serializeByValueID(JSCompiler_inline_result.id); + } else + (task.keyPath = prevKeyPath), + (task.implicitSlot = prevImplicitSlot), + request.pendingChunks++, + (prevKeyPath = request.nextChunkId++), + "object" === typeof value && + null !== value && + value.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, value.message, task), + emitPostponeChunk(request, prevKeyPath)) + : ((prevImplicitSlot = logRecoverableError(request, value, task)), + emitErrorChunk(request, prevKeyPath, prevImplicitSlot)), + (JSCompiler_inline_result = parentPropertyName + ? "$L" + prevKeyPath.toString(16) + : serializeByValueID(prevKeyPath)); + } + return JSCompiler_inline_result; }, thenableState: null }; @@ -1241,9 +1252,6 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) { function serializeByValueID(id) { return "$" + id.toString(16); } -function serializeLazyID(id) { - return "$L" + id.toString(16); -} function encodeReferenceChunk(request, id, reference) { request = stringify(reference); return id.toString(16) + ":" + request + "\n"; @@ -1261,7 +1269,7 @@ function serializeClientReference( existingId = writtenClientReferences.get(clientReferenceKey); if (void 0 !== existingId) return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(existingId) + ? "$L" + existingId.toString(16) : serializeByValueID(existingId); try { var config = request.bundlerConfig, @@ -1298,7 +1306,7 @@ function serializeClientReference( request.completedImportChunks.push(processedChunk); writtenClientReferences.set(clientReferenceKey, importId); return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName - ? serializeLazyID(importId) + ? "$L" + importId.toString(16) : serializeByValueID(importId); } catch (x) { return ( @@ -1334,37 +1342,21 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - if ( - "object" === typeof reason && - null !== reason && - reason.$$typeof === REACT_POSTPONE_TYPE - ) - logPostpone(request, reason.message, newTask), - 21 === request.type - ? request.pendingChunks-- - : (emitPostponeChunk(request, newTask.id), enqueueFlush(request)); - else { - var digest = logRecoverableError(request, reason, newTask); - 21 === request.type - ? request.pendingChunks-- - : (emitErrorChunk(request, newTask.id, digest), - enqueueFlush(request)); - } - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + 21 === request.type + ? request.pendingChunks-- + : (erroredTask(request, newTask, reason), enqueueFlush(request)), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1375,70 +1367,6 @@ function serializeBlob(request, blob) { return "$B" + newTask.id.toString(16); } var modelRoot = !1; -function renderModel(request, task, parent, key, value) { - var prevKeyPath = task.keyPath, - prevImplicitSlot = task.implicitSlot; - try { - return renderModelDestructive(request, task, parent, key, value); - } catch (thrownValue) { - parent = task.model; - parent = - "object" === typeof parent && - null !== parent && - (parent.$$typeof === REACT_ELEMENT_TYPE || - parent.$$typeof === REACT_LAZY_TYPE); - if (12 === request.status) { - task.status = 3; - if (21 === request.type) - return ( - (task = request.nextChunkId++), - (task = parent ? serializeLazyID(task) : serializeByValueID(task)), - task - ); - task = request.fatalError; - return parent ? serializeLazyID(task) : serializeByValueID(task); - } - key = - thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof key && null !== key) { - if ("function" === typeof key.then) - return ( - (request = createTask( - request, - task.model, - task.keyPath, - task.implicitSlot, - request.abortableTasks - )), - (value = request.ping), - key.then(value, value), - (request.thenableState = getThenableStateAfterSuspending()), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(request.id) : serializeByValueID(request.id) - ); - if (key.$$typeof === REACT_POSTPONE_TYPE) - return ( - request.pendingChunks++, - (value = request.nextChunkId++), - logPostpone(request, key.message, task), - emitPostponeChunk(request, value), - (task.keyPath = prevKeyPath), - (task.implicitSlot = prevImplicitSlot), - parent ? serializeLazyID(value) : serializeByValueID(value) - ); - } - task.keyPath = prevKeyPath; - task.implicitSlot = prevImplicitSlot; - request.pendingChunks++; - prevKeyPath = request.nextChunkId++; - task = logRecoverableError(request, key, task); - emitErrorChunk(request, prevKeyPath, task); - return parent - ? serializeLazyID(prevKeyPath) - : serializeByValueID(prevKeyPath); - } -} function renderModelDestructive( request, task, @@ -1863,6 +1791,17 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + "object" === typeof error && + null !== error && + error.$$typeof === REACT_POSTPONE_TYPE + ? (logPostpone(request, error.message, task), + emitPostponeChunk(request, task.id)) + : ((error = logRecoverableError(request, error, task)), + emitErrorChunk(request, task.id, error)); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1905,26 +1844,16 @@ function retryTask(request, task) { thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue; - if ("object" === typeof x && null !== x) { - if ("function" === typeof x.then) { - task.status = 0; - task.thenableState = getThenableStateAfterSuspending(); - var ping = task.ping; - x.then(ping, ping); - return; - } - if (x.$$typeof === REACT_POSTPONE_TYPE) { - request.abortableTasks.delete(task); - task.status = 4; - logPostpone(request, x.message, task); - emitPostponeChunk(request, task.id); - return; - } - } - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); + if ( + "object" === typeof x && + null !== x && + "function" === typeof x.then + ) { + task.status = 0; + task.thenableState = getThenableStateAfterSuspending(); + var ping = task.ping; + x.then(ping, ping); + } else erroredTask(request, task, x); } } finally { } @@ -2064,25 +1993,24 @@ function abort(request, reason) { 11 >= request.status && (request.status = 12); var abortableTasks = request.abortableTasks; if (0 < abortableTasks.size) { - if ( + if (21 === request.type) + abortableTasks.forEach(function (task) { + 5 !== task.status && ((task.status = 3), request.pendingChunks--); + }); + else if ( "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE - ) - if ((logPostpone(request, reason.message, null), 21 === request.type)) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId = request.nextChunkId++; - request.fatalError = errorId; - request.pendingChunks++; - emitPostponeChunk(request, errorId, reason); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId); - }); - } - else { + ) { + 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.") @@ -2091,20 +2019,14 @@ function abort(request, reason) { "function" === typeof reason.then ? Error("The render was aborted by the server with a promise.") : reason, - digest = logRecoverableError(request, error, null); - if (21 === request.type) - abortableTasks.forEach(function (task) { - 5 !== task.status && ((task.status = 3), request.pendingChunks--); - }); - else { - var errorId$27 = request.nextChunkId++; - request.fatalError = errorId$27; - request.pendingChunks++; - emitErrorChunk(request, errorId$27, digest, error); - abortableTasks.forEach(function (task) { - return abortTask(task, request, errorId$27); - }); - } + digest = logRecoverableError(request, error, null), + errorId$25 = request.nextChunkId++; + request.fatalError = errorId$25; + request.pendingChunks++; + emitErrorChunk(request, errorId$25, digest, error); + abortableTasks.forEach(function (task) { + return abortTask(task, request, errorId$25); + }); } abortableTasks.clear(); var onAllReady = request.onAllReady; @@ -2112,7 +2034,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$28 = + var error$26 = "object" === typeof reason && null !== reason && reason.$$typeof === REACT_POSTPONE_TYPE @@ -2125,14 +2047,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$28); + return callback(error$26); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$29) { - logRecoverableError(request, error$29, null), fatalError(request, error$29); + } catch (error$27) { + logRecoverableError(request, error$27, null), fatalError(request, error$27); } } function resolveServerReference(bundlerConfig, id) { @@ -2543,8 +2465,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$32 = createPendingChunk(response); - chunk$32.then( + var chunk$30 = createPendingChunk(response); + chunk$30.then( function (v) { return controller.enqueue(v); }, @@ -2552,10 +2474,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$32; + previousBlockedChunk = chunk$30; chunk.then(function () { - previousBlockedChunk === chunk$32 && (previousBlockedChunk = null); - resolveModelChunk(chunk$32, json, -1); + previousBlockedChunk === chunk$30 && (previousBlockedChunk = null); + resolveModelChunk(chunk$30, json, -1); }); } }, @@ -2926,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_232 = []; + var JSCompiler_object_inline_chunks_234 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_232.push(chunk); + JSCompiler_object_inline_chunks_234.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_232, { + var blob = new Blob(JSCompiler_object_inline_chunks_234, { type: mimeType }); response._formData.append(name, blob, filename); @@ -2951,43 +2873,6 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { }); return getChunk(response, 0); }; -exports.prerenderToNodeStream = function (model, webpackMap, options) { - return new Promise(function (resolve, reject) { - var request = new RequestInstance( - 21, - model, - webpackMap, - options ? options.onError : void 0, - options ? options.identifierPrefix : void 0, - options ? options.onPostpone : void 0, - options ? options.temporaryReferences : void 0, - void 0, - void 0, - function () { - var readable = new stream.Readable({ - read: function () { - startFlowing(request, writable); - } - }), - writable = createFakeWritable(readable); - resolve({ prelude: readable }); - }, - reject - ); - if (options && options.signal) { - var signal = options.signal; - if (signal.aborted) abort(request, signal.reason); - else { - var listener = function () { - abort(request, signal.reason); - signal.removeEventListener("abort", listener); - }; - signal.addEventListener("abort", listener); - } - } - startWork(request); - }); -}; exports.registerClientReference = function ( proxyImplementation, id, @@ -3053,3 +2938,40 @@ exports.renderToPipeableStream = function (model, webpackMap, options) { } }; }; +exports.unstable_prerenderToNodeStream = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 a98f9cc6f41ed..301463e331991 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-7283a213-20241206", - "react-dom": "0.0.0-experimental-7283a213-20241206", + "react": "0.0.0-experimental-79ddf5b5-20241210", + "react-dom": "0.0.0-experimental-79ddf5b5-20241210", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.browser.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.browser.js index 7d514abd6bf71..8c8951a62b9ea 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.browser.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.browser.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.browser.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.edge.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.edge.js index a4ae48f55eb1b..975a4b5b87281 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.edge.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.edge.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.edge.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.js index dbc4179d3e788..6346a449d3b48 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.node.development.js'); } -if (s.prerenderToNodeStream) { - exports.prerenderToNodeStream = s.prerenderToNodeStream; +if (s.unstable_prerenderToNodeStream) { + exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream; } diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.unbundled.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.unbundled.js index 73c8a3b86e9c7..5df3d5bf7afbc 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.unbundled.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/static.node.unbundled.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.node.unbundled.development.js'); } -if (s.prerenderToNodeStream) { - exports.prerenderToNodeStream = s.prerenderToNodeStream; +if (s.unstable_prerenderToNodeStream) { + exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream; } 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 00858c952d25c..c86362c9e29a6 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 @@ -1943,7 +1943,8 @@ null === debugInfo.owner && null != response._debugRootOwner ? ((debugInfo.owner = response._debugRootOwner), (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2079,6 +2080,7 @@ case 84: resolveText(response, id, row); break; + case 78: case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); @@ -2465,10 +2467,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-7283a213-20241206", + version: "19.0.0-rc-79ddf5b5-20241210", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-7283a213-20241206", + reconcilerVersion: "19.0.0-rc-79ddf5b5-20241210", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 5b9ab1126ce22..20d401135674c 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 @@ -1407,6 +1407,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 f87ad308a69ac..c33732a68c4a5 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 @@ -2152,7 +2152,8 @@ null === debugInfo.owner && null != response._debugRootOwner ? ((debugInfo.owner = response._debugRootOwner), (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2288,6 +2289,7 @@ case 84: resolveText(response, id, row); break; + case 78: case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 7c655cdc9fc36..ef01d29c9de54 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 @@ -1570,6 +1570,7 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { ? chunk.reason.enqueueValue(buffer) : tag.set(id, new ReactPromise("fulfilled", buffer, null, response)); break; + case 78: case 68: case 87: throw Error( 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 255ac2b8e871d..5b7cfdc615c97 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 @@ -2152,7 +2152,8 @@ null === debugInfo.owner && null != response._debugRootOwner ? ((debugInfo.owner = response._debugRootOwner), (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2288,6 +2289,7 @@ case 84: resolveText(response, id, row); break; + case 78: case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 a674fe23f9ffa..c31fe5603c0a3 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 @@ -1573,6 +1573,7 @@ function processFullStringRow(response, id, tag, row) { ? chunk.reason.enqueueValue(row) : tag.set(id, new ReactPromise("fulfilled", row, null, response)); break; + case 78: case 68: case 87: 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 1994a5bdd891f..eb2c09bc4afdd 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 @@ -2114,7 +2114,8 @@ null === debugInfo.owner && null != response._debugRootOwner ? ((debugInfo.owner = response._debugRootOwner), (debugInfo.debugStack = response._debugRootStack)) - : initializeFakeStack(response, debugInfo); + : void 0 !== debugInfo.stack && + initializeFakeStack(response, debugInfo); response = getChunk(response, id); (response._debugInfo || (response._debugInfo = [])).push(debugInfo); } @@ -2250,6 +2251,7 @@ case 84: resolveText(response, id, row); break; + case 78: case 68: tag = new ReactPromise("resolved_model", row, null, response); initializeModelChunk(tag); 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 4eaf3b411e7c6..3d0e0d73fc247 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 @@ -1538,6 +1538,7 @@ function processFullStringRow(response, id, tag, row) { ? chunk.reason.enqueueValue(row) : tag.set(id, new ReactPromise("fulfilled", row, null, response)); break; + case 78: case 68: case 87: 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 ca4a687b22d86..a22ee4df919c2 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 @@ -293,14 +293,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -664,12 +656,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -699,13 +686,8 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -731,24 +713,20 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -810,26 +788,22 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -903,6 +877,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; @@ -925,7 +964,9 @@ emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = callComponentInDEV(Component, props, componentDebugInfo); if (request.status === ABORTING) throw ( @@ -936,76 +977,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - prevThenableState = props; - prevThenableState.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === prevThenableState.status) - return prevThenableState.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - prevThenableState = task.keyPath; - componentDebugID = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = - null === prevThenableState ? key : prevThenableState + "," + key) - : null === prevThenableState && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = prevThenableState; - task.implicitSlot = componentDebugID; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = prevThenableState; + return request; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { @@ -1354,24 +1340,20 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -2136,9 +2118,10 @@ function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" !== typeof debugInfo[i].time && + ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); } function emitChunk(request, task, value) { var id = task.id; @@ -2173,6 +2156,12 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = ERRORED$1; + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2191,22 +2180,18 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2231,12 +2216,7 @@ task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); - } + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2360,6 +2340,19 @@ destination && flushCompletedChunks(request, destination); })); } + function startFlowing(request, destination) { + if (request.status === CLOSING) + (request.status = CLOSED), + closeWithError(destination, request.fatalError); + else if (request.status !== CLOSED && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + } function abort(request, reason) { try { 11 >= request.status && (request.status = ABORTING); @@ -3741,21 +3734,7 @@ startWork(request); }, pull: function (controller) { - if (request.status === CLOSING) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.destination - ) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -3765,4 +3744,51 @@ { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 d6f8f4eb897de..bae08fa747799 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 @@ -777,13 +777,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = logRecoverableError(request, thenable.reason, null)), - emitErrorChunk(request, newTask.id, task), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -814,11 +808,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -839,29 +829,25 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -916,31 +902,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -993,63 +975,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$10 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$10[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1308,24 +1284,20 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1727,6 +1699,12 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + error = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, error); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1772,12 +1750,7 @@ function retryTask(request, task) { task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); - } + } else erroredTask(request, task, x); } } finally { } @@ -1866,6 +1839,18 @@ function enqueueFlush(request) { destination && flushCompletedChunks(request, destination); })); } +function startFlowing(request, destination) { + if (13 === request.status) + (request.status = 14), closeWithError(destination, request.fatalError); + else if (14 !== request.status && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } +} function abort(request, reason) { try { 11 >= request.status && (request.status = 12); @@ -1898,7 +1883,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$23 = + var error$22 = void 0 === reason ? Error("The render was aborted by the server without a reason.") : "object" === typeof reason && @@ -1907,14 +1892,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$23); + return callback(error$22); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error$23) { + logRecoverableError(request, error$23, null), fatalError(request, error$23); } } function resolveServerReference(bundlerConfig, id) { @@ -2368,8 +2353,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$27 = createPendingChunk(response); - chunk$27.then( + var chunk$26 = createPendingChunk(response); + chunk$26.then( function (v) { return controller.enqueue(v); }, @@ -2377,10 +2362,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$27; + previousBlockedChunk = chunk$26; chunk.then(function () { - previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); - resolveModelChunk(chunk$27, json, -1); + previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); + resolveModelChunk(chunk$26, json, -1); }); } }, @@ -2752,17 +2737,7 @@ exports.renderToReadableStream = function (model, webpackMap, options) { startWork(request); }, pull: function (controller) { - if (13 === request.status) - (request.status = 14), closeWithError(controller, request.fatalError); - else if (14 !== request.status && null === request.destination) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -2772,3 +2747,50 @@ exports.renderToReadableStream = function (model, webpackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 327d68f92cb75..598a29630c2be 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 @@ -295,14 +295,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -679,12 +671,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -714,13 +701,8 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -746,24 +728,20 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -825,26 +803,22 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -918,6 +892,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; @@ -940,7 +979,9 @@ emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = supportsComponentStorage ? componentStorage.run( componentDebugInfo, @@ -959,76 +1000,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - prevThenableState = props; - prevThenableState.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === prevThenableState.status) - return prevThenableState.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - prevThenableState = task.keyPath; - componentDebugID = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = - null === prevThenableState ? key : prevThenableState + "," + key) - : null === prevThenableState && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = prevThenableState; - task.implicitSlot = componentDebugID; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = prevThenableState; + return request; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { @@ -1377,24 +1363,20 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -2170,9 +2152,10 @@ function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" !== typeof debugInfo[i].time && + ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); } function emitChunk(request, task, value) { var id = task.id; @@ -2207,6 +2190,12 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = ERRORED$1; + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2225,22 +2214,18 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2265,12 +2250,7 @@ task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); - } + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -2398,6 +2378,19 @@ destination && flushCompletedChunks(request, destination); }, 0)); } + function startFlowing(request, destination) { + if (request.status === CLOSING) + (request.status = CLOSED), + closeWithError(destination, request.fatalError); + else if (request.status !== CLOSED && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } + } function abort(request, reason) { try { 11 >= request.status && (request.status = ABORTING); @@ -3782,21 +3775,7 @@ const setTimeoutOrImmediate = startWork(request); }, pull: function (controller) { - if (request.status === CLOSING) - (request.status = CLOSED), - closeWithError(controller, request.fatalError); - else if ( - request.status !== CLOSED && - null === request.destination - ) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -3806,4 +3785,51 @@ const setTimeoutOrImmediate = { highWaterMark: 0 } ); }; + exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(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 ea96d8fed58d1..448cde15bd766 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 @@ -782,13 +782,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = logRecoverableError(request, thenable.reason, null)), - emitErrorChunk(request, newTask.id, task), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -819,11 +813,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -844,29 +834,25 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -921,31 +907,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -998,63 +980,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$10 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$10[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1313,24 +1289,20 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1734,6 +1706,12 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + error = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, error); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1779,12 +1757,7 @@ function retryTask(request, task) { task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); - } + } else erroredTask(request, task, x); } } finally { } @@ -1877,6 +1850,18 @@ function enqueueFlush(request) { destination && flushCompletedChunks(request, destination); }, 0)); } +function startFlowing(request, destination) { + if (13 === request.status) + (request.status = 14), closeWithError(destination, request.fatalError); + else if (14 !== request.status && null === request.destination) { + request.destination = destination; + try { + flushCompletedChunks(request, destination); + } catch (error) { + logRecoverableError(request, error, null), fatalError(request, error); + } + } +} function abort(request, reason) { try { 11 >= request.status && (request.status = 12); @@ -1909,7 +1894,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$23 = + var error$22 = void 0 === reason ? Error("The render was aborted by the server without a reason.") : "object" === typeof reason && @@ -1918,14 +1903,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$23); + return callback(error$22); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error$23) { + logRecoverableError(request, error$23, null), fatalError(request, error$23); } } function resolveServerReference(bundlerConfig, id) { @@ -2370,8 +2355,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$27 = createPendingChunk(response); - chunk$27.then( + var chunk$26 = createPendingChunk(response); + chunk$26.then( function (v) { return controller.enqueue(v); }, @@ -2379,10 +2364,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$27; + previousBlockedChunk = chunk$26; chunk.then(function () { - previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); - resolveModelChunk(chunk$27, json, -1); + previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); + resolveModelChunk(chunk$26, json, -1); }); } }, @@ -2765,17 +2750,7 @@ exports.renderToReadableStream = function (model, webpackMap, options) { startWork(request); }, pull: function (controller) { - if (13 === request.status) - (request.status = 14), closeWithError(controller, request.fatalError); - else if (14 !== request.status && null === request.destination) { - request.destination = controller; - try { - flushCompletedChunks(request, controller); - } catch (error) { - logRecoverableError(request, error, null), - fatalError(request, error); - } - } + startFlowing(request, controller); }, cancel: function (reason) { request.destination = null; @@ -2785,3 +2760,50 @@ exports.renderToReadableStream = function (model, webpackMap, options) { { highWaterMark: 0 } ); }; +exports.unstable_prerender = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var stream = new ReadableStream( + { + type: "bytes", + start: function () { + startWork(request); + }, + pull: function (controller) { + startFlowing(request, controller); + }, + cancel: function (reason) { + request.destination = null; + abort(request, reason); + } + }, + { highWaterMark: 0 } + ); + resolve({ prelude: stream }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 3a99b36a06fa2..bbb22c00bebcc 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 @@ -322,14 +322,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -700,12 +692,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -735,13 +722,8 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -767,24 +749,20 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -846,26 +824,22 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -938,6 +912,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; @@ -960,7 +999,9 @@ emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = componentStorage.run( componentDebugInfo, callComponentInDEV, @@ -977,76 +1018,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - prevThenableState = props; - prevThenableState.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === prevThenableState.status) - return prevThenableState.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - prevThenableState = task.keyPath; - componentDebugID = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = - null === prevThenableState ? key : prevThenableState + "," + key) - : null === prevThenableState && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = prevThenableState; - task.implicitSlot = componentDebugID; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = prevThenableState; + return request; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { @@ -1393,24 +1379,20 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -2172,9 +2154,10 @@ function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" !== typeof debugInfo[i].time && + ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); } function emitChunk(request, task, value) { var id = task.id; @@ -2209,6 +2192,12 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = ERRORED$1; + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2227,22 +2216,18 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2267,12 +2252,7 @@ task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); - } + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -3222,7 +3202,21 @@ abort(request, Error(reason)); }; } - var util = require("util"); + function createFakeWritable(readable) { + return { + write: function (chunk) { + return readable.push(chunk); + }, + end: function () { + readable.push(null); + }, + destroy: function (error) { + readable.destroy(error); + } + }; + } + var stream = require("stream"), + util = require("util"); require("crypto"); var async_hooks = require("async_hooks"), ReactDOM = require("react-dom"), @@ -3757,12 +3751,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_140 = []; + var JSCompiler_object_inline_chunks_143 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_140.push(chunk); + JSCompiler_object_inline_chunks_143.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_140, { + var blob = new Blob(JSCompiler_object_inline_chunks_143, { type: mimeType }); response._formData.append(name, blob, filename); @@ -3852,4 +3846,45 @@ } }; }; + exports.unstable_prerenderToNodeStream = function ( + model, + webpackMap, + options + ) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); + }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js index 852cdf5d8359e..8aea800c7deaf 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 @@ -9,7 +9,8 @@ */ "use strict"; -var util = require("util"); +var stream = require("stream"), + util = require("util"); require("crypto"); var async_hooks = require("async_hooks"), ReactDOM = require("react-dom"), @@ -798,13 +799,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = logRecoverableError(request, thenable.reason, null)), - emitErrorChunk(request, newTask.id, task), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -835,11 +830,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -860,29 +851,25 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -937,31 +924,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1013,63 +996,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$10 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$10[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1326,24 +1303,20 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1738,6 +1711,12 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + error = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, error); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1783,12 +1762,7 @@ function retryTask(request, task) { task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); - } + } else erroredTask(request, task, x); } } finally { } @@ -1945,7 +1919,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$23 = + var error$22 = void 0 === reason ? Error("The render was aborted by the server without a reason.") : "object" === typeof reason && @@ -1954,14 +1928,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$23); + return callback(error$22); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error$23) { + logRecoverableError(request, error$23, null), fatalError(request, error$23); } } function resolveServerReference(bundlerConfig, id) { @@ -2406,8 +2380,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$27 = createPendingChunk(response); - chunk$27.then( + var chunk$26 = createPendingChunk(response); + chunk$26.then( function (v) { return controller.enqueue(v); }, @@ -2415,10 +2389,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$27; + previousBlockedChunk = chunk$26; chunk.then(function () { - previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); - resolveModelChunk(chunk$27, json, -1); + previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); + resolveModelChunk(chunk$26, json, -1); }); } }, @@ -2695,6 +2669,19 @@ function createCancelHandler(request, reason) { abort(request, Error(reason)); }; } +function createFakeWritable(readable) { + return { + write: function (chunk) { + return readable.push(chunk); + }, + end: function () { + readable.push(null); + }, + destroy: function (error) { + readable.destroy(error); + } + }; +} exports.createClientModuleProxy = function (moduleId) { moduleId = registerClientReferenceImpl({}, moduleId, !1); return new Proxy(moduleId, proxyHandlers$1); @@ -2776,12 +2763,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_215 = []; + var JSCompiler_object_inline_chunks_214 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_215.push(chunk); + JSCompiler_object_inline_chunks_214.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_215, { + var blob = new Blob(JSCompiler_object_inline_chunks_214, { type: mimeType }); response._formData.append(name, blob, filename); @@ -2866,3 +2853,40 @@ exports.renderToPipeableStream = function (model, webpackMap, options) { } }; }; +exports.unstable_prerenderToNodeStream = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 f418fdacd19ba..0e964e0978e57 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 @@ -322,14 +322,6 @@ suspendedThenable = null; return thenable; } - function prepareToUseHooksForComponent( - prevThenableState, - componentDebugInfo - ) { - thenableIndexCounter = 0; - thenableState = prevThenableState; - currentComponentDebugInfo = componentDebugInfo; - } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; @@ -700,12 +692,7 @@ newTask.id ); case "rejected": - task = thenable.reason; - var digest = logRecoverableError(request, task, null); - emitErrorChunk(request, newTask.id, digest, task); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - return newTask.id; + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (request.status === ABORTING) return ( @@ -735,13 +722,8 @@ pingTask(request, newTask); }, function (reason) { - if (newTask.status === PENDING$1) { - var _digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, _digest, reason); - newTask.status = ERRORED$1; - request.abortableTasks.delete(newTask); - enqueueFlush(request); - } + newTask.status === PENDING$1 && + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -767,24 +749,20 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -846,26 +824,22 @@ } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest, reason); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } var isIterator = iterable === iterator, streamTask = createTask( @@ -938,6 +912,71 @@ currentOwner = null; } } + function processServerComponentReturnValue( + request, + task, + Component, + result + ) { + if ( + "object" !== typeof result || + null === result || + isClientReference(result) + ) + return result; + if ("function" === typeof result.then) + return ( + result.then(function (resolvedValue) { + "object" === typeof resolvedValue && + null !== resolvedValue && + resolvedValue.$$typeof === REACT_ELEMENT_TYPE && + (resolvedValue._store.validated = 1); + }, voidHandler), + "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result) + ); + result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1); + var iteratorFn = getIteratorFn(result); + if (iteratorFn) { + var multiShot = _defineProperty({}, Symbol.iterator, function () { + var iterator = iteratorFn.call(result); + iterator !== result || + ("[object GeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object Generator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + }); + multiShot._debugInfo = result._debugInfo; + return multiShot; + } + return "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () { + var iterator = result[ASYNC_ITERATOR](); + iterator !== result || + ("[object AsyncGeneratorFunction]" === + Object.prototype.toString.call(Component) && + "[object AsyncGenerator]" === + Object.prototype.toString.call(result)) || + callWithDebugContextInDEV(request, task, function () { + console.error( + "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " + ); + }); + return iterator; + })), + (multiShot._debugInfo = result._debugInfo), + multiShot); + } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; @@ -960,7 +999,9 @@ emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } - prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); + thenableIndexCounter = 0; + thenableState = prevThenableState; + currentComponentDebugInfo = componentDebugInfo; props = componentStorage.run( componentDebugInfo, callComponentInDEV, @@ -977,76 +1018,21 @@ props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof props && - null !== props && - !isClientReference(props) - ) { - if ("function" === typeof props.then) { - prevThenableState = props; - prevThenableState.then(function (resolvedValue) { - "object" === typeof resolvedValue && - null !== resolvedValue && - resolvedValue.$$typeof === REACT_ELEMENT_TYPE && - (resolvedValue._store.validated = 1); - }, voidHandler); - if ("fulfilled" === prevThenableState.status) - return prevThenableState.value; - props = createLazyWrapperAroundWakeable(props); - } - var iteratorFn = getIteratorFn(props); - if (iteratorFn) { - var iterableChild = props; - props = _defineProperty({}, Symbol.iterator, function () { - var iterator = iteratorFn.call(iterableChild); - iterator !== iterableChild || - ("[object GeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object Generator]" === - Object.prototype.toString.call(iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = iterableChild._debugInfo; - } else if ( - "function" !== typeof props[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - props instanceof ReadableStream) - ) - props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); - else { - var _iterableChild = props; - props = _defineProperty({}, ASYNC_ITERATOR, function () { - var iterator = _iterableChild[ASYNC_ITERATOR](); - iterator !== _iterableChild || - ("[object AsyncGeneratorFunction]" === - Object.prototype.toString.call(Component) && - "[object AsyncGenerator]" === - Object.prototype.toString.call(_iterableChild)) || - callWithDebugContextInDEV(request, task, function () { - console.error( - "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. " - ); - }); - return iterator; - }); - props._debugInfo = _iterableChild._debugInfo; - } - } - prevThenableState = task.keyPath; - componentDebugID = task.implicitSlot; + props = processServerComponentReturnValue( + request, + task, + Component, + props + ); + Component = task.keyPath; + prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = - null === prevThenableState ? key : prevThenableState + "," + key) - : null === prevThenableState && (task.implicitSlot = !0); - key = renderModelDestructive(request, task, emptyRoot, "", props); - task.keyPath = prevThenableState; - task.implicitSlot = componentDebugID; - return key; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; + task.implicitSlot = prevThenableState; + return request; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { @@ -1393,24 +1379,20 @@ ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest, reason); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask( @@ -2172,9 +2154,10 @@ function forwardDebugInfo(request, id, debugInfo) { for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, - "string" === typeof debugInfo[i].name && - outlineComponentInfo(request, debugInfo[i]), - emitDebugChunk(request, id, debugInfo[i]); + "number" !== typeof debugInfo[i].time && + ("string" === typeof debugInfo[i].name && + outlineComponentInfo(request, debugInfo[i]), + emitDebugChunk(request, id, debugInfo[i])); } function emitChunk(request, task, value) { var id = task.id; @@ -2209,6 +2192,12 @@ : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } + function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = ERRORED$1; + var digest = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, digest, error); + } function retryTask(request, task) { if (task.status === PENDING$1) { var prevDebugID = debugID; @@ -2227,22 +2216,18 @@ modelRoot = resolvedModel; task.keyPath = null; task.implicitSlot = !1; - if ("object" === typeof resolvedModel && null !== resolvedModel) { + var currentEnv = (0, request.environmentName)(); + currentEnv !== task.environmentName && + (request.pendingChunks++, + emitDebugChunk(request, task.id, { env: currentEnv })); + if ("object" === typeof resolvedModel && null !== resolvedModel) request.writtenObjects.set( resolvedModel, serializeByValueID(task.id) - ); - var currentEnv = (0, request.environmentName)(); - currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: currentEnv })); - emitChunk(request, task, resolvedModel); - } else { - var json = stringify(resolvedModel), - _currentEnv = (0, request.environmentName)(); - _currentEnv !== task.environmentName && - (request.pendingChunks++, - emitDebugChunk(request, task.id, { env: _currentEnv })); + ), + emitChunk(request, task, resolvedModel); + else { + var json = stringify(resolvedModel); emitModelChunk(request, task.id, json); } request.abortableTasks.delete(task); @@ -2267,12 +2252,7 @@ task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = ERRORED$1; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest, x); - } + } else erroredTask(request, task, x); } } finally { debugID = prevDebugID; @@ -3185,7 +3165,21 @@ abort(request, Error(reason)); }; } - var util = require("util"); + function createFakeWritable(readable) { + return { + write: function (chunk) { + return readable.push(chunk); + }, + end: function () { + readable.push(null); + }, + destroy: function (error) { + readable.destroy(error); + } + }; + } + var stream = require("stream"), + util = require("util"); require("crypto"); var async_hooks = require("async_hooks"), ReactDOM = require("react-dom"), @@ -3720,12 +3714,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_140 = []; + var JSCompiler_object_inline_chunks_143 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_140.push(chunk); + JSCompiler_object_inline_chunks_143.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_140, { + var blob = new Blob(JSCompiler_object_inline_chunks_143, { type: mimeType }); response._formData.append(name, blob, filename); @@ -3815,4 +3809,45 @@ } }; }; + exports.unstable_prerenderToNodeStream = function ( + model, + webpackMap, + options + ) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + PRERENDER, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + options ? options.environmentName : void 0, + options ? options.filterStackFrame : void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); + }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js index 0fb8fee8366de..9b7764b4165bc 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 @@ -9,7 +9,8 @@ */ "use strict"; -var util = require("util"); +var stream = require("stream"), + util = require("util"); require("crypto"); var async_hooks = require("async_hooks"), ReactDOM = require("react-dom"), @@ -798,13 +799,7 @@ function serializeThenable(request, task, thenable) { (newTask.model = thenable.value), pingTask(request, newTask), newTask.id ); case "rejected": - return ( - (task = logRecoverableError(request, thenable.reason, null)), - emitErrorChunk(request, newTask.id, task), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - newTask.id - ); + return erroredTask(request, newTask, thenable.reason), newTask.id; default: if (12 === request.status) return ( @@ -835,11 +830,7 @@ function serializeThenable(request, task, thenable) { }, function (reason) { 0 === newTask.status && - ((reason = logRecoverableError(request, reason, newTask)), - emitErrorChunk(request, newTask.id, reason), - (newTask.status = 4), - request.abortableTasks.delete(newTask), - enqueueFlush(request)); + (erroredTask(request, newTask, reason), enqueueFlush(request)); } ); return newTask.id; @@ -860,29 +851,25 @@ function serializeReadableStream(request, task, stream) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), reader.read().then(progress, error); - } catch (x$8) { - error(x$8); + } catch (x$7) { + error(x$7); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortStream(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortStream); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortStream), + erroredTask(request, streamTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) @@ -937,31 +924,27 @@ function serializeAsyncIterable(request, task, iterable, iterator) { emitChunk(request, streamTask, streamTask.model), enqueueFlush(request), iterator.next().then(progress, error); - } catch (x$9) { - error(x$9); + } catch (x$8) { + error(x$8); } } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } function abortIterable(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortIterable); - var digest = logRecoverableError(request, reason, streamTask); - emitErrorChunk(request, streamTask.id, digest); - enqueueFlush(request); + aborted || + ((aborted = !0), + request.abortListeners.delete(abortIterable), + erroredTask(request, streamTask, reason), + enqueueFlush(request), "function" === typeof iterator.throw && - iterator.throw(reason).then(error, error); - } + iterator.throw(reason).then(error, error)); } iterable = iterable === iterator; var streamTask = createTask( @@ -1013,63 +996,57 @@ function createLazyWrapperAroundWakeable(wakeable) { return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; } function voidHandler() {} +function processServerComponentReturnValue(request, task, Component, result) { + if ( + "object" !== typeof result || + null === result || + result.$$typeof === CLIENT_REFERENCE_TAG$1 + ) + return result; + if ("function" === typeof result.then) + return "fulfilled" === result.status + ? result.value + : createLazyWrapperAroundWakeable(result); + var iteratorFn = getIteratorFn(result); + return iteratorFn + ? ((request = {}), + (request[Symbol.iterator] = function () { + return iteratorFn.call(result); + }), + request) + : "function" !== typeof result[ASYNC_ITERATOR] || + ("function" === typeof ReadableStream && + result instanceof ReadableStream) + ? result + : ((request = {}), + (request[ASYNC_ITERATOR] = function () { + return result[ASYNC_ITERATOR](); + }), + request); +} function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; thenableIndexCounter = 0; thenableState = prevThenableState; - Component = Component(props, void 0); + props = Component(props, void 0); if (12 === request.status) throw ( - ("object" === typeof Component && - null !== Component && - "function" === typeof Component.then && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 && - Component.then(voidHandler, voidHandler), + ("object" === typeof props && + null !== props && + "function" === typeof props.then && + props.$$typeof !== CLIENT_REFERENCE_TAG$1 && + props.then(voidHandler, voidHandler), null) ); - if ( - "object" === typeof Component && - null !== Component && - Component.$$typeof !== CLIENT_REFERENCE_TAG$1 - ) { - if ("function" === typeof Component.then) { - props = Component; - if ("fulfilled" === props.status) return props.value; - Component = createLazyWrapperAroundWakeable(Component); - } - var iteratorFn = getIteratorFn(Component); - if (iteratorFn) { - var iterableChild = Component; - Component = {}; - Component = - ((Component[Symbol.iterator] = function () { - return iteratorFn.call(iterableChild); - }), - Component); - } else if ( - !( - "function" !== typeof Component[ASYNC_ITERATOR] || - ("function" === typeof ReadableStream && - Component instanceof ReadableStream) - ) - ) { - var iterableChild$10 = Component; - Component = {}; - Component = - ((Component[ASYNC_ITERATOR] = function () { - return iterableChild$10[ASYNC_ITERATOR](); - }), - Component); - } - } - props = task.keyPath; + props = processServerComponentReturnValue(request, task, Component, props); + Component = task.keyPath; prevThenableState = task.implicitSlot; null !== key - ? (task.keyPath = null === props ? key : props + "," + key) - : null === props && (task.implicitSlot = !0); - request = renderModelDestructive(request, task, emptyRoot, "", Component); - task.keyPath = props; + ? (task.keyPath = null === Component ? key : Component + "," + key) + : null === Component && (task.implicitSlot = !0); + request = renderModelDestructive(request, task, emptyRoot, "", props); + task.keyPath = Component; task.implicitSlot = prevThenableState; return request; } @@ -1326,24 +1303,20 @@ function serializeBlob(request, blob) { ); } function error(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } function abortBlob(reason) { - if (!aborted) { - aborted = !0; - request.abortListeners.delete(abortBlob); - var digest = logRecoverableError(request, reason, newTask); - emitErrorChunk(request, newTask.id, digest); - enqueueFlush(request); - reader.cancel(reason).then(error, error); - } + aborted || + ((aborted = !0), + request.abortListeners.delete(abortBlob), + erroredTask(request, newTask, reason), + enqueueFlush(request), + reader.cancel(reason).then(error, error)); } var model = [blob.type], newTask = createTask(request, model, null, !1, request.abortableTasks), @@ -1738,6 +1711,12 @@ function emitChunk(request, task, value) { : ((value = stringify(value, task.toJSON)), emitModelChunk(request, task.id, value)); } +function erroredTask(request, task, error) { + request.abortableTasks.delete(task); + task.status = 4; + error = logRecoverableError(request, error, task); + emitErrorChunk(request, task.id, error); +} var emptyRoot = {}; function retryTask(request, task) { if (0 === task.status) { @@ -1783,12 +1762,7 @@ function retryTask(request, task) { task.thenableState = getThenableStateAfterSuspending(); var ping = task.ping; x.then(ping, ping); - } else { - request.abortableTasks.delete(task); - task.status = 4; - var digest = logRecoverableError(request, x, task); - emitErrorChunk(request, task.id, digest); - } + } else erroredTask(request, task, x); } } finally { } @@ -1945,7 +1919,7 @@ function abort(request, reason) { } var abortListeners = request.abortListeners; if (0 < abortListeners.size) { - var error$23 = + var error$22 = void 0 === reason ? Error("The render was aborted by the server without a reason.") : "object" === typeof reason && @@ -1954,14 +1928,14 @@ function abort(request, reason) { ? Error("The render was aborted by the server with a promise.") : reason; abortListeners.forEach(function (callback) { - return callback(error$23); + return callback(error$22); }); abortListeners.clear(); } null !== request.destination && flushCompletedChunks(request, request.destination); - } catch (error$24) { - logRecoverableError(request, error$24, null), fatalError(request, error$24); + } catch (error$23) { + logRecoverableError(request, error$23, null), fatalError(request, error$23); } } function resolveServerReference(bundlerConfig, id) { @@ -2372,8 +2346,8 @@ function parseReadableStream(response, reference, type) { (previousBlockedChunk = chunk)); } else { chunk = previousBlockedChunk; - var chunk$27 = createPendingChunk(response); - chunk$27.then( + var chunk$26 = createPendingChunk(response); + chunk$26.then( function (v) { return controller.enqueue(v); }, @@ -2381,10 +2355,10 @@ function parseReadableStream(response, reference, type) { return controller.error(e); } ); - previousBlockedChunk = chunk$27; + previousBlockedChunk = chunk$26; chunk.then(function () { - previousBlockedChunk === chunk$27 && (previousBlockedChunk = null); - resolveModelChunk(chunk$27, json, -1); + previousBlockedChunk === chunk$26 && (previousBlockedChunk = null); + resolveModelChunk(chunk$26, json, -1); }); } }, @@ -2661,6 +2635,19 @@ function createCancelHandler(request, reason) { abort(request, Error(reason)); }; } +function createFakeWritable(readable) { + return { + write: function (chunk) { + return readable.push(chunk); + }, + end: function () { + readable.push(null); + }, + destroy: function (error) { + readable.destroy(error); + } + }; +} exports.createClientModuleProxy = function (moduleId) { moduleId = registerClientReferenceImpl({}, moduleId, !1); return new Proxy(moduleId, proxyHandlers$1); @@ -2742,12 +2729,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_215 = []; + var JSCompiler_object_inline_chunks_214 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_215.push(chunk); + JSCompiler_object_inline_chunks_214.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_215, { + var blob = new Blob(JSCompiler_object_inline_chunks_214, { type: mimeType }); response._formData.append(name, blob, filename); @@ -2832,3 +2819,40 @@ exports.renderToPipeableStream = function (model, webpackMap, options) { } }; }; +exports.unstable_prerenderToNodeStream = function (model, webpackMap, options) { + return new Promise(function (resolve, reject) { + var request = new RequestInstance( + 21, + model, + webpackMap, + options ? options.onError : void 0, + options ? options.identifierPrefix : void 0, + options ? options.onPostpone : void 0, + options ? options.temporaryReferences : void 0, + void 0, + void 0, + function () { + var readable = new stream.Readable({ + read: function () { + startFlowing(request, writable); + } + }), + writable = createFakeWritable(readable); + resolve({ prelude: readable }); + }, + reject + ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(request, signal.reason); + else { + var listener = function () { + abort(request, signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } + startWork(request); + }); +}; 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 d62fd451d1fb8..2dd79f329d513 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.0.0-rc-7283a213-20241206", - "react-dom": "19.0.0-rc-7283a213-20241206", + "react": "19.0.0-rc-79ddf5b5-20241210", + "react-dom": "19.0.0-rc-79ddf5b5-20241210", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack/static.browser.js b/packages/next/src/compiled/react-server-dom-webpack/static.browser.js index 7d514abd6bf71..8c8951a62b9ea 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/static.browser.js +++ b/packages/next/src/compiled/react-server-dom-webpack/static.browser.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.browser.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-webpack/static.edge.js b/packages/next/src/compiled/react-server-dom-webpack/static.edge.js index a4ae48f55eb1b..975a4b5b87281 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/static.edge.js +++ b/packages/next/src/compiled/react-server-dom-webpack/static.edge.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.edge.development.js'); } -if (s.prerender) { - exports.prerender = s.prerender; +if (s.unstable_prerender) { + exports.unstable_prerender = s.unstable_prerender; } diff --git a/packages/next/src/compiled/react-server-dom-webpack/static.node.js b/packages/next/src/compiled/react-server-dom-webpack/static.node.js index dbc4179d3e788..6346a449d3b48 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/static.node.js +++ b/packages/next/src/compiled/react-server-dom-webpack/static.node.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.node.development.js'); } -if (s.prerenderToNodeStream) { - exports.prerenderToNodeStream = s.prerenderToNodeStream; +if (s.unstable_prerenderToNodeStream) { + exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream; } diff --git a/packages/next/src/compiled/react-server-dom-webpack/static.node.unbundled.js b/packages/next/src/compiled/react-server-dom-webpack/static.node.unbundled.js index 73c8a3b86e9c7..5df3d5bf7afbc 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/static.node.unbundled.js +++ b/packages/next/src/compiled/react-server-dom-webpack/static.node.unbundled.js @@ -7,6 +7,6 @@ if (process.env.NODE_ENV === 'production') { s = require('./cjs/react-server-dom-webpack-server.node.unbundled.development.js'); } -if (s.prerenderToNodeStream) { - exports.prerenderToNodeStream = s.prerenderToNodeStream; +if (s.unstable_prerenderToNodeStream) { + exports.unstable_prerenderToNodeStream = s.unstable_prerenderToNodeStream; } diff --git a/packages/next/src/compiled/react/cjs/react.development.js b/packages/next/src/compiled/react/cjs/react.development.js index 373032cfd07bb..781750eb63927 100644 --- a/packages/next/src/compiled/react/cjs/react.development.js +++ b/packages/next/src/compiled/react/cjs/react.development.js @@ -1518,7 +1518,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; "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 fef85d27527bd..29edd0c720398 100644 --- a/packages/next/src/compiled/react/cjs/react.production.js +++ b/packages/next/src/compiled/react/cjs/react.production.js @@ -540,4 +540,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; 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 e80f0362cbb13..8d8cf4630a0bc 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 @@ -1110,5 +1110,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-rc-7283a213-20241206"; + exports.version = "19.0.0-rc-79ddf5b5-20241210"; })(); 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 12ba7c78cdbff..7478d9d7e1ce6 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 @@ -423,4 +423,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-rc-7283a213-20241206"; +exports.version = "19.0.0-rc-79ddf5b5-20241210"; diff --git a/packages/next/src/compiled/unistore/unistore.js b/packages/next/src/compiled/unistore/unistore.js index 2190f19d388ac..d10036dfba50d 100644 --- a/packages/next/src/compiled/unistore/unistore.js +++ b/packages/next/src/compiled/unistore/unistore.js @@ -1 +1 @@ -(()=>{var t={485: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={730: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 Date: Mon, 16 Dec 2024 13:43:11 +0100 Subject: [PATCH 7/8] [Flight] prerender -> unstable_prerender --- packages/next/src/server/app-render/collect-segment-data.tsx | 2 +- packages/next/src/server/app-render/entry-base.ts | 2 +- packages/next/types/$$compiled.internal.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/next/src/server/app-render/collect-segment-data.tsx b/packages/next/src/server/app-render/collect-segment-data.tsx index 9c5591dd63195..f77008682c068 100644 --- a/packages/next/src/server/app-render/collect-segment-data.tsx +++ b/packages/next/src/server/app-render/collect-segment-data.tsx @@ -9,7 +9,7 @@ import type { ManifestNode } from '../../build/webpack/plugins/flight-manifest-p // eslint-disable-next-line import/no-extraneous-dependencies import { createFromReadableStream } from 'react-server-dom-webpack/client.edge' // eslint-disable-next-line import/no-extraneous-dependencies -import { prerender } from 'react-server-dom-webpack/static.edge' +import { unstable_prerender as prerender } from 'react-server-dom-webpack/static.edge' import { streamFromBuffer, diff --git a/packages/next/src/server/app-render/entry-base.ts b/packages/next/src/server/app-render/entry-base.ts index 65564ab93762f..bc0867feec51b 100644 --- a/packages/next/src/server/app-render/entry-base.ts +++ b/packages/next/src/server/app-render/entry-base.ts @@ -8,7 +8,7 @@ export { } from 'react-server-dom-webpack/server.edge' // eslint-disable-next-line import/no-extraneous-dependencies -export { prerender } from 'react-server-dom-webpack/static.edge' +export { unstable_prerender as prerender } from 'react-server-dom-webpack/static.edge' import LayoutRouter from '../../client/components/layout-router' import RenderFromTemplateContext from '../../client/components/render-from-template-context' diff --git a/packages/next/types/$$compiled.internal.d.ts b/packages/next/types/$$compiled.internal.d.ts index f6d135de6836f..7958e547bc936 100644 --- a/packages/next/types/$$compiled.internal.d.ts +++ b/packages/next/types/$$compiled.internal.d.ts @@ -210,7 +210,7 @@ declare module 'react-server-dom-webpack/server.node' { ): Promise } declare module 'react-server-dom-webpack/static.edge' { - export function prerender( + export function unstable_prerender( children: any, webpackMap: { readonly [id: string]: { From e0d8f1016aab0d207707fdf466d08fb792af0fd5 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Tue, 17 Dec 2024 09:53:06 +0100 Subject: [PATCH 8/8] Temporarily disable a test that's incompatible with experimental React --- .../dynamic-io.server-action.test.ts | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/test/e2e/app-dir/dynamic-io/dynamic-io.server-action.test.ts b/test/e2e/app-dir/dynamic-io/dynamic-io.server-action.test.ts index 6846bc58c5efa..dbbf29d6402ce 100644 --- a/test/e2e/app-dir/dynamic-io/dynamic-io.server-action.test.ts +++ b/test/e2e/app-dir/dynamic-io/dynamic-io.server-action.test.ts @@ -16,21 +16,29 @@ describe('dynamic-io', () => { }) }) - it('should not have dynamic IO errors when encoding bound args for inline server actions', async () => { - const browser = await next.browser('/server-action-inline') - expect(await browser.elementByCss('p').text()).toBe('initial') - await browser.elementByCss('button').click() - - await retry(async () => { - expect(await browser.elementByCss('p').text()).toBe('result') - }) - - expect(next.cliOutput).not.toMatch('Error: Route "/server-action-inline"') - - if (isNextDev) { - await assertNoRedbox(browser) + // TODO: Re-enable the test for PPR in dev mode when the issue is resolved + // where the inclusion of server timings in the RSC payload makes the + // serialized bound args not suitable to be used as a cache key. + /* eslint-disable jest/no-standalone-expect */ + ;(process.env.__NEXT_EXPERIMENTAL_PPR && isNextDev ? it.skip : it)( + 'should not have dynamic IO errors when encoding bound args for inline server actions', + async () => { + const browser = await next.browser('/server-action-inline') + expect(await browser.elementByCss('p').text()).toBe('initial') + await browser.elementByCss('button').click() + + await retry(async () => { + expect(await browser.elementByCss('p').text()).toBe('result') + }) + + expect(next.cliOutput).not.toMatch('Error: Route "/server-action-inline"') + + if (isNextDev) { + await assertNoRedbox(browser) + } } - }) + ) + /* eslint-enable jest/no-standalone-expect */ it('should prerender pages with inline server actions', async () => { let $ = await next.render$('/server-action-inline', {})