From 6a2f55513d60d732b75587624c0e6670f3167713 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Sat, 23 Nov 2024 06:34:17 +0100 Subject: [PATCH 01/82] refactor: move redirect helpers into separate module (#73118) --- .../next/src/client/components/app-router.tsx | 9 +--- .../client/components/is-next-router-error.ts | 2 +- .../components/navigation.react-server.ts | 3 +- .../client/components/redirect-boundary.tsx | 8 +-- .../src/client/components/redirect-error.ts | 45 +++++++++++++++++ .../src/client/components/redirect.test.ts | 4 +- .../next/src/client/components/redirect.ts | 50 +++---------------- .../reducers/server-action-reducer.ts | 3 +- .../src/server/app-render/action-handler.ts | 4 +- .../next/src/server/app-render/app-render.tsx | 2 +- .../make-get-server-inserted-html.tsx | 2 +- .../server/route-modules/app-route/module.ts | 4 +- 12 files changed, 71 insertions(+), 65 deletions(-) create mode 100644 packages/next/src/client/components/redirect-error.ts diff --git a/packages/next/src/client/components/app-router.tsx b/packages/next/src/client/components/app-router.tsx index 1bc1eb4a2e2e5..391b4f4cc9283 100644 --- a/packages/next/src/client/components/app-router.tsx +++ b/packages/next/src/client/components/app-router.tsx @@ -55,13 +55,8 @@ import { useNavFailureHandler } from './nav-failure-handler' import { useServerActionDispatcher } from '../app-call-server' import type { AppRouterActionQueue } from '../../shared/lib/router/action-queue' import { prefetch as prefetchWithSegmentCache } from '../components/segment-cache/prefetch' - -import { - getRedirectTypeFromError, - getURLFromRedirectError, - isRedirectError, - RedirectType, -} from './redirect' +import { getRedirectTypeFromError, getURLFromRedirectError } from './redirect' +import { isRedirectError, RedirectType } from './redirect-error' const globalMutable: { pendingMpaPath?: string diff --git a/packages/next/src/client/components/is-next-router-error.ts b/packages/next/src/client/components/is-next-router-error.ts index 284bbfffead97..537f8fbf9f892 100644 --- a/packages/next/src/client/components/is-next-router-error.ts +++ b/packages/next/src/client/components/is-next-router-error.ts @@ -2,7 +2,7 @@ import { isHTTPAccessFallbackError, type HTTPAccessFallbackError, } from './http-access-fallback/http-access-fallback' -import { isRedirectError, type RedirectError } from './redirect' +import { isRedirectError, type RedirectError } from './redirect-error' /** * Returns true if the error is a navigation signal error. These errors are diff --git a/packages/next/src/client/components/navigation.react-server.ts b/packages/next/src/client/components/navigation.react-server.ts index 33873cfba6a6a..5f767c8ef433e 100644 --- a/packages/next/src/client/components/navigation.react-server.ts +++ b/packages/next/src/client/components/navigation.react-server.ts @@ -26,7 +26,8 @@ class ReadonlyURLSearchParams extends URLSearchParams { } } -export { redirect, permanentRedirect, RedirectType } from './redirect' +export { redirect, permanentRedirect } from './redirect' +export { RedirectType } from './redirect-error' export { notFound } from './not-found' export { forbidden } from './forbidden' export { unauthorized } from './unauthorized' diff --git a/packages/next/src/client/components/redirect-boundary.tsx b/packages/next/src/client/components/redirect-boundary.tsx index 1f4c5cb88e718..03ea9553b40bf 100644 --- a/packages/next/src/client/components/redirect-boundary.tsx +++ b/packages/next/src/client/components/redirect-boundary.tsx @@ -2,12 +2,8 @@ import React, { useEffect } from 'react' import type { AppRouterInstance } from '../../shared/lib/app-router-context.shared-runtime' import { useRouter } from './navigation' -import { - RedirectType, - getRedirectTypeFromError, - getURLFromRedirectError, - isRedirectError, -} from './redirect' +import { getRedirectTypeFromError, getURLFromRedirectError } from './redirect' +import { RedirectType, isRedirectError } from './redirect-error' interface RedirectBoundaryProps { router: AppRouterInstance diff --git a/packages/next/src/client/components/redirect-error.ts b/packages/next/src/client/components/redirect-error.ts new file mode 100644 index 0000000000000..35589bdaa5311 --- /dev/null +++ b/packages/next/src/client/components/redirect-error.ts @@ -0,0 +1,45 @@ +import { RedirectStatusCode } from './redirect-status-code' + +export const REDIRECT_ERROR_CODE = 'NEXT_REDIRECT' + +export enum RedirectType { + push = 'push', + replace = 'replace', +} + +export type RedirectError = Error & { + digest: `${typeof REDIRECT_ERROR_CODE};${RedirectType};${string};${RedirectStatusCode};` +} + +/** + * Checks an error to determine if it's an error generated by the + * `redirect(url)` helper. + * + * @param error the error that may reference a redirect error + * @returns true if the error is a redirect error + */ +export function isRedirectError(error: unknown): error is RedirectError { + if ( + typeof error !== 'object' || + error === null || + !('digest' in error) || + typeof error.digest !== 'string' + ) { + return false + } + + const digest = error.digest.split(';') + const [errorCode, type] = digest + const destination = digest.slice(2, -2).join(';') + const status = digest.at(-2) + + const statusCode = Number(status) + + return ( + errorCode === REDIRECT_ERROR_CODE && + (type === 'replace' || type === 'push') && + typeof destination === 'string' && + !isNaN(statusCode) && + statusCode in RedirectStatusCode + ) +} diff --git a/packages/next/src/client/components/redirect.test.ts b/packages/next/src/client/components/redirect.test.ts index 8ca51b96e76a6..d443e8bd81c75 100644 --- a/packages/next/src/client/components/redirect.test.ts +++ b/packages/next/src/client/components/redirect.test.ts @@ -1,4 +1,6 @@ -import { getURLFromRedirectError, isRedirectError, redirect } from './redirect' +import { getURLFromRedirectError, redirect } from './redirect' +import { isRedirectError } from './redirect-error' + describe('test', () => { it('should throw a redirect error', () => { try { diff --git a/packages/next/src/client/components/redirect.ts b/packages/next/src/client/components/redirect.ts index 00946a27e6d69..4c1464143e5a3 100644 --- a/packages/next/src/client/components/redirect.ts +++ b/packages/next/src/client/components/redirect.ts @@ -1,16 +1,11 @@ import { actionAsyncStorage } from '../../server/app-render/action-async-storage.external' import { RedirectStatusCode } from './redirect-status-code' - -const REDIRECT_ERROR_CODE = 'NEXT_REDIRECT' - -export enum RedirectType { - push = 'push', - replace = 'replace', -} - -export type RedirectError = Error & { - digest: `${typeof REDIRECT_ERROR_CODE};${RedirectType};${string};${RedirectStatusCode};` -} +import { + RedirectType, + type RedirectError, + isRedirectError, + REDIRECT_ERROR_CODE, +} from './redirect-error' export function getRedirectError( url: string, @@ -68,39 +63,6 @@ export function permanentRedirect( throw getRedirectError(url, type, RedirectStatusCode.PermanentRedirect) } -/** - * Checks an error to determine if it's an error generated by the - * `redirect(url)` helper. - * - * @param error the error that may reference a redirect error - * @returns true if the error is a redirect error - */ -export function isRedirectError(error: unknown): error is RedirectError { - if ( - typeof error !== 'object' || - error === null || - !('digest' in error) || - typeof error.digest !== 'string' - ) { - return false - } - - const digest = error.digest.split(';') - const [errorCode, type] = digest - const destination = digest.slice(2, -2).join(';') - const status = digest.at(-2) - - const statusCode = Number(status) - - return ( - errorCode === REDIRECT_ERROR_CODE && - (type === 'replace' || type === 'push') && - typeof destination === 'string' && - !isNaN(statusCode) && - statusCode in RedirectStatusCode - ) -} - /** * Returns the encoded URL from the error if it's a RedirectError, null * otherwise. Note that this does not validate the URL returned. diff --git a/packages/next/src/client/components/router-reducer/reducers/server-action-reducer.ts b/packages/next/src/client/components/router-reducer/reducers/server-action-reducer.ts index 40567f37ea246..90dcaca64c382 100644 --- a/packages/next/src/client/components/router-reducer/reducers/server-action-reducer.ts +++ b/packages/next/src/client/components/router-reducer/reducers/server-action-reducer.ts @@ -47,7 +47,8 @@ import { normalizeFlightData, type NormalizedFlightData, } from '../../../flight-data-helpers' -import { getRedirectError, RedirectType } from '../../redirect' +import { getRedirectError } from '../../redirect' +import { RedirectType } from '../../redirect-error' import { createSeededPrefetchCacheEntry } from '../prefetch-cache-utils' import { removeBasePath } from '../../../remove-base-path' import { hasBasePath } from '../../../has-base-path' diff --git a/packages/next/src/server/app-render/action-handler.ts b/packages/next/src/server/app-render/action-handler.ts index 52c57280d07fe..35225d2334e25 100644 --- a/packages/next/src/server/app-render/action-handler.ts +++ b/packages/next/src/server/app-render/action-handler.ts @@ -18,9 +18,11 @@ import { import { getRedirectTypeFromError, getURLFromRedirectError, +} from '../../client/components/redirect' +import { isRedirectError, type RedirectType, -} from '../../client/components/redirect' +} from '../../client/components/redirect-error' import RenderResult from '../render-result' import type { WorkStore } from '../app-render/work-async-storage.external' import { FlightRenderResult } from './flight-render-result' diff --git a/packages/next/src/server/app-render/app-render.tsx b/packages/next/src/server/app-render/app-render.tsx index f98dd1f43ddb2..0a70918d33604 100644 --- a/packages/next/src/server/app-render/app-render.tsx +++ b/packages/next/src/server/app-render/app-render.tsx @@ -66,9 +66,9 @@ import { } from '../../client/components/http-access-fallback/http-access-fallback' import { getURLFromRedirectError, - isRedirectError, getRedirectStatusCodeFromError, } from '../../client/components/redirect' +import { isRedirectError } from '../../client/components/redirect-error' import { getImplicitTags } from '../lib/implicit-tags' import { AppRenderSpan, NextNodeServerSpan } from '../lib/trace/constants' import { getTracer } from '../lib/trace/tracer' diff --git a/packages/next/src/server/app-render/make-get-server-inserted-html.tsx b/packages/next/src/server/app-render/make-get-server-inserted-html.tsx index 42a2b9e36bdf8..8aa8f35804fc6 100644 --- a/packages/next/src/server/app-render/make-get-server-inserted-html.tsx +++ b/packages/next/src/server/app-render/make-get-server-inserted-html.tsx @@ -2,9 +2,9 @@ import React, { type JSX } from 'react' import { isHTTPAccessFallbackError } from '../../client/components/http-access-fallback/http-access-fallback' import { getURLFromRedirectError, - isRedirectError, getRedirectStatusCodeFromError, } from '../../client/components/redirect' +import { isRedirectError } from '../../client/components/redirect-error' import { renderToReadableStream } from 'react-dom/server.edge' import { streamToString } from '../stream-utils/node-web-streams-helper' import { RedirectStatusCode } from '../../client/components/redirect-status-code' diff --git a/packages/next/src/server/route-modules/app-route/module.ts b/packages/next/src/server/route-modules/app-route/module.ts index 0d90f2daf1976..0424c1f5c4f1b 100644 --- a/packages/next/src/server/route-modules/app-route/module.ts +++ b/packages/next/src/server/route-modules/app-route/module.ts @@ -71,9 +71,11 @@ import type { AppSegment } from '../../../build/segment-config/app/app-segments' import { getRedirectStatusCodeFromError, getURLFromRedirectError, +} from '../../../client/components/redirect' +import { isRedirectError, type RedirectError, -} from '../../../client/components/redirect' +} from '../../../client/components/redirect-error' import { getAccessFallbackHTTPStatus, isHTTPAccessFallbackError, From 6aaa51d9d6907d79266bf897dfbce27835a7821c Mon Sep 17 00:00:00 2001 From: Vercel Release Bot <88769842+vercel-release-bot@users.noreply.github.com> Date: Fri, 22 Nov 2024 21:39:26 -0800 Subject: [PATCH 02/82] Update font data (#73115) --- packages/font/src/google/font-data.json | 163 ++++++++++++-------- packages/font/src/google/index.ts | 189 ++++++++++++++++-------- 2 files changed, 234 insertions(+), 118 deletions(-) diff --git a/packages/font/src/google/font-data.json b/packages/font/src/google/font-data.json index 3b59f9c6d884c..62ce78a5bfc99 100644 --- a/packages/font/src/google/font-data.json +++ b/packages/font/src/google/font-data.json @@ -56,7 +56,7 @@ "Aclonica": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Acme": { "weights": ["400"], @@ -249,7 +249,7 @@ "Alef": { "weights": ["400", "700"], "styles": ["normal"], - "subsets": ["hebrew", "latin"] + "subsets": ["hebrew", "latin", "latin-ext"] }, "Alegreya": { "weights": ["400", "500", "600", "700", "800", "900", "variable"], @@ -860,7 +860,7 @@ "Annie Use Your Telescope": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Anonymous Pro": { "weights": ["400", "700"], @@ -976,7 +976,7 @@ "Architects Daughter": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Archivo": { "weights": [ @@ -1205,7 +1205,7 @@ "Atomic Age": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Aubrey": { "weights": ["400"], @@ -1640,7 +1640,7 @@ "Bentham": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Berkshire Swash": { "weights": ["400"], @@ -2627,7 +2627,7 @@ "Cinzel Decorative": { "weights": ["400", "700", "900"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Clicker Script": { "weights": ["400"], @@ -2895,7 +2895,7 @@ "Covered By Your Grace": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Crafty Girls": { "weights": ["400"], @@ -2948,7 +2948,7 @@ "Crushed": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Cuprum": { "weights": ["400", "500", "600", "700", "variable"], @@ -3354,6 +3354,19 @@ ], "subsets": ["devanagari", "greek", "greek-ext", "latin", "latin-ext"] }, + "Edu AU VIC WA NT Arrows": { + "weights": ["400", "500", "600", "700", "variable"], + "styles": ["normal"], + "axes": [ + { + "tag": "wght", + "min": 400, + "max": 700, + "defaultValue": 400 + } + ], + "subsets": ["latin", "latin-ext"] + }, "Edu AU VIC WA NT Dots": { "weights": ["400", "500", "600", "700", "variable"], "styles": ["normal"], @@ -3592,7 +3605,7 @@ "Engagement": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Englebert": { "weights": ["400"], @@ -3750,7 +3763,7 @@ "Fanwood Text": { "weights": ["400"], "styles": ["normal", "italic"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Farro": { "weights": ["300", "400", "500", "700"], @@ -3765,12 +3778,12 @@ "Fascinate": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Fascinate Inline": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Faster One": { "weights": ["400"], @@ -4512,7 +4525,7 @@ "Gidugu": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin", "telugu"] + "subsets": ["latin", "latin-ext", "telugu"] }, "Gilda Display": { "weights": ["400"], @@ -4527,7 +4540,7 @@ "Give You Glory": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Glass Antiqua": { "weights": ["400"], @@ -4547,7 +4560,7 @@ "Gloria Hallelujah": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Glory": { "weights": [ @@ -4638,7 +4651,15 @@ "Gothic A1": { "weights": ["100", "200", "300", "400", "500", "600", "700", "800", "900"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": [ + "cyrillic", + "cyrillic-ext", + "greek", + "greek-ext", + "latin", + "latin-ext", + "vietnamese" + ] }, "Gotu": { "weights": ["400"], @@ -4793,7 +4814,7 @@ "Gurajada": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin", "telugu"] + "subsets": ["latin", "latin-ext", "telugu"] }, "Gwendolyn": { "weights": ["400", "700"], @@ -5364,7 +5385,7 @@ "Indie Flower": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Ingrid Darling": { "weights": ["400"], @@ -5793,7 +5814,7 @@ "Just Another Hand": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Just Me Again Down Here": { "weights": ["400"], @@ -5821,7 +5842,7 @@ "Kadwa": { "weights": ["400", "700"], "styles": ["normal"], - "subsets": ["devanagari", "latin"] + "subsets": ["devanagari", "latin", "latin-ext"] }, "Kaisei Decol": { "weights": ["400", "500", "700"], @@ -6225,7 +6246,7 @@ "La Belle Aurore": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Labrada": { "weights": [ @@ -6678,7 +6699,7 @@ "Linden Hill": { "weights": ["400"], "styles": ["normal", "italic"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Linefont": { "weights": [ @@ -6832,7 +6853,7 @@ "Loved by the King": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Lovers Quarrel": { "weights": ["400"], @@ -6842,7 +6863,7 @@ "Luckiest Guy": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Lugrasimo": { "weights": ["400"], @@ -7047,7 +7068,7 @@ "Maiden Orange": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Maitree": { "weights": ["200", "300", "400", "500", "600", "700"], @@ -7268,7 +7289,7 @@ "Meddon": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "MedievalSharp": { "weights": ["400"], @@ -7288,7 +7309,7 @@ "Megrim": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Meie Script": { "weights": ["400"], @@ -7545,7 +7566,7 @@ "Monoton": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Monsieur La Doulaise": { "weights": ["400"], @@ -7584,7 +7605,7 @@ "Montez": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Montserrat": { "weights": [ @@ -10684,42 +10705,42 @@ "Nova Cut": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Nova Flat": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Nova Mono": { "weights": ["400"], "styles": ["normal"], - "subsets": ["greek", "latin"] + "subsets": ["greek", "latin", "latin-ext"] }, "Nova Oval": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Nova Round": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Nova Script": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Nova Slim": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Nova Square": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Numans": { "weights": ["400"], @@ -10816,6 +10837,7 @@ "weights": ["400"], "styles": ["normal"], "subsets": [ + "arabic", "cyrillic", "cyrillic-ext", "greek", @@ -10963,7 +10985,7 @@ "Original Surfer": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Oswald": { "weights": ["200", "300", "400", "500", "600", "700", "variable"], @@ -11005,7 +11027,7 @@ "Over the Rainbow": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Overlock": { "weights": ["400", "700", "900"], @@ -11157,6 +11179,19 @@ "styles": ["normal"], "subsets": ["latin", "latin-ext"] }, + "Parkinsans": { + "weights": ["300", "400", "500", "600", "700", "800", "variable"], + "styles": ["normal"], + "axes": [ + { + "tag": "wght", + "min": 300, + "max": 800, + "defaultValue": 400 + } + ], + "subsets": ["latin", "latin-ext"] + }, "Passero One": { "weights": ["400"], "styles": ["normal"], @@ -11292,6 +11327,11 @@ ], "subsets": ["latin", "latin-ext", "vietnamese"] }, + "Phetsarath": { + "weights": ["400", "700"], + "styles": ["normal"], + "subsets": ["lao"] + }, "Philosopher": { "weights": ["400", "700"], "styles": ["normal", "italic"], @@ -12197,13 +12237,18 @@ "Poly": { "weights": ["400"], "styles": ["normal", "italic"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Pompiere": { "weights": ["400"], "styles": ["normal"], "subsets": ["latin"] }, + "Ponnala": { + "weights": ["400"], + "styles": ["normal"], + "subsets": ["latin", "telugu"] + }, "Pontano Sans": { "weights": ["300", "400", "500", "600", "700", "variable"], "styles": ["normal"], @@ -12782,7 +12827,7 @@ "Redressed": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Reem Kufi": { "weights": ["400", "500", "600", "700", "variable"], @@ -13523,7 +13568,7 @@ "Sahitya": { "weights": ["400", "700"], "styles": ["normal"], - "subsets": ["devanagari", "latin"] + "subsets": ["devanagari", "latin", "latin-ext"] }, "Sail": { "weights": ["400"], @@ -13752,7 +13797,7 @@ "Shadows Into Light": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Shadows Into Light Two": { "weights": ["400"], @@ -13930,7 +13975,7 @@ "Six Caps": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Sixtyfour": { "weights": ["400", "variable"], @@ -14010,7 +14055,7 @@ "Smokum": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Smooch": { "weights": ["400"], @@ -14404,7 +14449,7 @@ "Special Elite": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Spectral": { "weights": ["200", "300", "400", "500", "600", "700", "800"], @@ -14419,7 +14464,7 @@ "Spicy Rice": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Spinnaker": { "weights": ["400"], @@ -14588,7 +14633,7 @@ "Supermercado One": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Sura": { "weights": ["400", "700"], @@ -14613,12 +14658,12 @@ "Swanky and Moo Moo": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Syncopate": { "weights": ["400", "700"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Syne": { "weights": ["400", "500", "600", "700", "800", "variable"], @@ -14793,7 +14838,7 @@ "The Girl Next Door": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "The Nautigal": { "weights": ["400", "700"], @@ -15191,7 +15236,7 @@ "Ultra": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Unbounded": { "weights": [ @@ -15219,7 +15264,7 @@ "Uncial Antiqua": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Underdog": { "weights": ["400"], @@ -15450,7 +15495,7 @@ "Waiting for the Sunrise": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Wallpoet": { "weights": ["400"], @@ -15693,7 +15738,7 @@ "Yellowtail": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Yeon Sung": { "weights": ["400"], @@ -15708,7 +15753,7 @@ "Yesteryear": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Yomogi": { "weights": ["400"], @@ -15920,7 +15965,7 @@ }, "Zain": { "weights": ["200", "300", "400", "700", "800", "900"], - "styles": ["normal"], + "styles": ["normal", "italic"], "subsets": ["arabic", "latin"] }, "Zen Antique": { @@ -15976,7 +16021,7 @@ "Zeyada": { "weights": ["400"], "styles": ["normal"], - "subsets": ["latin"] + "subsets": ["latin", "latin-ext"] }, "Zhi Mang Xing": { "weights": ["400"], diff --git a/packages/font/src/google/index.ts b/packages/font/src/google/index.ts index 4f29887894a09..a0e5fbb4bdb69 100644 --- a/packages/font/src/google/index.ts +++ b/packages/font/src/google/index.ts @@ -126,7 +126,7 @@ export declare function Aclonica< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Acme< T extends CssVariable | undefined = undefined, @@ -439,7 +439,7 @@ export declare function Alef< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'hebrew' | 'latin'> + subsets?: Array<'hebrew' | 'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Alegreya< T extends CssVariable | undefined = undefined, @@ -1276,7 +1276,7 @@ export declare function Annie_Use_Your_Telescope< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Anonymous_Pro< T extends CssVariable | undefined = undefined, @@ -1488,7 +1488,7 @@ export declare function Architects_Daughter< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Archivo< T extends CssVariable | undefined = undefined, @@ -1901,7 +1901,7 @@ export declare function Atomic_Age< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Aubrey< T extends CssVariable | undefined = undefined, @@ -2800,7 +2800,7 @@ export declare function Bentham< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Berkshire_Swash< T extends CssVariable | undefined = undefined, @@ -4545,7 +4545,7 @@ export declare function Cinzel_Decorative< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Clicker_Script< T extends CssVariable | undefined = undefined, @@ -5036,7 +5036,7 @@ export declare function Covered_By_Your_Grace< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Crafty_Girls< T extends CssVariable | undefined = undefined, @@ -5130,7 +5130,7 @@ export declare function Crushed< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Cuprum< T extends CssVariable | undefined = undefined, @@ -5872,6 +5872,24 @@ export declare function Eczar< adjustFontFallback?: boolean subsets?: Array<'devanagari' | 'greek' | 'greek-ext' | 'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable +export declare function Edu_AU_VIC_WA_NT_Arrows< + T extends CssVariable | undefined = undefined, +>(options?: { + weight?: + | '400' + | '500' + | '600' + | '700' + | 'variable' + | Array<'400' | '500' | '600' | '700'> + style?: 'normal' | Array<'normal'> + display?: Display + variable?: T + preload?: boolean + fallback?: string[] + adjustFontFallback?: boolean + subsets?: Array<'latin' | 'latin-ext'> +}): T extends undefined ? NextFont : NextFontWithVariable export declare function Edu_AU_VIC_WA_NT_Dots< T extends CssVariable | undefined = undefined, >(options?: { @@ -6270,7 +6288,7 @@ export declare function Engagement< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Englebert< T extends CssVariable | undefined = undefined, @@ -6534,7 +6552,7 @@ export declare function Fanwood_Text< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Farro< T extends CssVariable | undefined = undefined, @@ -6570,7 +6588,7 @@ export declare function Fascinate< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Fascinate_Inline< T extends CssVariable | undefined = undefined, @@ -6582,7 +6600,7 @@ export declare function Fascinate_Inline< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Faster_One< T extends CssVariable | undefined = undefined, @@ -7796,7 +7814,7 @@ export declare function Gidugu< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin' | 'telugu'> + subsets?: Array<'latin' | 'latin-ext' | 'telugu'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Gilda_Display< T extends CssVariable | undefined = undefined, @@ -7832,7 +7850,7 @@ export declare function Give_You_Glory< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Glass_Antiqua< T extends CssVariable | undefined = undefined, @@ -7880,7 +7898,7 @@ export declare function Gloria_Hallelujah< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Glory< T extends CssVariable | undefined = undefined, @@ -8020,7 +8038,15 @@ export declare function Gothic_A1< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array< + | 'cyrillic' + | 'cyrillic-ext' + | 'greek' + | 'greek-ext' + | 'latin' + | 'latin-ext' + | 'vietnamese' + > }): T extends undefined ? NextFont : NextFontWithVariable export declare function Gotu< T extends CssVariable | undefined = undefined, @@ -8329,7 +8355,7 @@ export declare function Gurajada< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin' | 'telugu'> + subsets?: Array<'latin' | 'latin-ext' | 'telugu'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Gwendolyn< T extends CssVariable | undefined = undefined, @@ -9407,7 +9433,7 @@ export declare function Indie_Flower< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Ingrid_Darling< T extends CssVariable | undefined = undefined, @@ -10173,7 +10199,7 @@ export declare function Just_Another_Hand< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Just_Me_Again_Down_Here< T extends CssVariable | undefined = undefined, @@ -10233,7 +10259,7 @@ export declare function Kadwa< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'devanagari' | 'latin'> + subsets?: Array<'devanagari' | 'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Kaisei_Decol< T extends CssVariable | undefined = undefined, @@ -11079,7 +11105,7 @@ export declare function La_Belle_Aurore< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Labrada< T extends CssVariable | undefined = undefined, @@ -11786,7 +11812,7 @@ export declare function Linden_Hill< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Linefont< T extends CssVariable | undefined = undefined, @@ -12055,7 +12081,7 @@ export declare function Loved_by_the_King< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Lovers_Quarrel< T extends CssVariable | undefined = undefined, @@ -12079,7 +12105,7 @@ export declare function Luckiest_Guy< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Lugrasimo< T extends CssVariable | undefined = undefined, @@ -12417,7 +12443,7 @@ export declare function Maiden_Orange< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Maitree< T extends CssVariable | undefined = undefined, @@ -12860,7 +12886,7 @@ export declare function Meddon< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function MedievalSharp< T extends CssVariable | undefined = undefined, @@ -12908,7 +12934,7 @@ export declare function Megrim< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Meie_Script< T extends CssVariable | undefined = undefined, @@ -13416,7 +13442,7 @@ export declare function Monoton< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Monsieur_La_Doulaise< T extends CssVariable | undefined = undefined, @@ -13486,7 +13512,7 @@ export declare function Montez< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Montserrat< T extends CssVariable | undefined = undefined, @@ -17888,7 +17914,7 @@ export declare function Nova_Cut< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Nova_Flat< T extends CssVariable | undefined = undefined, @@ -17900,7 +17926,7 @@ export declare function Nova_Flat< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Nova_Mono< T extends CssVariable | undefined = undefined, @@ -17912,7 +17938,7 @@ export declare function Nova_Mono< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'greek' | 'latin'> + subsets?: Array<'greek' | 'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Nova_Oval< T extends CssVariable | undefined = undefined, @@ -17924,7 +17950,7 @@ export declare function Nova_Oval< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Nova_Round< T extends CssVariable | undefined = undefined, @@ -17936,7 +17962,7 @@ export declare function Nova_Round< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Nova_Script< T extends CssVariable | undefined = undefined, @@ -17948,7 +17974,7 @@ export declare function Nova_Script< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Nova_Slim< T extends CssVariable | undefined = undefined, @@ -17960,7 +17986,7 @@ export declare function Nova_Slim< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Nova_Square< T extends CssVariable | undefined = undefined, @@ -17972,7 +17998,7 @@ export declare function Nova_Square< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Numans< T extends CssVariable | undefined = undefined, @@ -18100,6 +18126,7 @@ export declare function Oi< fallback?: string[] adjustFontFallback?: boolean subsets?: Array< + | 'arabic' | 'cyrillic' | 'cyrillic-ext' | 'greek' @@ -18351,7 +18378,7 @@ export declare function Original_Surfer< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Oswald< T extends CssVariable | undefined = undefined, @@ -18410,7 +18437,7 @@ export declare function Over_the_Rainbow< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Overlock< T extends CssVariable | undefined = undefined, @@ -18733,6 +18760,26 @@ export declare function Parisienne< adjustFontFallback?: boolean subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable +export declare function Parkinsans< + T extends CssVariable | undefined = undefined, +>(options?: { + weight?: + | '300' + | '400' + | '500' + | '600' + | '700' + | '800' + | 'variable' + | Array<'300' | '400' | '500' | '600' | '700' | '800'> + style?: 'normal' | Array<'normal'> + display?: Display + variable?: T + preload?: boolean + fallback?: string[] + adjustFontFallback?: boolean + subsets?: Array<'latin' | 'latin-ext'> +}): T extends undefined ? NextFont : NextFontWithVariable export declare function Passero_One< T extends CssVariable | undefined = undefined, >(options: { @@ -18964,6 +19011,18 @@ export declare function Petrona< adjustFontFallback?: boolean subsets?: Array<'latin' | 'latin-ext' | 'vietnamese'> }): T extends undefined ? NextFont : NextFontWithVariable +export declare function Phetsarath< + T extends CssVariable | undefined = undefined, +>(options: { + weight: '400' | '700' | Array<'400' | '700'> + style?: 'normal' | Array<'normal'> + display?: Display + variable?: T + preload?: boolean + fallback?: string[] + adjustFontFallback?: boolean + subsets?: Array<'lao'> +}): T extends undefined ? NextFont : NextFontWithVariable export declare function Philosopher< T extends CssVariable | undefined = undefined, >(options: { @@ -20196,7 +20255,7 @@ export declare function Poly< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Pompiere< T extends CssVariable | undefined = undefined, @@ -20210,6 +20269,18 @@ export declare function Pompiere< adjustFontFallback?: boolean subsets?: Array<'latin'> }): T extends undefined ? NextFont : NextFontWithVariable +export declare function Ponnala< + T extends CssVariable | undefined = undefined, +>(options: { + weight: '400' | Array<'400'> + style?: 'normal' | Array<'normal'> + display?: Display + variable?: T + preload?: boolean + fallback?: string[] + adjustFontFallback?: boolean + subsets?: Array<'latin' | 'telugu'> +}): T extends undefined ? NextFont : NextFontWithVariable export declare function Pontano_Sans< T extends CssVariable | undefined = undefined, >(options?: { @@ -21211,7 +21282,7 @@ export declare function Redressed< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Reem_Kufi< T extends CssVariable | undefined = undefined, @@ -22380,7 +22451,7 @@ export declare function Sahitya< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'devanagari' | 'latin'> + subsets?: Array<'devanagari' | 'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Sail< T extends CssVariable | undefined = undefined, @@ -22902,7 +22973,7 @@ export declare function Shadows_Into_Light< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Shadows_Into_Light_Two< T extends CssVariable | undefined = undefined, @@ -23251,7 +23322,7 @@ export declare function Six_Caps< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Sixtyfour< T extends CssVariable | undefined = undefined, @@ -23349,7 +23420,7 @@ export declare function Smokum< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Smooch< T extends CssVariable | undefined = undefined, @@ -23888,7 +23959,7 @@ export declare function Special_Elite< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Spectral< T extends CssVariable | undefined = undefined, @@ -23944,7 +24015,7 @@ export declare function Spicy_Rice< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Spinnaker< T extends CssVariable | undefined = undefined, @@ -24315,7 +24386,7 @@ export declare function Supermercado_One< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Sura< T extends CssVariable | undefined = undefined, @@ -24381,7 +24452,7 @@ export declare function Swanky_and_Moo_Moo< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Syncopate< T extends CssVariable | undefined = undefined, @@ -24393,7 +24464,7 @@ export declare function Syncopate< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Syne< T extends CssVariable | undefined = undefined, @@ -24711,7 +24782,7 @@ export declare function The_Girl_Next_Door< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function The_Nautigal< T extends CssVariable | undefined = undefined, @@ -25319,7 +25390,7 @@ export declare function Ultra< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Unbounded< T extends CssVariable | undefined = undefined, @@ -25355,7 +25426,7 @@ export declare function Uncial_Antiqua< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Underdog< T extends CssVariable | undefined = undefined, @@ -25785,7 +25856,7 @@ export declare function Waiting_for_the_Sunrise< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Wallpoet< T extends CssVariable | undefined = undefined, @@ -26192,7 +26263,7 @@ export declare function Yellowtail< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Yeon_Sung< T extends CssVariable | undefined = undefined, @@ -26230,7 +26301,7 @@ export declare function Yesteryear< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Yomogi< T extends CssVariable | undefined = undefined, @@ -26578,7 +26649,7 @@ export declare function Zain< | '800' | '900' | Array<'200' | '300' | '400' | '700' | '800' | '900'> - style?: 'normal' | Array<'normal'> + style?: 'normal' | 'italic' | Array<'normal' | 'italic'> display?: Display variable?: T preload?: boolean @@ -26740,7 +26811,7 @@ export declare function Zeyada< preload?: boolean fallback?: string[] adjustFontFallback?: boolean - subsets?: Array<'latin'> + subsets?: Array<'latin' | 'latin-ext'> }): T extends undefined ? NextFont : NextFontWithVariable export declare function Zhi_Mang_Xing< T extends CssVariable | undefined = undefined, From 2161d8c012dcd98eb8690814bd275d56c45bf00a Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Sat, 23 Nov 2024 08:59:49 +0100 Subject: [PATCH 03/82] Method/function props of exported objects are not server functions (#73058) This is a follow-up fix for #72969. Method or function properties of exported objects in `"use cache"` or `"use server"` files must not be compiled into server functions, unless they have an inline server directive. --- .../src/transforms/server_actions.rs | 5 +++++ .../fixture/server-actions/server/56/input.js | 13 +++++++++++++ .../fixture/server-actions/server/56/output.js | 14 ++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/56/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index 454707c957d39..3568bac6adc70 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -1190,6 +1190,7 @@ impl VisitMut for ServerActions { fn visit_mut_prop_or_spread(&mut self, n: &mut PropOrSpread) { let old_arrow_or_fn_expr_ident = self.arrow_or_fn_expr_ident.clone(); + let old_in_exported_expr = self.in_exported_expr; match n { PropOrSpread::Prop(box Prop::KeyValue(KeyValueProp { @@ -1197,6 +1198,7 @@ impl VisitMut for ServerActions { value: box Expr::Arrow(_) | box Expr::Fn(_), .. })) => { + self.in_exported_expr = false; self.arrow_or_fn_expr_ident = Some(ident_name.clone().into()); } PropOrSpread::Prop(box Prop::Method(MethodProp { key, .. })) => { @@ -1205,7 +1207,9 @@ impl VisitMut for ServerActions { self.arrow_or_fn_expr_ident = Some(ident_name.clone().into()); } self.rewrite_expr_to_proxy_expr = None; + self.in_exported_expr = false; n.visit_mut_children_with(self); + self.in_exported_expr = old_in_exported_expr; if let Some(expr) = &self.rewrite_expr_to_proxy_expr { *n = PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { key, @@ -1230,6 +1234,7 @@ impl VisitMut for ServerActions { n.visit_mut_children_with(self); self.arrow_or_fn_expr_ident = old_arrow_or_fn_expr_ident; + self.in_exported_expr = old_in_exported_expr; } fn visit_mut_callee(&mut self, n: &mut Callee) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/56/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/56/input.js new file mode 100644 index 0000000000000..db991c0fcbcbc --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/56/input.js @@ -0,0 +1,13 @@ +'use cache' + +// No method nor function property should be considered a cache function. +export const obj = { + foo() { + return 1 + }, + async bar() { + return 2 + }, + baz: () => 2, + qux: async () => 3, +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js new file mode 100644 index 0000000000000..ca1e3414c1174 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js @@ -0,0 +1,14 @@ +/* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +// No method nor function property should be considered a cache function. +export const obj = { + foo () { + return 1; + }, + async bar () { + return 2; + }, + baz: ()=>2, + qux: async ()=>3 +}; From c53ee73cf10f9f422c05194d515f834e2f37f8c1 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Sat, 23 Nov 2024 23:46:24 +0100 Subject: [PATCH 04/82] Forbid `this` and `arguments` in server functions (#73059) Accessing `this` or `arguments` in server functions is not allowed. With this PR, we are now emitting build errors in this case. --------- Co-authored-by: Janka Uryga --- .../src/transforms/server_actions.rs | 144 ++++++++++++++---- .../server-actions/server-graph/22/input.js | 50 ++++++ .../server-actions/server-graph/22/output.js | 55 +++++++ .../server-graph/22/output.stderr | 63 ++++++++ .../server-actions/server-graph/23/input.js | 29 ++++ .../server-actions/server-graph/23/output.js | 28 ++++ .../server-graph/23/output.stderr | 16 ++ .../server-actions/server-graph/24/input.js | 38 +++++ .../server-actions/server-graph/24/output.js | 40 +++++ .../server-graph/24/output.stderr | 47 ++++++ 10 files changed, 477 insertions(+), 33 deletions(-) create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/input.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.stderr create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/input.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.stderr create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/input.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.stderr diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index 3568bac6adc70..a134ac8369f83 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -1,7 +1,7 @@ use std::{ collections::{BTreeMap, HashSet}, convert::{TryFrom, TryInto}, - mem::take, + mem::{replace, take}, }; use hex::encode as hex_encode; @@ -46,12 +46,23 @@ enum DirectiveLocation { FunctionBody, } +#[derive(Clone, Debug)] +enum ThisStatus { + Allowed, + Forbidden { directive: Directive }, +} + #[derive(Clone, Debug)] enum ServerActionsErrorKind { ExportedSyncFunction { span: Span, in_action_file: bool, }, + ForbiddenExpression { + span: Span, + expr: String, + directive: Directive, + }, InlineSyncFunction { span: Span, directive: Directive, @@ -113,6 +124,7 @@ pub fn server_actions(file_name: &FileName, config: Config, comment in_callee: false, has_action: false, has_cache: false, + this_status: ThisStatus::Allowed, reference_index: 0, in_module_level: true, @@ -163,6 +175,7 @@ struct ServerActions { in_callee: bool, has_action: bool, has_cache: bool, + this_status: ThisStatus, reference_index: u32, in_module_level: bool, @@ -897,24 +910,20 @@ impl VisitMut for ServerActions { } fn visit_mut_export_default_decl(&mut self, decl: &mut ExportDefaultDecl) { - let old = self.in_exported_expr; - let old_default = self.in_default_export_decl; - self.in_exported_expr = true; - self.in_default_export_decl = true; + let old_in_exported_expr = replace(&mut self.in_exported_expr, true); + let old_in_default_export_decl = replace(&mut self.in_default_export_decl, true); self.rewrite_default_fn_expr_to_proxy_expr = None; decl.decl.visit_mut_with(self); - self.in_exported_expr = old; - self.in_default_export_decl = old_default; + self.in_exported_expr = old_in_exported_expr; + self.in_default_export_decl = old_in_default_export_decl; } fn visit_mut_export_default_expr(&mut self, expr: &mut ExportDefaultExpr) { - let old = self.in_exported_expr; - let old_default = self.in_default_export_decl; - self.in_exported_expr = true; - self.in_default_export_decl = true; + let old_in_exported_expr = replace(&mut self.in_exported_expr, true); + let old_in_default_export_decl = replace(&mut self.in_default_export_decl, true); expr.expr.visit_mut_with(self); - self.in_exported_expr = old; - self.in_default_export_decl = old_default; + self.in_exported_expr = old_in_exported_expr; + self.in_default_export_decl = old_in_default_export_decl; } fn visit_mut_fn_expr(&mut self, f: &mut FnExpr) { @@ -931,18 +940,20 @@ impl VisitMut for ServerActions { let declared_idents_until = self.declared_idents.len(); let current_names = take(&mut self.names); + if let Some(directive) = &directive { + self.this_status = ThisStatus::Forbidden { + directive: directive.clone(), + }; + } + // Visit children { - let old_in_module = self.in_module_level; - let old_should_track_names = self.should_track_names; - let old_in_exported_expr = self.in_exported_expr; - let old_in_default_export_decl = self.in_default_export_decl; - let old_fn_decl_ident = self.fn_decl_ident.clone(); - self.in_module_level = false; - self.should_track_names = directive.is_some() || self.should_track_names; - self.in_exported_expr = false; - self.in_default_export_decl = false; - self.fn_decl_ident = None; + let old_in_module = replace(&mut self.in_module_level, false); + let should_track_names = directive.is_some() || self.should_track_names; + let old_should_track_names = replace(&mut self.should_track_names, should_track_names); + let old_in_exported_expr = replace(&mut self.in_exported_expr, false); + let old_in_default_export_decl = replace(&mut self.in_default_export_decl, false); + let old_fn_decl_ident = self.fn_decl_ident.take(); f.visit_mut_children_with(self); self.in_module_level = old_in_module; self.should_track_names = old_should_track_names; @@ -1070,12 +1081,14 @@ impl VisitMut for ServerActions { } fn visit_mut_fn_decl(&mut self, f: &mut FnDecl) { + let old_this_status = replace(&mut self.this_status, ThisStatus::Allowed); let old_in_exported_expr = self.in_exported_expr; if self.in_module_level && self.exported_local_ids.contains(&f.ident.to_id()) { self.in_exported_expr = true } let old_fn_decl_ident = self.fn_decl_ident.replace(f.ident.clone()); f.visit_mut_children_with(self); + self.this_status = old_this_status; self.in_exported_expr = old_in_exported_expr; self.fn_decl_ident = old_fn_decl_ident; } @@ -1091,19 +1104,22 @@ impl VisitMut for ServerActions { }, ); + if let Some(directive) = &directive { + self.this_status = ThisStatus::Forbidden { + directive: directive.clone(), + }; + } + let declared_idents_until = self.declared_idents.len(); let current_names = take(&mut self.names); { // Visit children - let old_in_module = self.in_module_level; - let old_should_track_names = self.should_track_names; - let old_in_exported_expr = self.in_exported_expr; - let old_in_default_export_decl = self.in_default_export_decl; - self.in_module_level = false; - self.should_track_names = directive.is_some() || self.should_track_names; - self.in_exported_expr = false; - self.in_default_export_decl = false; + let old_in_module = replace(&mut self.in_module_level, false); + let should_track_names = directive.is_some() || self.should_track_names; + let old_should_track_names = replace(&mut self.should_track_names, should_track_names); + let old_in_exported_expr = replace(&mut self.in_exported_expr, false); + let old_in_default_export_decl = replace(&mut self.in_default_export_decl, false); { for n in &mut a.params { collect_idents_in_pat(n, &mut self.declared_idents); @@ -1203,13 +1219,18 @@ impl VisitMut for ServerActions { } PropOrSpread::Prop(box Prop::Method(MethodProp { key, .. })) => { let key = key.clone(); + if let PropName::Ident(ident_name) = &key { self.arrow_or_fn_expr_ident = Some(ident_name.clone().into()); } + + let old_this_status = replace(&mut self.this_status, ThisStatus::Allowed); self.rewrite_expr_to_proxy_expr = None; self.in_exported_expr = false; n.visit_mut_children_with(self); self.in_exported_expr = old_in_exported_expr; + self.this_status = old_this_status; + if let Some(expr) = &self.rewrite_expr_to_proxy_expr { *n = PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { key, @@ -1217,6 +1238,7 @@ impl VisitMut for ServerActions { }))); self.rewrite_expr_to_proxy_expr = None; } + return; } _ => {} @@ -1237,9 +1259,26 @@ impl VisitMut for ServerActions { self.in_exported_expr = old_in_exported_expr; } + fn visit_mut_call_expr(&mut self, n: &mut CallExpr) { + if let Callee::Expr(box Expr::Ident(Ident { sym, .. })) = &mut n.callee { + if sym == "jsxDEV" || sym == "_jsxDEV" { + // Do not visit the 6th arg in a generated jsxDEV call, which is a `this` + // expression, to avoid emitting an error for using `this` if it's + // inside of a server function. https://github.com/facebook/react/blob/9106107/packages/react/src/jsx/ReactJSXElement.js#L429 + if n.args.len() > 4 { + for arg in &mut n.args[0..4] { + arg.visit_mut_with(self); + } + return; + } + } + } + + n.visit_mut_children_with(self); + } + fn visit_mut_callee(&mut self, n: &mut Callee) { - let old_in_callee = self.in_callee; - self.in_callee = true; + let old_in_callee = replace(&mut self.in_callee, true); n.visit_mut_children_with(self); self.in_callee = old_in_callee; } @@ -2027,6 +2066,28 @@ impl VisitMut for ServerActions { self.arrow_or_fn_expr_ident = old_arrow_or_fn_expr_ident; } + fn visit_mut_this_expr(&mut self, n: &mut ThisExpr) { + if let ThisStatus::Forbidden { directive } = &self.this_status { + emit_error(ServerActionsErrorKind::ForbiddenExpression { + span: n.span, + expr: "this".into(), + directive: directive.clone(), + }); + } + } + + fn visit_mut_ident(&mut self, n: &mut Ident) { + if n.sym == *"arguments" { + if let ThisStatus::Forbidden { directive } = &self.this_status { + emit_error(ServerActionsErrorKind::ForbiddenExpression { + span: n.span, + expr: "arguments".into(), + directive: directive.clone(), + }); + } + } + } + noop_visit_mut_type!(); } @@ -2771,6 +2832,23 @@ fn emit_error(error_kind: ServerActionsErrorKind) { } }, ), + ServerActionsErrorKind::ForbiddenExpression { + span, + expr, + directive, + } => ( + span, + formatdoc! { + r#" + {subject} cannot use `{expr}`. + "#, + subject = if let Directive::UseServer = directive { + "Server Actions" + } else { + "\"use cache\" functions" + } + }, + ), ServerActionsErrorKind::InlineUseCacheInClientComponent { span } => ( span, formatdoc! { diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/input.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/input.js new file mode 100644 index 0000000000000..7e524f5ed5927 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/input.js @@ -0,0 +1,50 @@ +async function a() { + 'use cache' + // this is not allowed here + this.foo() + // arguments is not allowed here + console.log(arguments) + + const b = async () => { + // this is not allowed here + this.foo() + // arguments is not allowed here + console.log(arguments) + } + + function c() { + // this is allowed here + this.foo() + // arguments is allowed here + console.log(arguments) + + const d = () => { + // this is allowed here + this.foo() + // arguments is allowed here + console.log(arguments) + } + + const e = async () => { + 'use server' + // this is not allowed here + this.foo() + // arguments is not allowed here + console.log(arguments) + } + } +} + +export const api = { + result: null, + product: { + async fetch() { + 'use cache' + + // this is not allowed here + this.result = await fetch('https://example.com').then((res) => res.json()) + // arguments is not allowed here + console.log(arguments) + }, + }, +} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.js new file mode 100644 index 0000000000000..881e15a7e6333 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.js @@ -0,0 +1,55 @@ +/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ /* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","8069348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","80951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function e() { + // this is not allowed here + this.foo(); + // arguments is not allowed here + console.log(arguments); +}; +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", 0, async function a() { + // this is not allowed here + this.foo(); + // arguments is not allowed here + console.log(arguments); + const b = async ()=>{ + // this is not allowed here + this.foo(); + // arguments is not allowed here + console.log(arguments); + }; + function c() { + // this is allowed here + this.foo(); + // arguments is allowed here + console.log(arguments); + const d = ()=>{ + // this is allowed here + this.foo(); + // arguments is allowed here + console.log(arguments); + }; + const e = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); + } +}); +Object.defineProperty($$RSC_SERVER_CACHE_1, "name", { + "value": "a", + "writable": false +}); +var a = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); +export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "8069348c79fce073bae2f70f139565a2fda1c74c74", 0, /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ async function fetch1() { + // this is not allowed here + this.result = await fetch('https://example.com').then((res)=>res.json()); + // arguments is not allowed here + console.log(arguments); +}); +Object.defineProperty($$RSC_SERVER_CACHE_2, "name", { + "value": "fetch", + "writable": false +}); +export const api = { + result: null, + product: { + fetch: registerServerReference($$RSC_SERVER_CACHE_2, "8069348c79fce073bae2f70f139565a2fda1c74c74", null) + } +}; diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.stderr b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.stderr new file mode 100644 index 0000000000000..4051705fbb63b --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/22/output.stderr @@ -0,0 +1,63 @@ + x "use cache" functions cannot use `this`. + | + ,-[input.js:4:1] + 3 | // this is not allowed here + 4 | this.foo() + : ^^^^ + 5 | // arguments is not allowed here + `---- + x "use cache" functions cannot use `arguments`. + | + ,-[input.js:6:1] + 5 | // arguments is not allowed here + 6 | console.log(arguments) + : ^^^^^^^^^ + `---- + x "use cache" functions cannot use `this`. + | + ,-[input.js:10:1] + 9 | // this is not allowed here + 10 | this.foo() + : ^^^^ + 11 | // arguments is not allowed here + `---- + x "use cache" functions cannot use `arguments`. + | + ,-[input.js:12:1] + 11 | // arguments is not allowed here + 12 | console.log(arguments) + : ^^^^^^^^^ + 13 | } + `---- + x Server Actions cannot use `this`. + | + ,-[input.js:31:1] + 30 | // this is not allowed here + 31 | this.foo() + : ^^^^ + 32 | // arguments is not allowed here + `---- + x Server Actions cannot use `arguments`. + | + ,-[input.js:33:1] + 32 | // arguments is not allowed here + 33 | console.log(arguments) + : ^^^^^^^^^ + 34 | } + `---- + x "use cache" functions cannot use `this`. + | + ,-[input.js:45:1] + 44 | // this is not allowed here + 45 | this.result = await fetch('https://example.com').then((res) => res.json()) + : ^^^^ + 46 | // arguments is not allowed here + `---- + x "use cache" functions cannot use `arguments`. + | + ,-[input.js:47:1] + 46 | // arguments is not allowed here + 47 | console.log(arguments) + : ^^^^^^^^^ + 48 | }, + `---- diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/input.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/input.js new file mode 100644 index 0000000000000..66ac0246c493b --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/input.js @@ -0,0 +1,29 @@ +'use cache' + +// not exported! +async function a() { + // this is allowed here + this.foo() + // arguments is allowed here + console.log(arguments) + + const b = async () => { + 'use server' + // this is not allowed here + this.foo() + // arguments is not allowed here + console.log(arguments) + } +} + +export const obj = { + foo() { + return 42 + }, + bar() { + // this is allowed here + this.foo() + // arguments is allowed here + console.log(arguments) + }, +} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js new file mode 100644 index 0000000000000..d9446d59b1c2f --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js @@ -0,0 +1,28 @@ +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function b() { + // this is not allowed here + this.foo(); + // arguments is not allowed here + console.log(arguments); +}; +// not exported! +async function a() { + // this is allowed here + this.foo(); + // arguments is allowed here + console.log(arguments); + const b = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +} +export const obj = { + foo () { + return 42; + }, + bar () { + // this is allowed here + this.foo(); + // arguments is allowed here + console.log(arguments); + } +}; diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.stderr b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.stderr new file mode 100644 index 0000000000000..1963f4078d5f3 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.stderr @@ -0,0 +1,16 @@ + x Server Actions cannot use `this`. + | + ,-[input.js:13:1] + 12 | // this is not allowed here + 13 | this.foo() + : ^^^^ + 14 | // arguments is not allowed here + `---- + x Server Actions cannot use `arguments`. + | + ,-[input.js:15:1] + 14 | // arguments is not allowed here + 15 | console.log(arguments) + : ^^^^^^^^^ + 16 | } + `---- diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/input.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/input.js new file mode 100644 index 0000000000000..e5e254581cb8d --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/input.js @@ -0,0 +1,38 @@ +'use cache' + +// exported! +export async function a() { + // this is not allowed here + this.foo() + // arguments is not allowed here + console.log(arguments) + + const b = async () => { + // this is not allowed here + this.foo() + // arguments is not allowed here + console.log(arguments) + } + + function c() { + // this is allowed here + this.foo() + // arguments is allowed here + console.log(arguments) + + const d = () => { + // this is allowed here + this.foo() + // arguments is allowed here + console.log(arguments) + } + + const e = async () => { + 'use server' + // this is not allowed here + this.foo() + // arguments is not allowed here + console.log(arguments) + } + } +} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.js new file mode 100644 index 0000000000000..b98e7e1aef798 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.js @@ -0,0 +1,40 @@ +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","80951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function e() { + // this is not allowed here + this.foo(); + // arguments is not allowed here + console.log(arguments); +}; +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", 0, /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ async function a() { + // this is not allowed here + this.foo(); + // arguments is not allowed here + console.log(arguments); + const b = async ()=>{ + // this is not allowed here + this.foo(); + // arguments is not allowed here + console.log(arguments); + }; + function c() { + // this is allowed here + this.foo(); + // arguments is allowed here + console.log(arguments); + const d = ()=>{ + // this is allowed here + this.foo(); + // arguments is allowed here + console.log(arguments); + }; + const e = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); + } +}); +Object.defineProperty($$RSC_SERVER_CACHE_1, "name", { + "value": "a", + "writable": false +}); +// exported! +export var a = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.stderr b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.stderr new file mode 100644 index 0000000000000..c25781805f2e3 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/24/output.stderr @@ -0,0 +1,47 @@ + x "use cache" functions cannot use `this`. + | + ,-[input.js:6:1] + 5 | // this is not allowed here + 6 | this.foo() + : ^^^^ + 7 | // arguments is not allowed here + `---- + x "use cache" functions cannot use `arguments`. + | + ,-[input.js:8:1] + 7 | // arguments is not allowed here + 8 | console.log(arguments) + : ^^^^^^^^^ + `---- + x "use cache" functions cannot use `this`. + | + ,-[input.js:12:1] + 11 | // this is not allowed here + 12 | this.foo() + : ^^^^ + 13 | // arguments is not allowed here + `---- + x "use cache" functions cannot use `arguments`. + | + ,-[input.js:14:1] + 13 | // arguments is not allowed here + 14 | console.log(arguments) + : ^^^^^^^^^ + 15 | } + `---- + x Server Actions cannot use `this`. + | + ,-[input.js:33:1] + 32 | // this is not allowed here + 33 | this.foo() + : ^^^^ + 34 | // arguments is not allowed here + `---- + x Server Actions cannot use `arguments`. + | + ,-[input.js:35:1] + 34 | // arguments is not allowed here + 35 | console.log(arguments) + : ^^^^^^^^^ + 36 | } + `---- From 560bfdb3a231c66bf125680031a057abb19f9dd5 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Sat, 23 Nov 2024 23:25:27 +0000 Subject: [PATCH 05/82] v15.0.4-canary.25 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 73fc69f4c5e5b..27d2c80aa62be 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.4-canary.24" + "version": "15.0.4-canary.25" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 68b246626b05c..78901a5e6a0a6 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index d0ca65bc04ae2..46ab72f55e66d 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/api-reference/config/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.4-canary.24", + "@next/eslint-plugin-next": "15.0.4-canary.25", "@rushstack/eslint-patch": "^1.10.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 606c111eb3225..2a4e6ca9f70d8 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index ae06d71566b22..41e6f17982e76 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 55a0bf89de6a0..8475578289d66 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 8a3096cea24ca..41f511ff7cc38 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 81c3cbffa263a..6828b92cc3cd6 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 3862b5ac13e51..5736129929548 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 4a43a0ba3f871..49c849c428813 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index 4ef8e15f3df6b..f946dda00b253 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index a901a7e60300c..d435aaec77a2a 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 0e51e405d709a..747f90ef38705 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 085d22ffada85..f5358dfaca0b3 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -97,7 +97,7 @@ ] }, "dependencies": { - "@next/env": "15.0.4-canary.24", + "@next/env": "15.0.4-canary.25", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.13", "busboy": "1.6.0", @@ -161,11 +161,11 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/font": "15.0.4-canary.24", - "@next/polyfill-module": "15.0.4-canary.24", - "@next/polyfill-nomodule": "15.0.4-canary.24", - "@next/react-refresh-utils": "15.0.4-canary.24", - "@next/swc": "15.0.4-canary.24", + "@next/font": "15.0.4-canary.25", + "@next/polyfill-module": "15.0.4-canary.25", + "@next/polyfill-nomodule": "15.0.4-canary.25", + "@next/react-refresh-utils": "15.0.4-canary.25", + "@next/swc": "15.0.4-canary.25", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.9.2-nightly-20241111.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index ca3f5cc12a8a4..e4ab31455c0e2 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 036f22dac67ef..b988edc521335 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.4-canary.24", + "version": "15.0.4-canary.25", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.4-canary.24", + "next": "15.0.4-canary.25", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "5.6.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d4b4668077037..209d17705c6b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -795,7 +795,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.10.3 @@ -859,7 +859,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -987,19 +987,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../font '@next/polyfill-module': - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1633,7 +1633,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.4-canary.24 + specifier: 15.0.4-canary.25 version: link:../next outdent: specifier: 0.8.0 From 7b0ab1ec6ae7b3188d8bbc378348b634e142619c Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Sun, 24 Nov 2024 14:16:34 +0100 Subject: [PATCH 06/82] Current behavior for fallbacks with async metadata and prefetching (#73106) --- .../app/metadata-await-promise/nested/page.js | 4 +- .../app/metadata-await-promise/page.js | 2 +- .../e2e/app-dir/navigation/navigation.test.ts | 66 ++++++++++++++----- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/page.js b/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/page.js index 431822fa1da45..0d933e4c61c18 100644 --- a/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/page.js +++ b/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/page.js @@ -3,13 +3,13 @@ import React from 'react' // ensure this page is dynamically rendered so we always trigger a loading state export const dynamic = 'force-dynamic' -export default function page() { +export default function Page() { return
Content
} async function getTitle() { return await new Promise((resolve) => - setTimeout(() => resolve('Async Title'), 1000) + setTimeout(() => resolve('Async Title'), 5000) ) } diff --git a/test/e2e/app-dir/navigation/app/metadata-await-promise/page.js b/test/e2e/app-dir/navigation/app/metadata-await-promise/page.js index 8481307e49730..1fb5f48153bf1 100644 --- a/test/e2e/app-dir/navigation/app/metadata-await-promise/page.js +++ b/test/e2e/app-dir/navigation/app/metadata-await-promise/page.js @@ -1,6 +1,6 @@ import Link from 'next/link' -export default function page() { +export default function Page() { return (
Link to nested diff --git a/test/e2e/app-dir/navigation/navigation.test.ts b/test/e2e/app-dir/navigation/navigation.test.ts index 8a626dd3789cf..a38a12a931d0a 100644 --- a/test/e2e/app-dir/navigation/navigation.test.ts +++ b/test/e2e/app-dir/navigation/navigation.test.ts @@ -881,29 +881,63 @@ describe('app dir - navigation', () => { }) describe('navigating to a page with async metadata', () => { - it('should render the final state of the page with correct metadata', async () => { + it('shows a fallback when prefetch was pending', async () => { + const resolveMetadataDuration = 5000 const browser = await next.browser('/metadata-await-promise') - // dev doesn't trigger the loading boundary as it's not prefetched - if (isNextDev) { - await browser - .elementByCss("[href='/metadata-await-promise/nested']") - .click() - } else { - const loadingText = await browser - .elementByCss("[href='/metadata-await-promise/nested']") - .click() - .waitForElementByCss('#loading') - .text() + // Hopefully this click happened before the prefetch was completed. + // TODO: Programmatically trigger prefetch e.g. by mounting the link later. + await browser + .elementByCss("[href='/metadata-await-promise/nested']") + .click() - expect(loadingText).toBe('Loading') + if (!isNextDev) { + // next-dev has no prefetch + expect( + await browser + .waitForElementByCss( + '#loading', + // Wait a bit longer than the prefetch duration since the click takes a while to register and the fallback render also takes time. + resolveMetadataDuration + 500 + ) + .text() + ).toEqual('Loading') + expect(await browser.elementByCss('title').text()).toBe('Async Title') } - await retry(async () => { - expect(await browser.elementById('page-content').text()).toBe('Content') + await waitFor(resolveMetadataDuration) + + expect(await browser.elementById('page-content').text()).toBe('Content') + }) + + it('shows a fallback when prefetch completed', async () => { + const resolveMetadataDuration = 5000 + const browser = await next.browser('/metadata-await-promise') + + if (!isNextDev) { + await waitFor(resolveMetadataDuration + 500) + } + await browser + .elementByCss("[href='/metadata-await-promise/nested']") + .click() + + if (!isNextDev) { + expect( + await browser + .waitForElementByCss( + '#loading', + // Give it some time to commit + 100 + ) + .text() + ).toEqual('Loading') expect(await browser.elementByCss('title').text()).toBe('Async Title') - }) + + await waitFor(resolveMetadataDuration + 500) + } + + expect(await browser.elementById('page-content').text()).toBe('Content') }) }) From 199d2e967badc463a2d7ea2dfd762ad9a0c49981 Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Sun, 24 Nov 2024 16:19:33 +0100 Subject: [PATCH 07/82] Revert "ensure webpack worker exits bubble to parent process (#72921)" (#73136) --- .../next/src/build/webpack-build/index.ts | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/packages/next/src/build/webpack-build/index.ts b/packages/next/src/build/webpack-build/index.ts index e1e9fc0e1638d..c88c6781d7239 100644 --- a/packages/next/src/build/webpack-build/index.ts +++ b/packages/next/src/build/webpack-build/index.ts @@ -2,8 +2,9 @@ import type { COMPILER_INDEXES } from '../../shared/lib/constants' import * as Log from '../output/log' import { NextBuildContext } from '../build-context' import type { BuildTraceContext } from '../webpack/plugins/next-trace-entrypoints-plugin' -import { Worker } from '../../lib/worker' +import { Worker } from 'next/dist/compiled/jest-worker' import origDebug from 'next/dist/compiled/debug' +import type { ChildProcess } from 'child_process' import path from 'path' import { exportTraceState, recordTraceEvents } from '../../trace' @@ -37,17 +38,35 @@ async function webpackBuildWithWorker( prunedBuildContext.pluginState = pluginState - const worker = new Worker(path.join(__dirname, 'impl.js'), { - exposedMethods: ['workerMain'], - numWorkers: 1, - maxRetries: 0, - forkOptions: { - env: { - ...process.env, - NEXT_PRIVATE_BUILD_WORKER: '1', + const getWorker = (compilerName: string) => { + const _worker = new Worker(path.join(__dirname, 'impl.js'), { + exposedMethods: ['workerMain'], + numWorkers: 1, + maxRetries: 0, + forkOptions: { + env: { + ...process.env, + NEXT_PRIVATE_BUILD_WORKER: '1', + }, }, - }, - }) as Worker & typeof import('./impl') + }) as Worker & typeof import('./impl') + _worker.getStderr().pipe(process.stderr) + _worker.getStdout().pipe(process.stdout) + + for (const worker of ((_worker as any)._workerPool?._workers || []) as { + _child: ChildProcess + }[]) { + worker._child.on('exit', (code, signal) => { + if (code || (signal && signal !== 'SIGINT')) { + debug( + `Compiler ${compilerName} unexpectedly exited with code: ${code} and signal: ${signal}` + ) + } + }) + } + + return _worker + } const combinedResult = { duration: 0, @@ -55,6 +74,8 @@ async function webpackBuildWithWorker( } for (const compilerName of compilerNames) { + const worker = getWorker(compilerName) + const curResult = await worker.workerMain({ buildContext: prunedBuildContext, compilerName, @@ -67,6 +88,8 @@ async function webpackBuildWithWorker( if (nextBuildSpan && curResult.debugTraceEvents) { recordTraceEvents(curResult.debugTraceEvents) } + // destroy worker so it's not sticking around using memory + await worker.end() // Update plugin state pluginState = deepMerge(pluginState, curResult.pluginState) @@ -102,9 +125,6 @@ async function webpackBuildWithWorker( } } - // destroy worker so it's not sticking around using memory - worker.end() - if (compilerNames.length === 3) { Log.event('Compiled successfully') } From 1bda67f755c86213ea8e5616525dedf0114fe88c Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Sun, 24 Nov 2024 16:05:33 +0000 Subject: [PATCH 08/82] v15.0.4-canary.26 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 27d2c80aa62be..2a42d07043277 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.4-canary.25" + "version": "15.0.4-canary.26" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 78901a5e6a0a6..5090d5775d272 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 46ab72f55e66d..d7865b7751e5d 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/api-reference/config/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.4-canary.25", + "@next/eslint-plugin-next": "15.0.4-canary.26", "@rushstack/eslint-patch": "^1.10.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 2a4e6ca9f70d8..c0edef2482496 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 41e6f17982e76..1be710bc2b699 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 8475578289d66..b47de3a135a87 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 41f511ff7cc38..c0786898f238c 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 6828b92cc3cd6..44b8705621143 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 5736129929548..a3e8d54161c4a 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 49c849c428813..16bd34a4c3228 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index f946dda00b253..eb8ae614cd5a1 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index d435aaec77a2a..ef848acda3ed5 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 747f90ef38705..e607c606eff4b 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index f5358dfaca0b3..bdc39869dfa46 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -97,7 +97,7 @@ ] }, "dependencies": { - "@next/env": "15.0.4-canary.25", + "@next/env": "15.0.4-canary.26", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.13", "busboy": "1.6.0", @@ -161,11 +161,11 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/font": "15.0.4-canary.25", - "@next/polyfill-module": "15.0.4-canary.25", - "@next/polyfill-nomodule": "15.0.4-canary.25", - "@next/react-refresh-utils": "15.0.4-canary.25", - "@next/swc": "15.0.4-canary.25", + "@next/font": "15.0.4-canary.26", + "@next/polyfill-module": "15.0.4-canary.26", + "@next/polyfill-nomodule": "15.0.4-canary.26", + "@next/react-refresh-utils": "15.0.4-canary.26", + "@next/swc": "15.0.4-canary.26", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.9.2-nightly-20241111.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index e4ab31455c0e2..a33cfea426213 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index b988edc521335..b8f362fa86f49 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.4-canary.25", + "version": "15.0.4-canary.26", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.4-canary.25", + "next": "15.0.4-canary.26", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "5.6.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 209d17705c6b4..032af49362187 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -795,7 +795,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.10.3 @@ -859,7 +859,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -987,19 +987,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../font '@next/polyfill-module': - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1633,7 +1633,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.4-canary.25 + specifier: 15.0.4-canary.26 version: link:../next outdent: specifier: 0.8.0 From 603f2e0f2f617939b924c94e5dc39bb522b0378e Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Sun, 24 Nov 2024 09:19:00 -0800 Subject: [PATCH 09/82] Reapply "ensure webpack worker exits bubble to parent process (#72921)" (#73138) This relands #72921 to be a more minimal refactor. This re-applies the core change to use the existing worker that has proper error bubbling handling without changing the worker lifecycle. For the purposes of the internal OOM we were seeing, this ensures that any custom `max-old-space-size` flags are preserved during the webpack build step, even when using the shared worker. Instead, I moved it to `createStaticWorker`, as that was where it was intended to be respected when it landed in #46705. --- packages/next/src/build/index.ts | 12 ++++- .../next/src/build/webpack-build/index.ts | 44 +++++++------------ packages/next/src/lib/worker.ts | 11 ----- 3 files changed, 26 insertions(+), 41 deletions(-) diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index d2f9650b1b98b..2533f50a21efe 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -216,6 +216,10 @@ import { inlineStaticEnv } from './flying-shuttle/inline-static-env' import { FallbackMode, fallbackModeToFallbackField } from '../lib/fallback' import { RenderingMode } from './rendering-mode' import { getParamKeys } from '../server/request/fallback-params' +import { + formatNodeOptions, + getParsedNodeOptionsWithoutInspect, +} from '../server/lib/utils' type Fallback = null | boolean | string @@ -684,6 +688,12 @@ export function createStaticWorker( clear: () => void } ): StaticWorker { + // Get the node options without inspect and also remove the + // --max-old-space-size flag as it can cause memory issues. + const nodeOptions = getParsedNodeOptionsWithoutInspect() + delete nodeOptions['max-old-space-size'] + delete nodeOptions['max_old_space_size'] + return new Worker(staticWorkerPath, { logger: Log, numWorkers: getNumberOfWorkers(config), @@ -694,7 +704,7 @@ export function createStaticWorker( progress?.clear() }, forkOptions: { - env: process.env, + env: { ...process.env, NODE_OPTIONS: formatNodeOptions(nodeOptions) }, }, enableWorkerThreads: config.experimental.workerThreads, exposedMethods: staticWorkerExposedMethods, diff --git a/packages/next/src/build/webpack-build/index.ts b/packages/next/src/build/webpack-build/index.ts index c88c6781d7239..3537041cf7a19 100644 --- a/packages/next/src/build/webpack-build/index.ts +++ b/packages/next/src/build/webpack-build/index.ts @@ -2,11 +2,14 @@ import type { COMPILER_INDEXES } from '../../shared/lib/constants' import * as Log from '../output/log' import { NextBuildContext } from '../build-context' import type { BuildTraceContext } from '../webpack/plugins/next-trace-entrypoints-plugin' -import { Worker } from 'next/dist/compiled/jest-worker' +import { Worker } from '../../lib/worker' import origDebug from 'next/dist/compiled/debug' -import type { ChildProcess } from 'child_process' import path from 'path' import { exportTraceState, recordTraceEvents } from '../../trace' +import { + formatNodeOptions, + getParsedNodeOptionsWithoutInspect, +} from '../../server/lib/utils' const debug = origDebug('next:build:webpack-build') @@ -38,8 +41,15 @@ async function webpackBuildWithWorker( prunedBuildContext.pluginState = pluginState - const getWorker = (compilerName: string) => { - const _worker = new Worker(path.join(__dirname, 'impl.js'), { + const combinedResult = { + duration: 0, + buildTraceContext: {} as BuildTraceContext, + } + + const nodeOptions = getParsedNodeOptionsWithoutInspect() + + for (const compilerName of compilerNames) { + const worker = new Worker(path.join(__dirname, 'impl.js'), { exposedMethods: ['workerMain'], numWorkers: 1, maxRetries: 0, @@ -47,34 +57,10 @@ async function webpackBuildWithWorker( env: { ...process.env, NEXT_PRIVATE_BUILD_WORKER: '1', + NODE_OPTIONS: formatNodeOptions(nodeOptions), }, }, }) as Worker & typeof import('./impl') - _worker.getStderr().pipe(process.stderr) - _worker.getStdout().pipe(process.stdout) - - for (const worker of ((_worker as any)._workerPool?._workers || []) as { - _child: ChildProcess - }[]) { - worker._child.on('exit', (code, signal) => { - if (code || (signal && signal !== 'SIGINT')) { - debug( - `Compiler ${compilerName} unexpectedly exited with code: ${code} and signal: ${signal}` - ) - } - }) - } - - return _worker - } - - const combinedResult = { - duration: 0, - buildTraceContext: {} as BuildTraceContext, - } - - for (const compilerName of compilerNames) { - const worker = getWorker(compilerName) const curResult = await worker.workerMain({ buildContext: prunedBuildContext, diff --git a/packages/next/src/lib/worker.ts b/packages/next/src/lib/worker.ts index aeeeaa1d59338..1adddc8b418d4 100644 --- a/packages/next/src/lib/worker.ts +++ b/packages/next/src/lib/worker.ts @@ -1,9 +1,5 @@ import type { ChildProcess } from 'child_process' import { Worker as JestWorker } from 'next/dist/compiled/jest-worker' -import { - getParsedNodeOptionsWithoutInspect, - formatNodeOptions, -} from '../server/lib/utils' import { Transform } from 'stream' type FarmOptions = ConstructorParameters[1] @@ -47,12 +43,6 @@ export class Worker { }) const createWorker = () => { - // Get the node options without inspect and also remove the - // --max-old-space-size flag as it can cause memory issues. - const nodeOptions = getParsedNodeOptionsWithoutInspect() - delete nodeOptions['max-old-space-size'] - delete nodeOptions['max_old_space_size'] - this._worker = new JestWorker(workerPath, { ...farmOptions, forkOptions: { @@ -60,7 +50,6 @@ export class Worker { env: { ...((farmOptions.forkOptions?.env || {}) as any), ...process.env, - NODE_OPTIONS: formatNodeOptions(nodeOptions), } as any, }, maxRetries: 0, From 28a25af1d615cc076f69cad3d3cf76abaa9c236b Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Sun, 24 Nov 2024 19:06:08 +0100 Subject: [PATCH 10/82] Upgrade React from 380f5d67-20241113 to b01722d5-20241114 (#73107) Co-authored-by: vercel-release-bot --- examples/reproduction-template/package.json | 4 +- package.json | 34 +- packages/create-next-app/templates/index.ts | 2 +- packages/next/package.json | 4 +- .../cjs/react-dom-client.development.js | 887 +++++++------ .../cjs/react-dom-client.production.js | 839 +++++++------ .../cjs/react-dom-profiling.development.js | 887 +++++++------ .../cjs/react-dom-profiling.profiling.js | 1105 +++++++++-------- ...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 | 887 +++++++------ .../react-dom-unstable_testing.production.js | 839 +++++++------ .../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 | 707 ++++++----- .../cjs/react-dom-client.production.js | 837 +++++++------ .../cjs/react-dom-profiling.development.js | 707 ++++++----- .../cjs/react-dom-profiling.profiling.js | 921 +++++++------- ...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 | 4 +- .../package.json | 4 +- ...om-turbopack-client.browser.development.js | 4 +- .../react-server-dom-turbopack/package.json | 4 +- ...-dom-webpack-client.browser.development.js | 4 +- .../package.json | 4 +- ...-dom-webpack-client.browser.development.js | 4 +- .../react-server-dom-webpack/package.json | 4 +- .../compiled/react/cjs/react.development.js | 7 +- .../compiled/react/cjs/react.production.js | 7 +- .../cjs/react.react-server.development.js | 2 +- .../cjs/react.react-server.production.js | 2 +- .../next/src/compiled/unistore/unistore.js | 2 +- packages/third-parties/package.json | 2 +- pnpm-lock.yaml | 376 +++--- run-tests.js | 2 +- test/.stats-app/package.json | 4 +- .../e2e/app-dir/navigation/navigation.test.ts | 15 +- .../first-time-setup-js/package.json | 4 +- .../first-time-setup-ts/package.json | 4 +- test/lib/next-modes/base.ts | 2 +- 72 files changed, 5102 insertions(+), 4153 deletions(-) diff --git a/examples/reproduction-template/package.json b/examples/reproduction-template/package.json index 5bd4480086b6a..35491cf7e18d7 100644 --- a/examples/reproduction-template/package.json +++ b/examples/reproduction-template/package.json @@ -7,8 +7,8 @@ }, "dependencies": { "next": "canary", - "react": "19.0.0-rc-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113" + "react": "19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114" }, "devDependencies": { "@types/node": "20.12.12", diff --git a/package.json b/package.json index 89ba79ec92f87..09ca4af8dc4e1 100644 --- a/package.json +++ b/package.json @@ -209,19 +209,19 @@ "pretty-bytes": "5.3.0", "pretty-ms": "7.0.0", "random-seed": "0.3.0", - "react": "19.0.0-rc-380f5d67-20241113", + "react": "19.0.0-rc-b01722d5-20241114", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@19.0.0-rc-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113", + "react-builtin": "npm:react@19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@19.0.0-rc-380f5d67-20241113", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-380f5d67-20241113", - "react-experimental-builtin": "npm:react@0.0.0-experimental-380f5d67-20241113", - "react-is-builtin": "npm:react-is@19.0.0-rc-380f5d67-20241113", - "react-server-dom-turbopack": "19.0.0-rc-380f5d67-20241113", - "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-380f5d67-20241113", - "react-server-dom-webpack": "19.0.0-rc-380f5d67-20241113", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-380f5d67-20241113", + "react-dom-builtin": "npm:react-dom@19.0.0-rc-b01722d5-20241114", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-b01722d5-20241114", + "react-experimental-builtin": "npm:react@0.0.0-experimental-b01722d5-20241114", + "react-is-builtin": "npm:react-is@19.0.0-rc-b01722d5-20241114", + "react-server-dom-turbopack": "19.0.0-rc-b01722d5-20241114", + "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-b01722d5-20241114", + "react-server-dom-webpack": "19.0.0-rc-b01722d5-20241114", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-b01722d5-20241114", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -231,8 +231,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.10.9", - "scheduler-builtin": "npm:scheduler@0.25.0-rc-380f5d67-20241113", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-380f5d67-20241113", + "scheduler-builtin": "npm:scheduler@0.25.0-rc-b01722d5-20241114", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-b01722d5-20241114", "seedrandom": "3.0.5", "semver": "7.3.7", "shell-quote": "1.7.3", @@ -272,10 +272,10 @@ "@babel/traverse": "7.22.5", "@types/react": "npm:types-react@19.0.0-rc.0", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0", - "react": "19.0.0-rc-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113", - "react-is": "19.0.0-rc-380f5d67-20241113", - "scheduler": "0.25.0-rc-380f5d67-20241113" + "react": "19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114", + "react-is": "19.0.0-rc-b01722d5-20241114", + "scheduler": "0.25.0-rc-b01722d5-20241114" }, "patchedDependencies": { "webpack-sources@3.2.3": "patches/webpack-sources@3.2.3.patch" diff --git a/packages/create-next-app/templates/index.ts b/packages/create-next-app/templates/index.ts index 21bdfd98c4bb4..5e564a4e1ce0b 100644 --- a/packages/create-next-app/templates/index.ts +++ b/packages/create-next-app/templates/index.ts @@ -13,7 +13,7 @@ import { GetTemplateFileArgs, InstallTemplateArgs } from "./types"; // Do not rename or format. sync-react script relies on this line. // prettier-ignore -const nextjsReactPeerVersion = "19.0.0-rc-380f5d67-20241113"; +const nextjsReactPeerVersion = "19.0.0-rc-b01722d5-20241114"; /** * Get the file path for a given file in a template, e.g. "next.config.js". diff --git a/packages/next/package.json b/packages/next/package.json index bdc39869dfa46..8a424560f29a1 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -109,8 +109,8 @@ "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", "babel-plugin-react-compiler": "*", - "react": "^18.2.0 || 19.0.0-rc-380f5d67-20241113", - "react-dom": "^18.2.0 || 19.0.0-rc-380f5d67-20241113", + "react": "^18.2.0 || 19.0.0-rc-b01722d5-20241114", + "react-dom": "^18.2.0 || 19.0.0-rc-b01722d5-20241114", "sass": "^1.3.0" }, "peerDependenciesMeta": { 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 56815ee206978..3578695bbb18f 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 @@ -1035,28 +1035,40 @@ var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -1141,7 +1153,9 @@ root, finishedLanes, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; @@ -1152,17 +1166,17 @@ root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index; - finishedLanes[index] = 0; + var index = 31 - clz32(remainingLanes), + lane = 1 << index; + entanglements[index] = 0; expirationTimes[index] = -1; var hiddenUpdatesForLane = hiddenUpdates[index]; if (null !== hiddenUpdatesForLane) @@ -1174,9 +1188,14 @@ var update = hiddenUpdatesForLane[index]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -3779,31 +3798,31 @@ } function logRenderPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Render", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Render", reusableLaneOptions)); } function logSuspenseThrottlePhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Throttled", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Throttled", reusableLaneOptions)); } function logSuspendedCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Suspended", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Suspended", reusableLaneOptions)); } function logCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Commit", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Commit", reusableLaneOptions)); } function finishQueueingConcurrentUpdates() { for ( @@ -4029,14 +4048,24 @@ JSCompiler_temp ? 0 > blockingUpdateTime && ((blockingUpdateTime = now()), - (blockingEventTime = resolveEventTimeStamp()), - (blockingEventType = resolveEventType())) + (lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (blockingEventIsRepeat = + lane === blockingEventTime && + JSCompiler_temp === blockingEventType), + (blockingEventTime = lane), + (blockingEventType = JSCompiler_temp)) : 0 !== (lane & 4194176) && 0 > transitionUpdateTime && ((transitionUpdateTime = now()), 0 > transitionStartTime && - ((transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType()))); + ((lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (transitionEventIsRepeat = + lane === transitionEventTime && + JSCompiler_temp === transitionEventType), + (transitionEventTime = lane), + (transitionEventType = JSCompiler_temp))); } function pushNestedEffectDurations() { var prevEffectDuration = profilerEffectDuration; @@ -8908,33 +8937,33 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_componentStack_2295; - var JSCompiler_object_inline_stack_2294 = workInProgress.pendingProps; + var JSCompiler_object_inline_componentStack_2309; + var JSCompiler_object_inline_stack_2308 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_message_2292 = !1; + var JSCompiler_object_inline_message_2306 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_componentStack_2295 = didSuspend) || - (JSCompiler_object_inline_componentStack_2295 = + (JSCompiler_object_inline_componentStack_2309 = didSuspend) || + (JSCompiler_object_inline_componentStack_2309 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_componentStack_2295 && - ((JSCompiler_object_inline_message_2292 = !0), + JSCompiler_object_inline_componentStack_2309 && + ((JSCompiler_object_inline_message_2306 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_componentStack_2295 = + JSCompiler_object_inline_componentStack_2309 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_message_2292 + JSCompiler_object_inline_message_2306 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_digest_2293 = nextHydratableInstance; + var JSCompiler_object_inline_digest_2307 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2293)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2307)) { c: { - var instance = JSCompiler_object_inline_digest_2293; + var instance = JSCompiler_object_inline_digest_2307; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8975,19 +9004,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_digest_2293 + JSCompiler_object_inline_digest_2307 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_digest_2293 = workInProgress.memoizedState; + JSCompiler_object_inline_digest_2307 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_digest_2293 && - ((JSCompiler_object_inline_digest_2293 = - JSCompiler_object_inline_digest_2293.dehydrated), - null !== JSCompiler_object_inline_digest_2293) + null !== JSCompiler_object_inline_digest_2307 && + ((JSCompiler_object_inline_digest_2307 = + JSCompiler_object_inline_digest_2307.dehydrated), + null !== JSCompiler_object_inline_digest_2307) ) return ( - JSCompiler_object_inline_digest_2293.data === + JSCompiler_object_inline_digest_2307.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -8995,68 +9024,68 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_digest_2293 = - JSCompiler_object_inline_stack_2294.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2294.fallback; - if (JSCompiler_object_inline_message_2292) + JSCompiler_object_inline_digest_2307 = + JSCompiler_object_inline_stack_2308.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2308.fallback; + if (JSCompiler_object_inline_message_2306) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2294 = + (JSCompiler_object_inline_stack_2308 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2293, + JSCompiler_object_inline_digest_2307, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2292 = workInProgress.child), - (JSCompiler_object_inline_message_2292.memoizedState = + (JSCompiler_object_inline_message_2306 = workInProgress.child), + (JSCompiler_object_inline_message_2306.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2292.childLanes = + (JSCompiler_object_inline_message_2306.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2295, + JSCompiler_object_inline_componentStack_2309, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2294 + JSCompiler_object_inline_stack_2308 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2294.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2308.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2294 = + (JSCompiler_object_inline_stack_2308 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2293, + JSCompiler_object_inline_digest_2307, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2292 = workInProgress.child), - (JSCompiler_object_inline_message_2292.memoizedState = + (JSCompiler_object_inline_message_2306 = workInProgress.child), + (JSCompiler_object_inline_message_2306.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2292.childLanes = + (JSCompiler_object_inline_message_2306.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2295, + JSCompiler_object_inline_componentStack_2309, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2294 + JSCompiler_object_inline_stack_2308 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_digest_2293 + JSCompiler_object_inline_digest_2307 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_digest_2293 = prevState.dehydrated), - null !== JSCompiler_object_inline_digest_2293) + ((JSCompiler_object_inline_digest_2307 = prevState.dehydrated), + null !== JSCompiler_object_inline_digest_2307) ) { if (didSuspend) workInProgress.flags & 256 @@ -9073,95 +9102,95 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2292 = - JSCompiler_object_inline_stack_2294.fallback), - (JSCompiler_object_inline_digest_2293 = workInProgress.mode), - (JSCompiler_object_inline_stack_2294 = + (JSCompiler_object_inline_message_2306 = + JSCompiler_object_inline_stack_2308.fallback), + (JSCompiler_object_inline_digest_2307 = workInProgress.mode), + (JSCompiler_object_inline_stack_2308 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2294.children + children: JSCompiler_object_inline_stack_2308.children }, - JSCompiler_object_inline_digest_2293 + JSCompiler_object_inline_digest_2307 )), - (JSCompiler_object_inline_message_2292 = + (JSCompiler_object_inline_message_2306 = createFiberFromFragment( - JSCompiler_object_inline_message_2292, - JSCompiler_object_inline_digest_2293, + JSCompiler_object_inline_message_2306, + JSCompiler_object_inline_digest_2307, renderLanes, null )), - (JSCompiler_object_inline_message_2292.flags |= 2), - (JSCompiler_object_inline_stack_2294.return = workInProgress), - (JSCompiler_object_inline_message_2292.return = workInProgress), - (JSCompiler_object_inline_stack_2294.sibling = - JSCompiler_object_inline_message_2292), - (workInProgress.child = JSCompiler_object_inline_stack_2294), + (JSCompiler_object_inline_message_2306.flags |= 2), + (JSCompiler_object_inline_stack_2308.return = workInProgress), + (JSCompiler_object_inline_message_2306.return = workInProgress), + (JSCompiler_object_inline_stack_2308.sibling = + JSCompiler_object_inline_message_2306), + (workInProgress.child = JSCompiler_object_inline_stack_2308), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2294 = workInProgress.child), - (JSCompiler_object_inline_stack_2294.memoizedState = + (JSCompiler_object_inline_stack_2308 = workInProgress.child), + (JSCompiler_object_inline_stack_2308.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2294.childLanes = + (JSCompiler_object_inline_stack_2308.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2295, + JSCompiler_object_inline_componentStack_2309, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress = JSCompiler_object_inline_message_2292)); + (workInProgress = JSCompiler_object_inline_message_2306)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_digest_2293.data === + JSCompiler_object_inline_digest_2307.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_componentStack_2295 = - JSCompiler_object_inline_digest_2293.nextSibling && - JSCompiler_object_inline_digest_2293.nextSibling.dataset; - if (JSCompiler_object_inline_componentStack_2295) { - JSCompiler_temp = JSCompiler_object_inline_componentStack_2295.dgst; - var message = JSCompiler_object_inline_componentStack_2295.msg; - instance = JSCompiler_object_inline_componentStack_2295.stck; + JSCompiler_object_inline_componentStack_2309 = + JSCompiler_object_inline_digest_2307.nextSibling && + JSCompiler_object_inline_digest_2307.nextSibling.dataset; + if (JSCompiler_object_inline_componentStack_2309) { + JSCompiler_temp = JSCompiler_object_inline_componentStack_2309.dgst; + var message = JSCompiler_object_inline_componentStack_2309.msg; + instance = JSCompiler_object_inline_componentStack_2309.stck; var componentStack = - JSCompiler_object_inline_componentStack_2295.cstck; + JSCompiler_object_inline_componentStack_2309.cstck; } - JSCompiler_object_inline_message_2292 = message; - JSCompiler_object_inline_digest_2293 = JSCompiler_temp; - JSCompiler_object_inline_stack_2294 = instance; - JSCompiler_temp = JSCompiler_object_inline_componentStack_2295 = + JSCompiler_object_inline_message_2306 = message; + JSCompiler_object_inline_digest_2307 = JSCompiler_temp; + JSCompiler_object_inline_stack_2308 = instance; + JSCompiler_temp = JSCompiler_object_inline_componentStack_2309 = componentStack; - "POSTPONE" !== JSCompiler_object_inline_digest_2293 && - ((JSCompiler_object_inline_componentStack_2295 = - JSCompiler_object_inline_message_2292 - ? Error(JSCompiler_object_inline_message_2292) + "POSTPONE" !== JSCompiler_object_inline_digest_2307 && + ((JSCompiler_object_inline_componentStack_2309 = + JSCompiler_object_inline_message_2306 + ? Error(JSCompiler_object_inline_message_2306) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), - (JSCompiler_object_inline_componentStack_2295.stack = - JSCompiler_object_inline_stack_2294 || ""), - (JSCompiler_object_inline_componentStack_2295.digest = - JSCompiler_object_inline_digest_2293), - (JSCompiler_object_inline_stack_2294 = + (JSCompiler_object_inline_componentStack_2309.stack = + JSCompiler_object_inline_stack_2308 || ""), + (JSCompiler_object_inline_componentStack_2309.digest = + JSCompiler_object_inline_digest_2307), + (JSCompiler_object_inline_stack_2308 = void 0 === JSCompiler_temp ? null : JSCompiler_temp), - (JSCompiler_object_inline_message_2292 = { - value: JSCompiler_object_inline_componentStack_2295, + (JSCompiler_object_inline_message_2306 = { + value: JSCompiler_object_inline_componentStack_2309, source: null, - stack: JSCompiler_object_inline_stack_2294 + stack: JSCompiler_object_inline_stack_2308 }), - "string" === typeof JSCompiler_object_inline_stack_2294 && + "string" === typeof JSCompiler_object_inline_stack_2308 && CapturedStacks.set( - JSCompiler_object_inline_componentStack_2295, - JSCompiler_object_inline_message_2292 + JSCompiler_object_inline_componentStack_2309, + JSCompiler_object_inline_message_2306 ), - queueHydrationError(JSCompiler_object_inline_message_2292)); + queueHydrationError(JSCompiler_object_inline_message_2306)); workInProgress = retrySuspenseComponentWithoutHydrating( current, workInProgress, @@ -9175,25 +9204,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_componentStack_2295 = + (JSCompiler_object_inline_componentStack_2309 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_componentStack_2295) + didReceiveUpdate || JSCompiler_object_inline_componentStack_2309) ) { - JSCompiler_object_inline_componentStack_2295 = workInProgressRoot; - if (null !== JSCompiler_object_inline_componentStack_2295) { - JSCompiler_object_inline_stack_2294 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2294 & 42)) - JSCompiler_object_inline_stack_2294 = 1; + JSCompiler_object_inline_componentStack_2309 = workInProgressRoot; + if (null !== JSCompiler_object_inline_componentStack_2309) { + JSCompiler_object_inline_stack_2308 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2308 & 42)) + JSCompiler_object_inline_stack_2308 = 1; else - switch (JSCompiler_object_inline_stack_2294) { + switch (JSCompiler_object_inline_stack_2308) { case 2: - JSCompiler_object_inline_stack_2294 = 1; + JSCompiler_object_inline_stack_2308 = 1; break; case 8: - JSCompiler_object_inline_stack_2294 = 4; + JSCompiler_object_inline_stack_2308 = 4; break; case 32: - JSCompiler_object_inline_stack_2294 = 16; + JSCompiler_object_inline_stack_2308 = 16; break; case 128: case 256: @@ -9214,40 +9243,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2294 = 64; + JSCompiler_object_inline_stack_2308 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2294 = 134217728; + JSCompiler_object_inline_stack_2308 = 134217728; break; default: - JSCompiler_object_inline_stack_2294 = 0; + JSCompiler_object_inline_stack_2308 = 0; } - JSCompiler_object_inline_stack_2294 = + JSCompiler_object_inline_stack_2308 = 0 !== - (JSCompiler_object_inline_stack_2294 & - (JSCompiler_object_inline_componentStack_2295.suspendedLanes | + (JSCompiler_object_inline_stack_2308 & + (JSCompiler_object_inline_componentStack_2309.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2294; + : JSCompiler_object_inline_stack_2308; if ( - 0 !== JSCompiler_object_inline_stack_2294 && - JSCompiler_object_inline_stack_2294 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2308 && + JSCompiler_object_inline_stack_2308 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2294), + ((prevState.retryLane = JSCompiler_object_inline_stack_2308), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2294 + JSCompiler_object_inline_stack_2308 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_componentStack_2295, + JSCompiler_object_inline_componentStack_2309, current, - JSCompiler_object_inline_stack_2294 + JSCompiler_object_inline_stack_2308 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_digest_2293.data === + JSCompiler_object_inline_digest_2307.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9255,7 +9284,7 @@ renderLanes ); } else - JSCompiler_object_inline_digest_2293.data === + JSCompiler_object_inline_digest_2307.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9263,12 +9292,12 @@ null, current )), - (JSCompiler_object_inline_digest_2293._reactRetry = + (JSCompiler_object_inline_digest_2307._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_digest_2293.nextSibling + JSCompiler_object_inline_digest_2307.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9286,54 +9315,54 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2294.children + JSCompiler_object_inline_stack_2308.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_message_2292) + if (JSCompiler_object_inline_message_2306) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2292 = - JSCompiler_object_inline_stack_2294.fallback), - (JSCompiler_object_inline_digest_2293 = workInProgress.mode), + (JSCompiler_object_inline_message_2306 = + JSCompiler_object_inline_stack_2308.fallback), + (JSCompiler_object_inline_digest_2307 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2294 = createWorkInProgress( + (JSCompiler_object_inline_stack_2308 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2294.children + children: JSCompiler_object_inline_stack_2308.children } )), - (JSCompiler_object_inline_stack_2294.subtreeFlags = + (JSCompiler_object_inline_stack_2308.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_message_2292 = createWorkInProgress( + ? (JSCompiler_object_inline_message_2306 = createWorkInProgress( instance, - JSCompiler_object_inline_message_2292 + JSCompiler_object_inline_message_2306 )) - : ((JSCompiler_object_inline_message_2292 = createFiberFromFragment( - JSCompiler_object_inline_message_2292, - JSCompiler_object_inline_digest_2293, + : ((JSCompiler_object_inline_message_2306 = createFiberFromFragment( + JSCompiler_object_inline_message_2306, + JSCompiler_object_inline_digest_2307, renderLanes, null )), - (JSCompiler_object_inline_message_2292.flags |= 2)), - (JSCompiler_object_inline_message_2292.return = workInProgress), - (JSCompiler_object_inline_stack_2294.return = workInProgress), - (JSCompiler_object_inline_stack_2294.sibling = - JSCompiler_object_inline_message_2292), - (workInProgress.child = JSCompiler_object_inline_stack_2294), - (JSCompiler_object_inline_stack_2294 = - JSCompiler_object_inline_message_2292), - (JSCompiler_object_inline_message_2292 = workInProgress.child), - (JSCompiler_object_inline_digest_2293 = current.child.memoizedState), - null === JSCompiler_object_inline_digest_2293 - ? (JSCompiler_object_inline_digest_2293 = + (JSCompiler_object_inline_message_2306.flags |= 2)), + (JSCompiler_object_inline_message_2306.return = workInProgress), + (JSCompiler_object_inline_stack_2308.return = workInProgress), + (JSCompiler_object_inline_stack_2308.sibling = + JSCompiler_object_inline_message_2306), + (workInProgress.child = JSCompiler_object_inline_stack_2308), + (JSCompiler_object_inline_stack_2308 = + JSCompiler_object_inline_message_2306), + (JSCompiler_object_inline_message_2306 = workInProgress.child), + (JSCompiler_object_inline_digest_2307 = current.child.memoizedState), + null === JSCompiler_object_inline_digest_2307 + ? (JSCompiler_object_inline_digest_2307 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_digest_2293.cachePool), + JSCompiler_object_inline_digest_2307.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9341,38 +9370,38 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_digest_2293 = { + (JSCompiler_object_inline_digest_2307 = { baseLanes: - JSCompiler_object_inline_digest_2293.baseLanes | renderLanes, + JSCompiler_object_inline_digest_2307.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_message_2292.memoizedState = - JSCompiler_object_inline_digest_2293), - (JSCompiler_object_inline_message_2292.childLanes = + (JSCompiler_object_inline_message_2306.memoizedState = + JSCompiler_object_inline_digest_2307), + (JSCompiler_object_inline_message_2306.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2295, + JSCompiler_object_inline_componentStack_2309, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2294 + JSCompiler_object_inline_stack_2308 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2294.children + children: JSCompiler_object_inline_stack_2308.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_componentStack_2295 = + ((JSCompiler_object_inline_componentStack_2309 = workInProgress.deletions), - null === JSCompiler_object_inline_componentStack_2295 + null === JSCompiler_object_inline_componentStack_2309 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_componentStack_2295.push(current)); + : JSCompiler_object_inline_componentStack_2309.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -13786,20 +13815,34 @@ (resource.state.loading & Inserted) !== NotLoaded ) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if ( + ((workInProgress.flags |= 16777216), !preloadResource(resource)) + ) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -14596,7 +14639,8 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if ( @@ -14638,25 +14682,37 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root, lanes, forceSync) { if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (exitStatus === RootInProgress) break; - else if (exitStatus === RootDidNotComplete) - markRootSuspended(root, lanes, 0); + if (exitStatus === RootInProgress) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root, lanes, 0, !1); + break; + } else if (exitStatus === RootDidNotComplete) + finalizeRender(lanes, now$1()), + markRootSuspended( + root, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root.current.alternate; if ( @@ -14721,22 +14777,24 @@ } if (exitStatus === RootFatalErrored) { prepareFreshStack(root, 0); - markRootSuspended(root, lanes, 0); + markRootSuspended(root, lanes, 0, !0); break; } a: { - renderWasConcurrent = root; - errorRetryLanes = now$1(); + shouldTimeSlice = root; + renderWasConcurrent = now$1(); switch (exitStatus) { case RootInProgress: case RootFatalErrored: throw Error("Root did not complete. This is a bug in React."); case RootSuspendedWithDelay: if ((lanes & 4194176) === lanes) { + finalizeRender(lanes, now$1()); markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -14750,11 +14808,11 @@ default: throw Error("Unknown root exit status."); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if (null !== ReactSharedInternals.actQueue) commitRoot( - renderWasConcurrent, + shouldTimeSlice, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, @@ -14763,7 +14821,7 @@ workInProgressSuspendedRetryLanes, IMMEDIATE_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ); else { if ( @@ -14775,15 +14833,16 @@ 10 < exitStatus) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14795,14 +14854,14 @@ workInProgressRootDidSkipSuspendedSiblings, THROTTLED_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ), exitStatus ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14814,7 +14873,7 @@ workInProgressRootDidSkipSuspendedSiblings, IMMEDIATE_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ); } } @@ -14846,11 +14905,8 @@ completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -14872,7 +14928,12 @@ completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended( + root, + lanes, + spawnedLane, + !didSkipSuspendedSiblings + ); return; } commitRoot( @@ -14922,19 +14983,22 @@ } return !0; } - function markRootSuspended(root, suspendedLanes, spawnedLane) { + function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree + ) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { var index = 31 - clz32(lanes), lane = 1 << index; - expirationTimes[index] = -1; + didAttemptEntireTree[index] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -14964,80 +15028,91 @@ } function finalizeRender(lanes, finalizationTime) { if (0 !== (lanes & 3) || 0 !== (lanes & 60)) - 0 <= blockingUpdateTime && - blockingUpdateTime < finalizationTime && - (blockingUpdateTime = finalizationTime), - 0 <= blockingEventTime && - blockingEventTime < finalizationTime && - (blockingEventTime = finalizationTime); - 0 !== (lanes & 4194176) && - (0 <= transitionStartTime && - transitionStartTime < finalizationTime && - (transitionStartTime = finalizationTime), - 0 <= transitionUpdateTime && - transitionUpdateTime < finalizationTime && - (transitionUpdateTime = finalizationTime), - 0 <= transitionEventTime && - transitionEventTime < finalizationTime && - (transitionEventTime = finalizationTime)); + blockingClampTime = finalizationTime; + 0 !== (lanes & 4194176) && (transitionClampTime = finalizationTime); } function prepareFreshStack(root, lanes) { renderStartTime = now(); finalizeRender(workInProgressRootRenderLanes, renderStartTime); if (0 !== (lanes & 3) || 0 !== (lanes & 60)) { - var updateTime = blockingUpdateTime, - eventTime = blockingEventTime, + var updateTime = + 0 <= blockingUpdateTime && blockingUpdateTime < blockingClampTime + ? blockingClampTime + : blockingUpdateTime, + eventTime = + 0 <= blockingEventTime && blockingEventTime < blockingClampTime + ? blockingClampTime + : blockingEventTime, eventType = blockingEventType, + eventIsRepeat = blockingEventIsRepeat, renderStartTime$jscomp$0 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Blocking"), + ((reusableLaneDevToolDetails.track = "Blocking"), 0 < eventTime && null !== eventType && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = eventIsRepeat + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : renderStartTime$jscomp$0), - performance.measure(eventType, reusableComponentOptions)), + performance.measure( + eventIsRepeat ? "" : "Event: " + eventType, + reusableLaneOptions + )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = renderStartTime$jscomp$0), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = renderStartTime$jscomp$0), + performance.measure("Blocked", reusableLaneOptions))); blockingUpdateTime = -1.1; } if (0 !== (lanes & 4194176)) { - updateTime = transitionStartTime; - eventTime = transitionUpdateTime; - eventType = transitionEventTime; - renderStartTime$jscomp$0 = transitionEventType; + updateTime = + 0 <= transitionStartTime && transitionStartTime < transitionClampTime + ? transitionClampTime + : transitionStartTime; + eventTime = + 0 <= transitionUpdateTime && + transitionUpdateTime < transitionClampTime + ? transitionClampTime + : transitionUpdateTime; + eventType = + 0 <= transitionEventTime && transitionEventTime < transitionClampTime + ? transitionClampTime + : transitionEventTime; + eventIsRepeat = transitionEventType; + renderStartTime$jscomp$0 = transitionEventIsRepeat; var renderStartTime$jscomp$1 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Transition"), + ((reusableLaneDevToolDetails.track = "Transition"), 0 < eventType && - null !== renderStartTime$jscomp$0 && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventType), - (reusableComponentOptions.end = + null !== eventIsRepeat && + ((reusableLaneDevToolDetails.color = renderStartTime$jscomp$0 + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventType), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : 0 < eventTime ? eventTime : renderStartTime$jscomp$1), performance.measure( - renderStartTime$jscomp$0, - reusableComponentOptions + renderStartTime$jscomp$0 ? "" : "Event: " + eventIsRepeat, + reusableLaneOptions )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = 0 < eventTime ? eventTime : renderStartTime$jscomp$1), - performance.measure("Action", reusableComponentOptions)), + performance.measure("Action", reusableLaneOptions)), 0 < eventTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = renderStartTime$jscomp$1), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = renderStartTime$jscomp$1), + performance.measure("Blocked", reusableLaneOptions))); transitionUpdateTime = transitionStartTime = -1.1; } root.finishedWork = null; @@ -15054,7 +15129,7 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = RootInProgress; workInProgressSuspendedRetryLanes = @@ -15071,9 +15146,9 @@ if (0 !== eventTime) for (root = root.entanglements, eventTime &= lanes; 0 < eventTime; ) (eventType = 31 - clz32(eventTime)), - (renderStartTime$jscomp$0 = 1 << eventType), + (eventIsRepeat = 1 << eventType), (lanes |= root[eventType]), - (eventTime &= ~renderStartTime$jscomp$0); + (eventTime &= ~eventIsRepeat); entangledRenderLanes = lanes; finishQueueingConcurrentUpdates(); ReactStrictModeWarnings.discardPendingWarnings(); @@ -15087,12 +15162,7 @@ current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? SuspendedOnData - : SuspendedOnImmediate)) + (workInProgressSuspendedReason = SuspendedOnImmediate)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = SuspendedOnInstance)) @@ -15115,21 +15185,6 @@ : erroredWork.mode & ProfileMode && stopProfilerTimerIfRunningAndRecordDuration(erroredWork); } - function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; - } function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -15142,13 +15197,19 @@ } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = RootSuspendedWithDelay; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } function queueConcurrentError(error) { @@ -15156,7 +15217,7 @@ ? (workInProgressRootConcurrentErrors = [error]) : workInProgressRootConcurrentErrors.push(error); } - function renderRootSync(root, lanes) { + function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(), @@ -15198,6 +15259,13 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + memoizedUpdaters = RootInProgress; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -15246,7 +15314,11 @@ workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS; prepareFreshStack(root, lanes); - } else checkIfRootIsPrerendering(root, lanes); + } else + workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + ); a: do try { if ( @@ -15450,7 +15522,12 @@ stopProfilerTimerIfRunningAndRecordDuration(unitOfWork); return current; } - function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason + ) { resetContextDependencies(); resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -15484,9 +15561,25 @@ workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || suspendedReason === SuspendedOnError) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + suspendedReason === SuspendedOnData || + suspendedReason === SuspendedOnImmediate || + suspendedReason === SuspendedOnDeprecatedThrowPromise) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -15610,46 +15703,49 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - updatedLanes = root.finishedWork; + var finishedWork = root.finishedWork; didIncludeRenderPhaseUpdate = root.finishedLanes; - reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane( didIncludeRenderPhaseUpdate ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); - if (null === updatedLanes) return null; + if (null === finishedWork) return null; 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); root.finishedWork = null; root.finishedLanes = 0; - if (updatedLanes === root.current) + if (finishedWork === root.current) throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." ); root.callbackNode = null; root.callbackPriority = 0; root.cancelPendingCommit = null; - completedRenderStartTime = updatedLanes.lanes | updatedLanes.childLanes; + completedRenderStartTime = finishedWork.lanes | finishedWork.childLanes; completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, didIncludeRenderPhaseUpdate, completedRenderStartTime, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === updatedLanes.actualDuration && - 0 === (updatedLanes.subtreeFlags & 10256) && - 0 === (updatedLanes.flags & 10256)) || + (0 === finishedWork.actualDuration && + 0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), (pendingPassiveEffectsRemainingLanes = completedRenderStartTime), (pendingPassiveEffectsRenderEndTime = completedRenderEndTime), (pendingPassiveTransitions = transitions), scheduleCallback$1(NormalPriority$1, function () { + schedulerEvent = window.event; flushPassiveEffects(!0); return null; })); @@ -15658,33 +15754,38 @@ ? logSuspendedCommitPhase(completedRenderEndTime, commitStartTime) : suspendedCommitReason === THROTTLED_COMMIT && logSuspenseThrottlePhase(completedRenderEndTime, commitStartTime); - transitions = 0 !== (updatedLanes.flags & 15990); - 0 !== (updatedLanes.subtreeFlags & 15990) || transitions + transitions = 0 !== (finishedWork.flags & 15990); + 0 !== (finishedWork.subtreeFlags & 15990) || transitions ? ((transitions = ReactSharedInternals.T), (ReactSharedInternals.T = null), (spawnedLane = ReactDOMSharedInternals.p), (ReactDOMSharedInternals.p = DiscreteEventPriority), - (suspendedCommitReason = executionContext), + (updatedLanes = executionContext), (executionContext |= CommitContext), - commitBeforeMutationEffects(root, updatedLanes), + commitBeforeMutationEffects(root, finishedWork), commitMutationEffects( root, - updatedLanes, + finishedWork, didIncludeRenderPhaseUpdate ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), - (root.current = updatedLanes), - commitLayoutEffects(updatedLanes, root, didIncludeRenderPhaseUpdate), + (root.current = finishedWork), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), - (executionContext = suspendedCommitReason), + (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), (ReactSharedInternals.T = transitions)) - : (root.current = updatedLanes); + : (root.current = finishedWork); commitEndTime = now(); - logCommitPhase(commitStartTime, commitEndTime); - (transitions = rootDoesHavePassiveEffects) + logCommitPhase( + suspendedCommitReason === IMMEDIATE_COMMIT + ? completedRenderEndTime + : commitStartTime, + commitEndTime + ); + (suspendedCommitReason = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) @@ -15694,24 +15795,25 @@ completedRenderStartTime = root.pendingLanes; 0 === completedRenderStartTime && (legacyErrorBoundariesThatAlreadyFailed = null); - transitions || commitDoubleInvokeEffectsInDEV(root); - onCommitRoot$1(updatedLanes.stateNode, renderPriorityLevel); + suspendedCommitReason || commitDoubleInvokeEffectsInDEV(root); + onCommitRoot$1(finishedWork.stateNode, renderPriorityLevel); isDevToolsPresent && root.memoizedUpdaters.clear(); onCommitRoot(); ensureRootIsScheduled(root); if (null !== recoverableErrors) for ( - renderPriorityLevel = root.onRecoverableError, updatedLanes = 0; - updatedLanes < recoverableErrors.length; - updatedLanes++ + renderPriorityLevel = root.onRecoverableError, + completedRenderEndTime = 0; + completedRenderEndTime < recoverableErrors.length; + completedRenderEndTime++ ) - (completedRenderStartTime = recoverableErrors[updatedLanes]), - (spawnedLane = makeErrorInfo(completedRenderStartTime.stack)), + (finishedWork = recoverableErrors[completedRenderEndTime]), + (completedRenderStartTime = makeErrorInfo(finishedWork.stack)), runWithFiberInDEV( - completedRenderStartTime.source, + finishedWork.source, renderPriorityLevel, - completedRenderStartTime.value, - spawnedLane + finishedWork.value, + completedRenderStartTime ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; @@ -15722,7 +15824,8 @@ ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); + suspendedCommitReason || + finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -15774,7 +15877,7 @@ throw Error( "Cannot flush passive effects while already rendering." ); - reusableComponentDevToolDetails.track = + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane(lanes); isFlushingPassiveEffects = !0; didScheduleUpdateDuringPassiveEffects = !1; @@ -15782,15 +15885,16 @@ passiveEffectStartTime = now$1(); var startTime = commitEndTime, endTime = passiveEffectStartTime; + wasDelayedCommit = !!wasDelayedCommit; supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), performance.measure( - "Waiting for Paint", - reusableComponentOptions + wasDelayedCommit ? "Waiting for Paint" : "", + reusableLaneOptions )); - startTime = executionContext; + wasDelayedCommit = executionContext; executionContext |= CommitContext; var finishedWork = priority.current; resetComponentEffectTimers(); @@ -15806,18 +15910,14 @@ finishedWork ); commitDoubleInvokeEffectsInDEV(priority); - executionContext = startTime; + executionContext = wasDelayedCommit; var passiveEffectsEndTime = now$1(); - wasDelayedCommit && - ((wasDelayedCommit = passiveEffectStartTime), - supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = wasDelayedCommit), - (reusableComponentOptions.end = passiveEffectsEndTime), - performance.measure( - "Remaining Effects", - reusableComponentOptions - ))); + finishedWork$jscomp$0 = passiveEffectStartTime; + supportsUserTiming && + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = finishedWork$jscomp$0), + (reusableLaneOptions.end = passiveEffectsEndTime), + performance.measure("Remaining Effects", reusableLaneOptions)); finalizeRender(lanes, passiveEffectsEndTime); flushSyncWorkAcrossRoots_impl(0, !1); didScheduleUpdateDuringPassiveEffects @@ -16162,6 +16262,7 @@ } } function processRootScheduleInMicrotask() { + schedulerEvent = window.event; mightHavePendingSyncWork = didScheduleMicrotask_act = didScheduleMicrotask = @@ -16226,7 +16327,10 @@ (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) + if ( + 0 !== (suspendedLanes & 3) && + !checkIfRootIsPrerendering(root, suspendedLanes) + ) return ( null !== pingedLanes && cancelCallback(pingedLanes), (root.callbackPriority = 2), @@ -16266,6 +16370,7 @@ } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; + schedulerEvent = window.event; var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) return null; @@ -19398,11 +19503,11 @@ } function resolveEventType() { var event = window.event; - return event ? event.type : null; + return event && event !== schedulerEvent ? event.type : null; } function resolveEventTimeStamp() { var event = window.event; - return event ? event.timeStamp : -1.1; + return event && event !== schedulerEvent ? event.timeStamp : -1.1; } function handleErrorInNextTick(error) { setTimeout(function () { @@ -22500,14 +22605,24 @@ reusableComponentDevToolDetails = { dataType: "track-entry", color: "primary", - track: "Blocking", - trackGroup: "Components \u269b" + track: "Components \u269b" }, reusableComponentOptions = { start: -0, end: -0, detail: { devtools: reusableComponentDevToolDetails } }, + reusableLaneDevToolDetails = { + dataType: "track-entry", + color: "primary", + track: "Blocking", + trackGroup: "Scheduler \u269b" + }, + reusableLaneOptions = { + start: -0, + end: -0, + detail: { devtools: reusableLaneDevToolDetails } + }, OffscreenVisible = 1, OffscreenDetached = 2, OffscreenPassiveEffectsConnected = 4, @@ -22533,13 +22648,17 @@ componentEffectDuration = -0, componentEffectStartTime = -1.1, componentEffectEndTime = -1.1, + blockingClampTime = -0, blockingUpdateTime = -1.1, blockingEventTime = -1.1, blockingEventType = null, + blockingEventIsRepeat = !1, + transitionClampTime = -0, transitionStartTime = -1.1, transitionUpdateTime = -1.1, transitionEventTime = -1.1, transitionEventType = null, + transitionEventIsRepeat = !1, currentUpdateIsNested = !1, nestedUpdateScheduled = !1, ReactStrictModeWarnings = { @@ -22994,15 +23113,23 @@ currentEntangledActionThenable = null, prevOnStartTransitionFinish = ReactSharedInternals.S; ReactSharedInternals.S = function (transition, returnValue) { - "object" === typeof returnValue && + if ( + "object" === typeof returnValue && null !== returnValue && - "function" === typeof returnValue.then && - (0 > transitionStartTime && - 0 > transitionUpdateTime && - ((transitionStartTime = now()), - (transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType())), - entangleAsyncAction(transition, returnValue)); + "function" === typeof returnValue.then + ) { + if (0 > transitionStartTime && 0 > transitionUpdateTime) { + transitionStartTime = now(); + var newEventTime = resolveEventTimeStamp(), + newEventType = resolveEventType(); + transitionEventIsRepeat = + newEventTime === transitionEventTime && + newEventType === transitionEventType; + transitionEventTime = newEventTime; + transitionEventType = newEventType; + } + entangleAsyncAction(transition, returnValue); + } null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); }; @@ -24334,6 +24461,7 @@ workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = RootInProgress, @@ -24473,6 +24601,7 @@ selectionInformation = null, warnedUnknownTags = { dialog: !0, webview: !0 }, currentPopstateTransitionEvent = null, + schedulerEvent = void 0, scheduleTimeout = "function" === typeof setTimeout ? setTimeout : void 0, cancelTimeout = "function" === typeof clearTimeout ? clearTimeout : void 0, @@ -24913,11 +25042,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24954,11 +25083,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113" + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25100,7 +25229,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-experimental-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; "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 09595723f7156..898ac4402b5e2 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 @@ -599,28 +599,40 @@ function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -694,7 +706,14 @@ function markRootUpdated$1(root, updateLane) { 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } -function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { +function markRootFinished( + root, + finishedLanes, + remainingLanes, + spawnedLane, + updatedLanes, + suspendedRetryLanes +) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -704,31 +723,36 @@ function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index$6 = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index$6; - finishedLanes[index$6] = 0; - expirationTimes[index$6] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$6]; + var index$7 = 31 - clz32(remainingLanes), + lane = 1 << index$7; + entanglements[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$6] = null, index$6 = 0; - index$6 < hiddenUpdatesForLane.length; - index$6++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$6]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -743,10 +767,10 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$7 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$7; - (lane & entangledLanes) | (root[index$7] & entangledLanes) && - (root[index$7] |= entangledLanes); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } @@ -896,8 +920,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$9 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$9 && "aria-" !== prefix$9) { + var prefix$10 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$10 && "aria-" !== prefix$10) { node.removeAttribute(name); return; } @@ -1230,15 +1254,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$15 in styles) - (styleName = styles[styleName$15]), - styles.hasOwnProperty(styleName$15) && - prevStyles[styleName$15] !== styleName && - setValueForStyle(node, styleName$15, styleName); - } else for (var styleName$16 in styles) - styles.hasOwnProperty(styleName$16) && - setValueForStyle(node, styleName$16, styles[styleName$16]); + (styleName = styles[styleName$16]), + styles.hasOwnProperty(styleName$16) && + prevStyles[styleName$16] !== styleName && + setValueForStyle(node, styleName$16, styleName); + } else + for (var styleName$17 in styles) + styles.hasOwnProperty(styleName$17) && + setValueForStyle(node, styleName$17, styles[styleName$17]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -1967,19 +1991,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$281; + var JSCompiler_inline_result$jscomp$286; if (canUseDOM) { - var isSupported$jscomp$inline_415 = "oninput" in document; - if (!isSupported$jscomp$inline_415) { - var element$jscomp$inline_416 = document.createElement("div"); - element$jscomp$inline_416.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_415 = - "function" === typeof element$jscomp$inline_416.oninput; + var isSupported$jscomp$inline_420 = "oninput" in document; + if (!isSupported$jscomp$inline_420) { + var element$jscomp$inline_421 = document.createElement("div"); + element$jscomp$inline_421.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_420 = + "function" === typeof element$jscomp$inline_421.oninput; } - JSCompiler_inline_result$jscomp$281 = isSupported$jscomp$inline_415; - } else JSCompiler_inline_result$jscomp$281 = !1; + JSCompiler_inline_result$jscomp$286 = isSupported$jscomp$inline_420; + } else JSCompiler_inline_result$jscomp$286 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$281 && + JSCompiler_inline_result$jscomp$286 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -3923,7 +3947,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$54 = !1; + didReadFromEntangledAsyncAction$55 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3944,11 +3968,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$55 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$55 = !0); continue; } else (updateLane = { @@ -3994,7 +4018,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$54 && + didReadFromEntangledAsyncAction$55 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4196,8 +4220,8 @@ function runActionStateAction(actionQueue, node) { try { (prevTransition = action(prevState, payload)), handleActionReturnValue(actionQueue, node, prevTransition); - } catch (error$60) { - onActionError(actionQueue, node, error$60); + } catch (error$61) { + onActionError(actionQueue, node, error$61); } } function handleActionReturnValue(actionQueue, node, returnValue) { @@ -4650,14 +4674,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$63 = enqueueUpdate(provider, fiber, lane); - null !== root$63 && - (scheduleUpdateOnFiber(root$63, provider, lane), - entangleTransitions(root$63, provider, lane)); + var root$64 = enqueueUpdate(provider, fiber, lane); + null !== root$64 && + (scheduleUpdateOnFiber(root$64, provider, lane), + entangleTransitions(root$64, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$63 && + null !== root$64 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -5196,9 +5220,9 @@ function resolveClassComponentProps(Component, baseProps) { } if ((Component = Component.defaultProps)) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$67 in Component) - void 0 === newProps[propName$67] && - (newProps[propName$67] = Component[propName$67]); + for (var propName$68 in Component) + void 0 === newProps[propName$68] && + (newProps[propName$68] = Component[propName$68]); } return newProps; } @@ -5244,9 +5268,9 @@ function logUncaughtError(root, errorInfo) { try { var onUncaughtError = root.onUncaughtError; onUncaughtError(errorInfo.value, { componentStack: errorInfo.stack }); - } catch (e$68) { + } catch (e$69) { setTimeout(function () { - throw e$68; + throw e$69; }); } } @@ -5257,9 +5281,9 @@ function logCaughtError(root, boundary, errorInfo) { componentStack: errorInfo.stack, errorBoundary: 1 === boundary.tag ? boundary.stateNode : null }); - } catch (e$69) { + } catch (e$70) { setTimeout(function () { - throw e$69; + throw e$70; }); } } @@ -7715,8 +7739,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$114) { - captureCommitPhaseError(current, nearestMountedAncestor, error$114); + } catch (error$115) { + captureCommitPhaseError(current, nearestMountedAncestor, error$115); } else ref.current = null; } @@ -7850,7 +7874,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$19) { + } catch (e$20) { JSCompiler_temp = null; break a; } @@ -8025,11 +8049,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$113) { + } catch (error$114) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$113 + error$114 ); } } @@ -8183,7 +8207,7 @@ function commitDeletionEffectsOnFiber( safelyDetachRef(deletedFiber, nearestMountedAncestor); case 6: prevHostParentIsContainer = hostParent; - var prevHostParentIsContainer$121 = hostParentIsContainer; + var prevHostParentIsContainer$122 = hostParentIsContainer; hostParent = null; recursivelyTraverseDeletionEffects( finishedRoot, @@ -8191,7 +8215,7 @@ function commitDeletionEffectsOnFiber( deletedFiber ); hostParent = prevHostParentIsContainer; - hostParentIsContainer = prevHostParentIsContainer$121; + hostParentIsContainer = prevHostParentIsContainer$122; if (null !== hostParent) if (hostParentIsContainer) try { @@ -8824,21 +8848,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$115 = JSCompiler_inline_result.stateNode; + var parent$116 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$115, ""), + (setTextContent(parent$116, ""), (JSCompiler_inline_result.flags &= -33)); - var before$116 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$116, parent$115); + var before$117 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$117, parent$116); break; case 3: case 4: - var parent$117 = JSCompiler_inline_result.stateNode.containerInfo, - before$118 = getHostSibling(finishedWork); + var parent$118 = JSCompiler_inline_result.stateNode.containerInfo, + before$119 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$118, - parent$117 + before$119, + parent$118 ); break; default: @@ -9722,20 +9746,32 @@ function markUpdate(workInProgress) { function preloadResourceAndSuspendIfNeeded(workInProgress, resource) { if ("stylesheet" !== resource.type || 0 !== (resource.state.loading & 4)) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -9752,14 +9788,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$133 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$133 = lastTailNode), + for (var lastTailNode$134 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$134 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$133 + null === lastTailNode$134 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$133.sibling = null); + : (lastTailNode$134.sibling = null); } } function bubbleProperties(completedWork) { @@ -9769,19 +9805,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$134 = completedWork.child; null !== child$134; ) - (newChildLanes |= child$134.lanes | child$134.childLanes), - (subtreeFlags |= child$134.subtreeFlags & 31457280), - (subtreeFlags |= child$134.flags & 31457280), - (child$134.return = completedWork), - (child$134 = child$134.sibling); + for (var child$135 = completedWork.child; null !== child$135; ) + (newChildLanes |= child$135.lanes | child$135.childLanes), + (subtreeFlags |= child$135.subtreeFlags & 31457280), + (subtreeFlags |= child$135.flags & 31457280), + (child$135.return = completedWork), + (child$135 = child$135.sibling); else - for (child$134 = completedWork.child; null !== child$134; ) - (newChildLanes |= child$134.lanes | child$134.childLanes), - (subtreeFlags |= child$134.subtreeFlags), - (subtreeFlags |= child$134.flags), - (child$134.return = completedWork), - (child$134 = child$134.sibling); + for (child$135 = completedWork.child; null !== child$135; ) + (newChildLanes |= child$135.lanes | child$135.childLanes), + (subtreeFlags |= child$135.subtreeFlags), + (subtreeFlags |= child$135.flags), + (child$135.return = completedWork), + (child$135 = child$135.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -10058,11 +10094,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (type = newProps.alternate.memoizedState.cachePool.pool); - var cache$146 = null; + var cache$147 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$146 = newProps.memoizedState.cachePool.pool); - cache$146 !== type && (newProps.flags |= 2048); + (cache$147 = newProps.memoizedState.cachePool.pool); + cache$147 !== type && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -10087,8 +10123,8 @@ function completeWork(current, workInProgress, renderLanes) { type = workInProgress.memoizedState; if (null === type) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$146 = type.rendering; - if (null === cache$146) + cache$147 = type.rendering; + if (null === cache$147) if (newProps) cutOffTailIfNeeded(type, !1); else { if ( @@ -10096,11 +10132,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$146 = findFirstSuspended(current); - if (null !== cache$146) { + cache$147 = findFirstSuspended(current); + if (null !== cache$147) { workInProgress.flags |= 128; cutOffTailIfNeeded(type, !1); - current = cache$146.updateQueue; + current = cache$147.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -10125,7 +10161,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$146)), null !== current)) { + if (((current = findFirstSuspended(cache$147)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -10135,7 +10171,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !0), null === type.tail && "hidden" === type.tailMode && - !cache$146.alternate && + !cache$147.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -10148,13 +10184,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !1), (workInProgress.lanes = 4194304)); type.isBackwards - ? ((cache$146.sibling = workInProgress.child), - (workInProgress.child = cache$146)) + ? ((cache$147.sibling = workInProgress.child), + (workInProgress.child = cache$147)) : ((current = type.last), null !== current - ? (current.sibling = cache$146) - : (workInProgress.child = cache$146), - (type.last = cache$146)); + ? (current.sibling = cache$147) + : (workInProgress.child = cache$147), + (type.last = cache$147)); } if (null !== type.tail) return ( @@ -10328,6 +10364,7 @@ var DefaultAsyncDispatcher = { workInProgressSuspendedReason = 0, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, @@ -10378,7 +10415,8 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) @@ -10389,23 +10427,35 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root$jscomp$0.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root$jscomp$0, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root$jscomp$0, lanes) : renderRootSync(root$jscomp$0, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (0 === exitStatus) break; - else if (6 === exitStatus) markRootSuspended(root$jscomp$0, lanes, 0); + if (0 === exitStatus) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root$jscomp$0, lanes, 0, !1); + break; + } else if (6 === exitStatus) + markRootSuspended( + root$jscomp$0, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root$jscomp$0.current.alternate; if ( @@ -10465,11 +10515,11 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { } if (1 === exitStatus) { prepareFreshStack(root$jscomp$0, 0); - markRootSuspended(root$jscomp$0, lanes, 0); + markRootSuspended(root$jscomp$0, lanes, 0, !0); break; } a: { - renderWasConcurrent = root$jscomp$0; + shouldTimeSlice = root$jscomp$0; switch (exitStatus) { case 0: case 1: @@ -10477,9 +10527,10 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { case 4: if ((lanes & 4194176) === lanes) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -10493,23 +10544,24 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { default: throw Error(formatProdErrorMessage(329)); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if ( (lanes & 62914560) === lanes && - ((exitStatus = globalMostRecentFallbackTime + 300 - now()), - 10 < exitStatus) + ((renderWasConcurrent = globalMostRecentFallbackTime + 300 - now()), + 10 < renderWasConcurrent) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10523,12 +10575,12 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { -0, 0 ), - exitStatus + renderWasConcurrent ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10571,11 +10623,8 @@ function commitRootWhenReady( completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -10597,7 +10646,7 @@ function commitRootWhenReady( completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended(root, lanes, spawnedLane, !didSkipSuspendedSiblings); return; } commitRoot( @@ -10647,19 +10696,22 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes, spawnedLane) { +function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree +) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + didAttemptEntireTree[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -10703,7 +10755,7 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressSuspendedRetryLanes = workInProgressDeferredLane = @@ -10723,9 +10775,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$3 = 31 - clz32(allEntangledLanes), - lane = 1 << index$3; - lanes |= root[index$3]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -10737,12 +10789,7 @@ function handleThrow(root, thrownValue) { ReactSharedInternals.H = ContextOnlyDispatcher; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 2 - : 3)) + (workInProgressSuspendedReason = 3)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = 4)) @@ -10762,21 +10809,6 @@ function handleThrow(root, thrownValue) { createCapturedValueAtFiber(thrownValue, root.current) )); } -function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; -} function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -10789,13 +10821,19 @@ function pushAsyncDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } function queueConcurrentError(error) { @@ -10803,7 +10841,7 @@ function queueConcurrentError(error) { ? (workInProgressRootConcurrentErrors = [error]) : workInProgressRootConcurrentErrors.push(error); } -function renderRootSync(root, lanes) { +function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= 2; var prevDispatcher = pushDispatcher(), @@ -10830,6 +10868,13 @@ function renderRootSync(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + exitStatus = 0; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -10841,8 +10886,8 @@ function renderRootSync(root, lanes) { workLoopSync(); exitStatus = workInProgressRootExitStatus; break; - } catch (thrownValue$162) { - handleThrow(root, thrownValue$162); + } catch (thrownValue$167) { + handleThrow(root, thrownValue$167); } while (1); lanes && root.shellSuspendCounter++; @@ -10868,7 +10913,10 @@ function renderRootConcurrent(root, lanes) { ? ((workInProgressTransitions = null), (workInProgressRootRenderTargetTime = now() + 500), prepareFreshStack(root, lanes)) - : checkIfRootIsPrerendering(root, lanes); + : (workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + )); a: do try { if (0 !== workInProgressSuspendedReason && null !== workInProgress) { @@ -10952,8 +11000,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$164) { - handleThrow(root, thrownValue$164); + } catch (thrownValue$169) { + handleThrow(root, thrownValue$169); } while (1); lastContextDependency = currentlyRenderingFiber = null; @@ -11011,7 +11059,12 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason +) { lastContextDependency = currentlyRenderingFiber = null; resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -11045,9 +11098,23 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || 1 === suspendedReason) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + 2 === suspendedReason || 3 === suspendedReason || 6 === suspendedReason) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -11142,7 +11209,9 @@ function commitRootImpl( transitions, didIncludeRenderPhaseUpdate, renderPriorityLevel, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -11162,7 +11231,9 @@ function commitRootImpl( root, didIncludeRenderPhaseUpdate, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), @@ -11178,25 +11249,25 @@ function commitRootImpl( return null; })); transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactSharedInternals.T; - ReactSharedInternals.T = null; - spawnedLane = ReactDOMSharedInternals.p; - ReactDOMSharedInternals.p = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - restoreSelection(selectionInformation, root.containerInfo); - _enabled = !!eventsEnabled; - selectionInformation = eventsEnabled = null; - root.current = finishedWork; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - requestPaint(); - executionContext = prevExecutionContext; - ReactDOMSharedInternals.p = spawnedLane; - ReactSharedInternals.T = transitions; - } else root.current = finishedWork; + 0 !== (finishedWork.subtreeFlags & 15990) || transitions + ? ((transitions = ReactSharedInternals.T), + (ReactSharedInternals.T = null), + (spawnedLane = ReactDOMSharedInternals.p), + (ReactDOMSharedInternals.p = 2), + (updatedLanes = executionContext), + (executionContext |= 4), + commitBeforeMutationEffects(root, finishedWork), + commitMutationEffectsOnFiber(finishedWork, root), + restoreSelection(selectionInformation, root.containerInfo), + (_enabled = !!eventsEnabled), + (selectionInformation = eventsEnabled = null), + (root.current = finishedWork), + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork), + requestPaint(), + (executionContext = updatedLanes), + (ReactDOMSharedInternals.p = spawnedLane), + (ReactSharedInternals.T = transitions)) + : (root.current = finishedWork); rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), @@ -11234,7 +11305,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$168 = rootWithPendingPassiveEffects, + var root$173 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11273,7 +11344,7 @@ function flushPassiveEffects() { } finally { (ReactDOMSharedInternals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$168, remainingLanes); + releaseRootPooledCache(root$173, remainingLanes); } } return !1; @@ -11416,14 +11487,14 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$170 = firstScheduledRoot; null !== root$170; ) { + for (var root$175 = firstScheduledRoot; null !== root$175; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { - var pendingLanes = root$170.pendingLanes; + var pendingLanes = root$175.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { - var suspendedLanes = root$170.suspendedLanes, - pingedLanes = root$170.pingedLanes; + var suspendedLanes = root$175.suspendedLanes, + pingedLanes = root$175.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= @@ -11437,18 +11508,18 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$170, JSCompiler_inline_result)); + performSyncWorkOnRoot(root$175, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( - root$170, - root$170 === workInProgressRoot ? JSCompiler_inline_result : 0 + root$175, + root$175 === workInProgressRoot ? JSCompiler_inline_result : 0 )), 0 === (JSCompiler_inline_result & 3) || - checkIfRootIsPrerendering(root$170, JSCompiler_inline_result) || + checkIfRootIsPrerendering(root$175, JSCompiler_inline_result) || ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$170, JSCompiler_inline_result)); - root$170 = root$170.next; + performSyncWorkOnRoot(root$175, JSCompiler_inline_result)); + root$175 = root$175.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -11489,12 +11560,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4, - expirationTime = expirationTimes[index$4]; + var index$5 = 31 - clz32(lanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$4] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -11517,37 +11588,37 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) - return ( - null !== pingedLanes && - null !== pingedLanes && - cancelCallback$1(pingedLanes), - (root.callbackPriority = 2), - (root.callbackNode = null), - 2 - ); - currentTime = suspendedLanes & -suspendedLanes; - if (currentTime === root.callbackPriority) return currentTime; - null !== pingedLanes && cancelCallback$1(pingedLanes); - switch (lanesToEventPriority(suspendedLanes)) { - case 2: - case 8: - suspendedLanes = UserBlockingPriority; - break; - case 32: - suspendedLanes = NormalPriority$1; - break; - case 268435456: - suspendedLanes = IdlePriority; - break; - default: - suspendedLanes = NormalPriority$1; - } - pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); - suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); - root.callbackPriority = currentTime; - root.callbackNode = suspendedLanes; - return currentTime; + if ( + 0 === (suspendedLanes & 3) || + checkIfRootIsPrerendering(root, suspendedLanes) + ) { + currentTime = suspendedLanes & -suspendedLanes; + if (currentTime === root.callbackPriority) return currentTime; + null !== pingedLanes && cancelCallback$1(pingedLanes); + switch (lanesToEventPriority(suspendedLanes)) { + case 2: + case 8: + suspendedLanes = UserBlockingPriority; + break; + case 32: + suspendedLanes = NormalPriority$1; + break; + case 268435456: + suspendedLanes = IdlePriority; + break; + default: + suspendedLanes = NormalPriority$1; + } + pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); + suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); + root.callbackPriority = currentTime; + root.callbackNode = suspendedLanes; + return currentTime; + } + null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes); + root.callbackPriority = 2; + root.callbackNode = null; + return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { var originalCallbackNode = root.callbackNode; @@ -11676,20 +11747,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1423 = 0; - i$jscomp$inline_1423 < simpleEventPluginEvents.length; - i$jscomp$inline_1423++ + var i$jscomp$inline_1432 = 0; + i$jscomp$inline_1432 < simpleEventPluginEvents.length; + i$jscomp$inline_1432++ ) { - var eventName$jscomp$inline_1424 = - simpleEventPluginEvents[i$jscomp$inline_1423], - domEventName$jscomp$inline_1425 = - eventName$jscomp$inline_1424.toLowerCase(), - capitalizedEvent$jscomp$inline_1426 = - eventName$jscomp$inline_1424[0].toUpperCase() + - eventName$jscomp$inline_1424.slice(1); + var eventName$jscomp$inline_1433 = + simpleEventPluginEvents[i$jscomp$inline_1432], + domEventName$jscomp$inline_1434 = + eventName$jscomp$inline_1433.toLowerCase(), + capitalizedEvent$jscomp$inline_1435 = + eventName$jscomp$inline_1433[0].toUpperCase() + + eventName$jscomp$inline_1433.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1425, - "on" + capitalizedEvent$jscomp$inline_1426 + domEventName$jscomp$inline_1434, + "on" + capitalizedEvent$jscomp$inline_1435 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -12872,34 +12943,34 @@ function setInitialProperties(domElement, tag, props) { defaultChecked = null; for (hasSrc in props) if (props.hasOwnProperty(hasSrc)) { - var propValue$184 = props[hasSrc]; - if (null != propValue$184) + var propValue$189 = props[hasSrc]; + if (null != propValue$189) switch (hasSrc) { case "name": - hasSrcSet = propValue$184; + hasSrcSet = propValue$189; break; case "type": - propValue = propValue$184; + propValue = propValue$189; break; case "checked": - checked = propValue$184; + checked = propValue$189; break; case "defaultChecked": - defaultChecked = propValue$184; + defaultChecked = propValue$189; break; case "value": - propKey = propValue$184; + propKey = propValue$189; break; case "defaultValue": - defaultValue = propValue$184; + defaultValue = propValue$189; break; case "children": case "dangerouslySetInnerHTML": - if (null != propValue$184) + if (null != propValue$189) throw Error(formatProdErrorMessage(137, tag)); break; default: - setProp(domElement, tag, hasSrc, propValue$184, props, null); + setProp(domElement, tag, hasSrc, propValue$189, props, null); } } initInput( @@ -13036,14 +13107,14 @@ function setInitialProperties(domElement, tag, props) { return; default: if (isCustomElement(tag)) { - for (propValue$184 in props) - props.hasOwnProperty(propValue$184) && - ((hasSrc = props[propValue$184]), + for (propValue$189 in props) + props.hasOwnProperty(propValue$189) && + ((hasSrc = props[propValue$189]), void 0 !== hasSrc && setPropOnCustomElement( domElement, tag, - propValue$184, + propValue$189, hasSrc, props, void 0 @@ -13091,14 +13162,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$201 in nextProps) { - var propKey = nextProps[propKey$201]; - lastProp = lastProps[propKey$201]; + for (var propKey$206 in nextProps) { + var propKey = nextProps[propKey$206]; + lastProp = lastProps[propKey$206]; if ( - nextProps.hasOwnProperty(propKey$201) && + nextProps.hasOwnProperty(propKey$206) && (null != propKey || null != lastProp) ) - switch (propKey$201) { + switch (propKey$206) { case "type": type = propKey; break; @@ -13127,7 +13198,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$201, + propKey$206, propKey, nextProps, lastProp @@ -13146,7 +13217,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$201 = null; + propKey = value = defaultValue = propKey$206 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -13177,7 +13248,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$201 = type; + propKey$206 = type; break; case "defaultValue": defaultValue = type; @@ -13198,15 +13269,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$201 - ? updateOptions(domElement, !!lastProps, propKey$201, !1) + null != propKey$206 + ? updateOptions(domElement, !!lastProps, propKey$206, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$201 = null; + propKey = propKey$206 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -13230,7 +13301,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$201 = name; + propKey$206 = name; break; case "defaultValue": propKey = name; @@ -13244,17 +13315,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$201, propKey); + updateTextarea(domElement, propKey$206, propKey); return; case "option": - for (var propKey$217 in lastProps) + for (var propKey$222 in lastProps) if ( - ((propKey$201 = lastProps[propKey$217]), - lastProps.hasOwnProperty(propKey$217) && - null != propKey$201 && - !nextProps.hasOwnProperty(propKey$217)) + ((propKey$206 = lastProps[propKey$222]), + lastProps.hasOwnProperty(propKey$222) && + null != propKey$206 && + !nextProps.hasOwnProperty(propKey$222)) ) - switch (propKey$217) { + switch (propKey$222) { case "selected": domElement.selected = !1; break; @@ -13262,33 +13333,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$217, + propKey$222, null, nextProps, - propKey$201 + propKey$206 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$201 = nextProps[lastDefaultValue]), + ((propKey$206 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$201 !== propKey && - (null != propKey$201 || null != propKey)) + propKey$206 !== propKey && + (null != propKey$206 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$201 && - "function" !== typeof propKey$201 && - "symbol" !== typeof propKey$201; + propKey$206 && + "function" !== typeof propKey$206 && + "symbol" !== typeof propKey$206; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$201, + propKey$206, nextProps, propKey ); @@ -13309,24 +13380,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$222 in lastProps) - (propKey$201 = lastProps[propKey$222]), - lastProps.hasOwnProperty(propKey$222) && - null != propKey$201 && - !nextProps.hasOwnProperty(propKey$222) && - setProp(domElement, tag, propKey$222, null, nextProps, propKey$201); + for (var propKey$227 in lastProps) + (propKey$206 = lastProps[propKey$227]), + lastProps.hasOwnProperty(propKey$227) && + null != propKey$206 && + !nextProps.hasOwnProperty(propKey$227) && + setProp(domElement, tag, propKey$227, null, nextProps, propKey$206); for (checked in nextProps) if ( - ((propKey$201 = nextProps[checked]), + ((propKey$206 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$201 !== propKey && - (null != propKey$201 || null != propKey)) + propKey$206 !== propKey && + (null != propKey$206 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$201) + if (null != propKey$206) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -13334,7 +13405,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$201, + propKey$206, nextProps, propKey ); @@ -13342,49 +13413,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$227 in lastProps) - (propKey$201 = lastProps[propKey$227]), - lastProps.hasOwnProperty(propKey$227) && - void 0 !== propKey$201 && - !nextProps.hasOwnProperty(propKey$227) && + for (var propKey$232 in lastProps) + (propKey$206 = lastProps[propKey$232]), + lastProps.hasOwnProperty(propKey$232) && + void 0 !== propKey$206 && + !nextProps.hasOwnProperty(propKey$232) && setPropOnCustomElement( domElement, tag, - propKey$227, + propKey$232, void 0, nextProps, - propKey$201 + propKey$206 ); for (defaultChecked in nextProps) - (propKey$201 = nextProps[defaultChecked]), + (propKey$206 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$201 === propKey || - (void 0 === propKey$201 && void 0 === propKey) || + propKey$206 === propKey || + (void 0 === propKey$206 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$201, + propKey$206, nextProps, propKey ); return; } } - for (var propKey$232 in lastProps) - (propKey$201 = lastProps[propKey$232]), - lastProps.hasOwnProperty(propKey$232) && - null != propKey$201 && - !nextProps.hasOwnProperty(propKey$232) && - setProp(domElement, tag, propKey$232, null, nextProps, propKey$201); + for (var propKey$237 in lastProps) + (propKey$206 = lastProps[propKey$237]), + lastProps.hasOwnProperty(propKey$237) && + null != propKey$206 && + !nextProps.hasOwnProperty(propKey$237) && + setProp(domElement, tag, propKey$237, null, nextProps, propKey$206); for (lastProp in nextProps) - (propKey$201 = nextProps[lastProp]), + (propKey$206 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$201 === propKey || - (null == propKey$201 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$201, nextProps, propKey); + propKey$206 === propKey || + (null == propKey$206 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$206, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -13929,26 +14000,26 @@ function getResource(type, currentProps, pendingProps, currentResource) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$240 = getResourcesFromRoot( + var styles$245 = getResourcesFromRoot( JSCompiler_inline_result ).hoistableStyles, - resource$241 = styles$240.get(type); - resource$241 || + resource$246 = styles$245.get(type); + resource$246 || ((JSCompiler_inline_result = JSCompiler_inline_result.ownerDocument || JSCompiler_inline_result), - (resource$241 = { + (resource$246 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$240.set(type, resource$241), - (styles$240 = JSCompiler_inline_result.querySelector( + styles$245.set(type, resource$246), + (styles$245 = JSCompiler_inline_result.querySelector( getStylesheetSelectorFromKey(type) )) && - !styles$240._p && - ((resource$241.instance = styles$240), - (resource$241.state.loading = 5)), + !styles$245._p && + ((resource$246.instance = styles$245), + (resource$246.state.loading = 5)), preloadPropsMap.has(type) || ((pendingProps = { rel: "preload", @@ -13961,16 +14032,16 @@ function getResource(type, currentProps, pendingProps, currentResource) { referrerPolicy: pendingProps.referrerPolicy }), preloadPropsMap.set(type, pendingProps), - styles$240 || + styles$245 || preloadStylesheet( JSCompiler_inline_result, type, pendingProps, - resource$241.state + resource$246.state ))); if (currentProps && null === currentResource) throw Error(formatProdErrorMessage(528, "")); - return resource$241; + return resource$246; } if (currentProps && null !== currentResource) throw Error(formatProdErrorMessage(529, "")); @@ -14067,37 +14138,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$246 = hoistableRoot.querySelector( + var instance$251 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$246) + if (instance$251) return ( (resource.state.loading |= 4), - (resource.instance = instance$246), - markNodeAsHoistable(instance$246), - instance$246 + (resource.instance = instance$251), + markNodeAsHoistable(instance$251), + instance$251 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$246 = ( + instance$251 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$246); - var linkInstance = instance$246; + markNodeAsHoistable(instance$251); + var linkInstance = instance$251; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$246, "link", instance); + setInitialProperties(instance$251, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$246, props.precedence, hoistableRoot); - return (resource.instance = instance$246); + insertStylesheet(instance$251, props.precedence, hoistableRoot); + return (resource.instance = instance$251); case "script": - instance$246 = getScriptKey(props.src); + instance$251 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$246) + getScriptSelectorFromKey(instance$251) )) ) return ( @@ -14106,7 +14177,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$246))) + if ((styleProps = preloadPropsMap.get(instance$251))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -15130,16 +15201,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1670 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1679 = React.version; if ( - "19.0.0-experimental-380f5d67-20241113" !== - isomorphicReactPackageVersion$jscomp$inline_1670 + "19.0.0-experimental-b01722d5-20241114" !== + isomorphicReactPackageVersion$jscomp$inline_1679 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1670, - "19.0.0-experimental-380f5d67-20241113" + isomorphicReactPackageVersion$jscomp$inline_1679, + "19.0.0-experimental-b01722d5-20241114" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15159,25 +15230,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2140 = { +var internals$jscomp$inline_2152 = { bundleType: 0, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113" + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2141 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2153 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2141.isDisabled && - hook$jscomp$inline_2141.supportsFiber + !hook$jscomp$inline_2153.isDisabled && + hook$jscomp$inline_2153.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2141.inject( - internals$jscomp$inline_2140 + (rendererID = hook$jscomp$inline_2153.inject( + internals$jscomp$inline_2152 )), - (injectedHook = hook$jscomp$inline_2141); + (injectedHook = hook$jscomp$inline_2153); } catch (err) {} } exports.createRoot = function (container, options) { @@ -15269,4 +15340,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-experimental-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 c70afc4c478a2..ddc1c247cc409 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 @@ -1043,28 +1043,40 @@ var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -1149,7 +1161,9 @@ root, finishedLanes, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; @@ -1160,17 +1174,17 @@ root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index; - finishedLanes[index] = 0; + var index = 31 - clz32(remainingLanes), + lane = 1 << index; + entanglements[index] = 0; expirationTimes[index] = -1; var hiddenUpdatesForLane = hiddenUpdates[index]; if (null !== hiddenUpdatesForLane) @@ -1182,9 +1196,14 @@ var update = hiddenUpdatesForLane[index]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -3787,31 +3806,31 @@ } function logRenderPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Render", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Render", reusableLaneOptions)); } function logSuspenseThrottlePhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Throttled", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Throttled", reusableLaneOptions)); } function logSuspendedCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Suspended", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Suspended", reusableLaneOptions)); } function logCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Commit", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Commit", reusableLaneOptions)); } function finishQueueingConcurrentUpdates() { for ( @@ -4037,14 +4056,24 @@ JSCompiler_temp ? 0 > blockingUpdateTime && ((blockingUpdateTime = now()), - (blockingEventTime = resolveEventTimeStamp()), - (blockingEventType = resolveEventType())) + (lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (blockingEventIsRepeat = + lane === blockingEventTime && + JSCompiler_temp === blockingEventType), + (blockingEventTime = lane), + (blockingEventType = JSCompiler_temp)) : 0 !== (lane & 4194176) && 0 > transitionUpdateTime && ((transitionUpdateTime = now()), 0 > transitionStartTime && - ((transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType()))); + ((lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (transitionEventIsRepeat = + lane === transitionEventTime && + JSCompiler_temp === transitionEventType), + (transitionEventTime = lane), + (transitionEventType = JSCompiler_temp))); } function pushNestedEffectDurations() { var prevEffectDuration = profilerEffectDuration; @@ -8916,33 +8945,33 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_componentStack_2300; - var JSCompiler_object_inline_stack_2299 = workInProgress.pendingProps; + var JSCompiler_object_inline_componentStack_2314; + var JSCompiler_object_inline_stack_2313 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_message_2297 = !1; + var JSCompiler_object_inline_message_2311 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_componentStack_2300 = didSuspend) || - (JSCompiler_object_inline_componentStack_2300 = + (JSCompiler_object_inline_componentStack_2314 = didSuspend) || + (JSCompiler_object_inline_componentStack_2314 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_componentStack_2300 && - ((JSCompiler_object_inline_message_2297 = !0), + JSCompiler_object_inline_componentStack_2314 && + ((JSCompiler_object_inline_message_2311 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_componentStack_2300 = + JSCompiler_object_inline_componentStack_2314 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_message_2297 + JSCompiler_object_inline_message_2311 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_digest_2298 = nextHydratableInstance; + var JSCompiler_object_inline_digest_2312 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2298)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2312)) { c: { - var instance = JSCompiler_object_inline_digest_2298; + var instance = JSCompiler_object_inline_digest_2312; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8983,19 +9012,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_digest_2298 + JSCompiler_object_inline_digest_2312 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_digest_2298 = workInProgress.memoizedState; + JSCompiler_object_inline_digest_2312 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_digest_2298 && - ((JSCompiler_object_inline_digest_2298 = - JSCompiler_object_inline_digest_2298.dehydrated), - null !== JSCompiler_object_inline_digest_2298) + null !== JSCompiler_object_inline_digest_2312 && + ((JSCompiler_object_inline_digest_2312 = + JSCompiler_object_inline_digest_2312.dehydrated), + null !== JSCompiler_object_inline_digest_2312) ) return ( - JSCompiler_object_inline_digest_2298.data === + JSCompiler_object_inline_digest_2312.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -9003,68 +9032,68 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_digest_2298 = - JSCompiler_object_inline_stack_2299.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2299.fallback; - if (JSCompiler_object_inline_message_2297) + JSCompiler_object_inline_digest_2312 = + JSCompiler_object_inline_stack_2313.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2313.fallback; + if (JSCompiler_object_inline_message_2311) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2299 = + (JSCompiler_object_inline_stack_2313 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2298, + JSCompiler_object_inline_digest_2312, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2297 = workInProgress.child), - (JSCompiler_object_inline_message_2297.memoizedState = + (JSCompiler_object_inline_message_2311 = workInProgress.child), + (JSCompiler_object_inline_message_2311.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2297.childLanes = + (JSCompiler_object_inline_message_2311.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2300, + JSCompiler_object_inline_componentStack_2314, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2313 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2299.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2313.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2299 = + (JSCompiler_object_inline_stack_2313 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2298, + JSCompiler_object_inline_digest_2312, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2297 = workInProgress.child), - (JSCompiler_object_inline_message_2297.memoizedState = + (JSCompiler_object_inline_message_2311 = workInProgress.child), + (JSCompiler_object_inline_message_2311.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2297.childLanes = + (JSCompiler_object_inline_message_2311.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2300, + JSCompiler_object_inline_componentStack_2314, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2313 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_digest_2298 + JSCompiler_object_inline_digest_2312 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_digest_2298 = prevState.dehydrated), - null !== JSCompiler_object_inline_digest_2298) + ((JSCompiler_object_inline_digest_2312 = prevState.dehydrated), + null !== JSCompiler_object_inline_digest_2312) ) { if (didSuspend) workInProgress.flags & 256 @@ -9081,95 +9110,95 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2297 = - JSCompiler_object_inline_stack_2299.fallback), - (JSCompiler_object_inline_digest_2298 = workInProgress.mode), - (JSCompiler_object_inline_stack_2299 = + (JSCompiler_object_inline_message_2311 = + JSCompiler_object_inline_stack_2313.fallback), + (JSCompiler_object_inline_digest_2312 = workInProgress.mode), + (JSCompiler_object_inline_stack_2313 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2299.children + children: JSCompiler_object_inline_stack_2313.children }, - JSCompiler_object_inline_digest_2298 + JSCompiler_object_inline_digest_2312 )), - (JSCompiler_object_inline_message_2297 = + (JSCompiler_object_inline_message_2311 = createFiberFromFragment( - JSCompiler_object_inline_message_2297, - JSCompiler_object_inline_digest_2298, + JSCompiler_object_inline_message_2311, + JSCompiler_object_inline_digest_2312, renderLanes, null )), - (JSCompiler_object_inline_message_2297.flags |= 2), - (JSCompiler_object_inline_stack_2299.return = workInProgress), - (JSCompiler_object_inline_message_2297.return = workInProgress), - (JSCompiler_object_inline_stack_2299.sibling = - JSCompiler_object_inline_message_2297), - (workInProgress.child = JSCompiler_object_inline_stack_2299), + (JSCompiler_object_inline_message_2311.flags |= 2), + (JSCompiler_object_inline_stack_2313.return = workInProgress), + (JSCompiler_object_inline_message_2311.return = workInProgress), + (JSCompiler_object_inline_stack_2313.sibling = + JSCompiler_object_inline_message_2311), + (workInProgress.child = JSCompiler_object_inline_stack_2313), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2299 = workInProgress.child), - (JSCompiler_object_inline_stack_2299.memoizedState = + (JSCompiler_object_inline_stack_2313 = workInProgress.child), + (JSCompiler_object_inline_stack_2313.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2299.childLanes = + (JSCompiler_object_inline_stack_2313.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2300, + JSCompiler_object_inline_componentStack_2314, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress = JSCompiler_object_inline_message_2297)); + (workInProgress = JSCompiler_object_inline_message_2311)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_digest_2298.data === + JSCompiler_object_inline_digest_2312.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_componentStack_2300 = - JSCompiler_object_inline_digest_2298.nextSibling && - JSCompiler_object_inline_digest_2298.nextSibling.dataset; - if (JSCompiler_object_inline_componentStack_2300) { - JSCompiler_temp = JSCompiler_object_inline_componentStack_2300.dgst; - var message = JSCompiler_object_inline_componentStack_2300.msg; - instance = JSCompiler_object_inline_componentStack_2300.stck; + JSCompiler_object_inline_componentStack_2314 = + JSCompiler_object_inline_digest_2312.nextSibling && + JSCompiler_object_inline_digest_2312.nextSibling.dataset; + if (JSCompiler_object_inline_componentStack_2314) { + JSCompiler_temp = JSCompiler_object_inline_componentStack_2314.dgst; + var message = JSCompiler_object_inline_componentStack_2314.msg; + instance = JSCompiler_object_inline_componentStack_2314.stck; var componentStack = - JSCompiler_object_inline_componentStack_2300.cstck; + JSCompiler_object_inline_componentStack_2314.cstck; } - JSCompiler_object_inline_message_2297 = message; - JSCompiler_object_inline_digest_2298 = JSCompiler_temp; - JSCompiler_object_inline_stack_2299 = instance; - JSCompiler_temp = JSCompiler_object_inline_componentStack_2300 = + JSCompiler_object_inline_message_2311 = message; + JSCompiler_object_inline_digest_2312 = JSCompiler_temp; + JSCompiler_object_inline_stack_2313 = instance; + JSCompiler_temp = JSCompiler_object_inline_componentStack_2314 = componentStack; - "POSTPONE" !== JSCompiler_object_inline_digest_2298 && - ((JSCompiler_object_inline_componentStack_2300 = - JSCompiler_object_inline_message_2297 - ? Error(JSCompiler_object_inline_message_2297) + "POSTPONE" !== JSCompiler_object_inline_digest_2312 && + ((JSCompiler_object_inline_componentStack_2314 = + JSCompiler_object_inline_message_2311 + ? Error(JSCompiler_object_inline_message_2311) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), - (JSCompiler_object_inline_componentStack_2300.stack = - JSCompiler_object_inline_stack_2299 || ""), - (JSCompiler_object_inline_componentStack_2300.digest = - JSCompiler_object_inline_digest_2298), - (JSCompiler_object_inline_stack_2299 = + (JSCompiler_object_inline_componentStack_2314.stack = + JSCompiler_object_inline_stack_2313 || ""), + (JSCompiler_object_inline_componentStack_2314.digest = + JSCompiler_object_inline_digest_2312), + (JSCompiler_object_inline_stack_2313 = void 0 === JSCompiler_temp ? null : JSCompiler_temp), - (JSCompiler_object_inline_message_2297 = { - value: JSCompiler_object_inline_componentStack_2300, + (JSCompiler_object_inline_message_2311 = { + value: JSCompiler_object_inline_componentStack_2314, source: null, - stack: JSCompiler_object_inline_stack_2299 + stack: JSCompiler_object_inline_stack_2313 }), - "string" === typeof JSCompiler_object_inline_stack_2299 && + "string" === typeof JSCompiler_object_inline_stack_2313 && CapturedStacks.set( - JSCompiler_object_inline_componentStack_2300, - JSCompiler_object_inline_message_2297 + JSCompiler_object_inline_componentStack_2314, + JSCompiler_object_inline_message_2311 ), - queueHydrationError(JSCompiler_object_inline_message_2297)); + queueHydrationError(JSCompiler_object_inline_message_2311)); workInProgress = retrySuspenseComponentWithoutHydrating( current, workInProgress, @@ -9183,25 +9212,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_componentStack_2300 = + (JSCompiler_object_inline_componentStack_2314 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_componentStack_2300) + didReceiveUpdate || JSCompiler_object_inline_componentStack_2314) ) { - JSCompiler_object_inline_componentStack_2300 = workInProgressRoot; - if (null !== JSCompiler_object_inline_componentStack_2300) { - JSCompiler_object_inline_stack_2299 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2299 & 42)) - JSCompiler_object_inline_stack_2299 = 1; + JSCompiler_object_inline_componentStack_2314 = workInProgressRoot; + if (null !== JSCompiler_object_inline_componentStack_2314) { + JSCompiler_object_inline_stack_2313 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2313 & 42)) + JSCompiler_object_inline_stack_2313 = 1; else - switch (JSCompiler_object_inline_stack_2299) { + switch (JSCompiler_object_inline_stack_2313) { case 2: - JSCompiler_object_inline_stack_2299 = 1; + JSCompiler_object_inline_stack_2313 = 1; break; case 8: - JSCompiler_object_inline_stack_2299 = 4; + JSCompiler_object_inline_stack_2313 = 4; break; case 32: - JSCompiler_object_inline_stack_2299 = 16; + JSCompiler_object_inline_stack_2313 = 16; break; case 128: case 256: @@ -9222,40 +9251,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2299 = 64; + JSCompiler_object_inline_stack_2313 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2299 = 134217728; + JSCompiler_object_inline_stack_2313 = 134217728; break; default: - JSCompiler_object_inline_stack_2299 = 0; + JSCompiler_object_inline_stack_2313 = 0; } - JSCompiler_object_inline_stack_2299 = + JSCompiler_object_inline_stack_2313 = 0 !== - (JSCompiler_object_inline_stack_2299 & - (JSCompiler_object_inline_componentStack_2300.suspendedLanes | + (JSCompiler_object_inline_stack_2313 & + (JSCompiler_object_inline_componentStack_2314.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2299; + : JSCompiler_object_inline_stack_2313; if ( - 0 !== JSCompiler_object_inline_stack_2299 && - JSCompiler_object_inline_stack_2299 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2313 && + JSCompiler_object_inline_stack_2313 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2299), + ((prevState.retryLane = JSCompiler_object_inline_stack_2313), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2313 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_componentStack_2300, + JSCompiler_object_inline_componentStack_2314, current, - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2313 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_digest_2298.data === + JSCompiler_object_inline_digest_2312.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9263,7 +9292,7 @@ renderLanes ); } else - JSCompiler_object_inline_digest_2298.data === + JSCompiler_object_inline_digest_2312.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9271,12 +9300,12 @@ null, current )), - (JSCompiler_object_inline_digest_2298._reactRetry = + (JSCompiler_object_inline_digest_2312._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_digest_2298.nextSibling + JSCompiler_object_inline_digest_2312.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9294,54 +9323,54 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2299.children + JSCompiler_object_inline_stack_2313.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_message_2297) + if (JSCompiler_object_inline_message_2311) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2297 = - JSCompiler_object_inline_stack_2299.fallback), - (JSCompiler_object_inline_digest_2298 = workInProgress.mode), + (JSCompiler_object_inline_message_2311 = + JSCompiler_object_inline_stack_2313.fallback), + (JSCompiler_object_inline_digest_2312 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2299 = createWorkInProgress( + (JSCompiler_object_inline_stack_2313 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2299.children + children: JSCompiler_object_inline_stack_2313.children } )), - (JSCompiler_object_inline_stack_2299.subtreeFlags = + (JSCompiler_object_inline_stack_2313.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_message_2297 = createWorkInProgress( + ? (JSCompiler_object_inline_message_2311 = createWorkInProgress( instance, - JSCompiler_object_inline_message_2297 + JSCompiler_object_inline_message_2311 )) - : ((JSCompiler_object_inline_message_2297 = createFiberFromFragment( - JSCompiler_object_inline_message_2297, - JSCompiler_object_inline_digest_2298, + : ((JSCompiler_object_inline_message_2311 = createFiberFromFragment( + JSCompiler_object_inline_message_2311, + JSCompiler_object_inline_digest_2312, renderLanes, null )), - (JSCompiler_object_inline_message_2297.flags |= 2)), - (JSCompiler_object_inline_message_2297.return = workInProgress), - (JSCompiler_object_inline_stack_2299.return = workInProgress), - (JSCompiler_object_inline_stack_2299.sibling = - JSCompiler_object_inline_message_2297), - (workInProgress.child = JSCompiler_object_inline_stack_2299), - (JSCompiler_object_inline_stack_2299 = - JSCompiler_object_inline_message_2297), - (JSCompiler_object_inline_message_2297 = workInProgress.child), - (JSCompiler_object_inline_digest_2298 = current.child.memoizedState), - null === JSCompiler_object_inline_digest_2298 - ? (JSCompiler_object_inline_digest_2298 = + (JSCompiler_object_inline_message_2311.flags |= 2)), + (JSCompiler_object_inline_message_2311.return = workInProgress), + (JSCompiler_object_inline_stack_2313.return = workInProgress), + (JSCompiler_object_inline_stack_2313.sibling = + JSCompiler_object_inline_message_2311), + (workInProgress.child = JSCompiler_object_inline_stack_2313), + (JSCompiler_object_inline_stack_2313 = + JSCompiler_object_inline_message_2311), + (JSCompiler_object_inline_message_2311 = workInProgress.child), + (JSCompiler_object_inline_digest_2312 = current.child.memoizedState), + null === JSCompiler_object_inline_digest_2312 + ? (JSCompiler_object_inline_digest_2312 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_digest_2298.cachePool), + JSCompiler_object_inline_digest_2312.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9349,38 +9378,38 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_digest_2298 = { + (JSCompiler_object_inline_digest_2312 = { baseLanes: - JSCompiler_object_inline_digest_2298.baseLanes | renderLanes, + JSCompiler_object_inline_digest_2312.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_message_2297.memoizedState = - JSCompiler_object_inline_digest_2298), - (JSCompiler_object_inline_message_2297.childLanes = + (JSCompiler_object_inline_message_2311.memoizedState = + JSCompiler_object_inline_digest_2312), + (JSCompiler_object_inline_message_2311.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2300, + JSCompiler_object_inline_componentStack_2314, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2313 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2299.children + children: JSCompiler_object_inline_stack_2313.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_componentStack_2300 = + ((JSCompiler_object_inline_componentStack_2314 = workInProgress.deletions), - null === JSCompiler_object_inline_componentStack_2300 + null === JSCompiler_object_inline_componentStack_2314 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_componentStack_2300.push(current)); + : JSCompiler_object_inline_componentStack_2314.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -13794,20 +13823,34 @@ (resource.state.loading & Inserted) !== NotLoaded ) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if ( + ((workInProgress.flags |= 16777216), !preloadResource(resource)) + ) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -14604,7 +14647,8 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if ( @@ -14646,25 +14690,37 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root, lanes, forceSync) { if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (exitStatus === RootInProgress) break; - else if (exitStatus === RootDidNotComplete) - markRootSuspended(root, lanes, 0); + if (exitStatus === RootInProgress) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root, lanes, 0, !1); + break; + } else if (exitStatus === RootDidNotComplete) + finalizeRender(lanes, now$1()), + markRootSuspended( + root, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root.current.alternate; if ( @@ -14729,22 +14785,24 @@ } if (exitStatus === RootFatalErrored) { prepareFreshStack(root, 0); - markRootSuspended(root, lanes, 0); + markRootSuspended(root, lanes, 0, !0); break; } a: { - renderWasConcurrent = root; - errorRetryLanes = now$1(); + shouldTimeSlice = root; + renderWasConcurrent = now$1(); switch (exitStatus) { case RootInProgress: case RootFatalErrored: throw Error("Root did not complete. This is a bug in React."); case RootSuspendedWithDelay: if ((lanes & 4194176) === lanes) { + finalizeRender(lanes, now$1()); markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -14758,11 +14816,11 @@ default: throw Error("Unknown root exit status."); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if (null !== ReactSharedInternals.actQueue) commitRoot( - renderWasConcurrent, + shouldTimeSlice, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, @@ -14771,7 +14829,7 @@ workInProgressSuspendedRetryLanes, IMMEDIATE_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ); else { if ( @@ -14783,15 +14841,16 @@ 10 < exitStatus) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14803,14 +14862,14 @@ workInProgressRootDidSkipSuspendedSiblings, THROTTLED_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ), exitStatus ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14822,7 +14881,7 @@ workInProgressRootDidSkipSuspendedSiblings, IMMEDIATE_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ); } } @@ -14854,11 +14913,8 @@ completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, @@ -14884,7 +14940,12 @@ completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended( + root, + lanes, + spawnedLane, + !didSkipSuspendedSiblings + ); return; } commitRoot( @@ -14934,19 +14995,22 @@ } return !0; } - function markRootSuspended(root, suspendedLanes, spawnedLane) { + function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree + ) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { var index = 31 - clz32(lanes), lane = 1 << index; - expirationTimes[index] = -1; + didAttemptEntireTree[index] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -14976,80 +15040,91 @@ } function finalizeRender(lanes, finalizationTime) { if (0 !== (lanes & 3) || 0 !== (lanes & 60)) - 0 <= blockingUpdateTime && - blockingUpdateTime < finalizationTime && - (blockingUpdateTime = finalizationTime), - 0 <= blockingEventTime && - blockingEventTime < finalizationTime && - (blockingEventTime = finalizationTime); - 0 !== (lanes & 4194176) && - (0 <= transitionStartTime && - transitionStartTime < finalizationTime && - (transitionStartTime = finalizationTime), - 0 <= transitionUpdateTime && - transitionUpdateTime < finalizationTime && - (transitionUpdateTime = finalizationTime), - 0 <= transitionEventTime && - transitionEventTime < finalizationTime && - (transitionEventTime = finalizationTime)); + blockingClampTime = finalizationTime; + 0 !== (lanes & 4194176) && (transitionClampTime = finalizationTime); } function prepareFreshStack(root, lanes) { renderStartTime = now(); finalizeRender(workInProgressRootRenderLanes, renderStartTime); if (0 !== (lanes & 3) || 0 !== (lanes & 60)) { - var updateTime = blockingUpdateTime, - eventTime = blockingEventTime, + var updateTime = + 0 <= blockingUpdateTime && blockingUpdateTime < blockingClampTime + ? blockingClampTime + : blockingUpdateTime, + eventTime = + 0 <= blockingEventTime && blockingEventTime < blockingClampTime + ? blockingClampTime + : blockingEventTime, eventType = blockingEventType, + eventIsRepeat = blockingEventIsRepeat, renderStartTime$jscomp$0 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Blocking"), + ((reusableLaneDevToolDetails.track = "Blocking"), 0 < eventTime && null !== eventType && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = eventIsRepeat + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : renderStartTime$jscomp$0), - performance.measure(eventType, reusableComponentOptions)), + performance.measure( + eventIsRepeat ? "" : "Event: " + eventType, + reusableLaneOptions + )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = renderStartTime$jscomp$0), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = renderStartTime$jscomp$0), + performance.measure("Blocked", reusableLaneOptions))); blockingUpdateTime = -1.1; } if (0 !== (lanes & 4194176)) { - updateTime = transitionStartTime; - eventTime = transitionUpdateTime; - eventType = transitionEventTime; - renderStartTime$jscomp$0 = transitionEventType; + updateTime = + 0 <= transitionStartTime && transitionStartTime < transitionClampTime + ? transitionClampTime + : transitionStartTime; + eventTime = + 0 <= transitionUpdateTime && + transitionUpdateTime < transitionClampTime + ? transitionClampTime + : transitionUpdateTime; + eventType = + 0 <= transitionEventTime && transitionEventTime < transitionClampTime + ? transitionClampTime + : transitionEventTime; + eventIsRepeat = transitionEventType; + renderStartTime$jscomp$0 = transitionEventIsRepeat; var renderStartTime$jscomp$1 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Transition"), + ((reusableLaneDevToolDetails.track = "Transition"), 0 < eventType && - null !== renderStartTime$jscomp$0 && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventType), - (reusableComponentOptions.end = + null !== eventIsRepeat && + ((reusableLaneDevToolDetails.color = renderStartTime$jscomp$0 + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventType), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : 0 < eventTime ? eventTime : renderStartTime$jscomp$1), performance.measure( - renderStartTime$jscomp$0, - reusableComponentOptions + renderStartTime$jscomp$0 ? "" : "Event: " + eventIsRepeat, + reusableLaneOptions )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = 0 < eventTime ? eventTime : renderStartTime$jscomp$1), - performance.measure("Action", reusableComponentOptions)), + performance.measure("Action", reusableLaneOptions)), 0 < eventTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = renderStartTime$jscomp$1), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = renderStartTime$jscomp$1), + performance.measure("Blocked", reusableLaneOptions))); transitionUpdateTime = transitionStartTime = -1.1; } root.finishedWork = null; @@ -15066,7 +15141,7 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = RootInProgress; workInProgressSuspendedRetryLanes = @@ -15083,9 +15158,9 @@ if (0 !== eventTime) for (root = root.entanglements, eventTime &= lanes; 0 < eventTime; ) (eventType = 31 - clz32(eventTime)), - (renderStartTime$jscomp$0 = 1 << eventType), + (eventIsRepeat = 1 << eventType), (lanes |= root[eventType]), - (eventTime &= ~renderStartTime$jscomp$0); + (eventTime &= ~eventIsRepeat); entangledRenderLanes = lanes; finishQueueingConcurrentUpdates(); ReactStrictModeWarnings.discardPendingWarnings(); @@ -15099,12 +15174,7 @@ current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? SuspendedOnData - : SuspendedOnImmediate)) + (workInProgressSuspendedReason = SuspendedOnImmediate)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = SuspendedOnInstance)) @@ -15127,21 +15197,6 @@ : erroredWork.mode & ProfileMode && stopProfilerTimerIfRunningAndRecordDuration(erroredWork); } - function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; - } function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -15154,13 +15209,19 @@ } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = RootSuspendedWithDelay; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } function queueConcurrentError(error) { @@ -15168,7 +15229,7 @@ ? (workInProgressRootConcurrentErrors = [error]) : workInProgressRootConcurrentErrors.push(error); } - function renderRootSync(root, lanes) { + function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(), @@ -15210,6 +15271,13 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + memoizedUpdaters = RootInProgress; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -15258,7 +15326,11 @@ workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS; prepareFreshStack(root, lanes); - } else checkIfRootIsPrerendering(root, lanes); + } else + workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + ); a: do try { if ( @@ -15462,7 +15534,12 @@ stopProfilerTimerIfRunningAndRecordDuration(unitOfWork); return current; } - function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason + ) { resetContextDependencies(); resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -15496,9 +15573,25 @@ workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || suspendedReason === SuspendedOnError) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + suspendedReason === SuspendedOnData || + suspendedReason === SuspendedOnImmediate || + suspendedReason === SuspendedOnDeprecatedThrowPromise) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -15622,46 +15715,49 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - updatedLanes = root.finishedWork; + var finishedWork = root.finishedWork; didIncludeRenderPhaseUpdate = root.finishedLanes; - reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane( didIncludeRenderPhaseUpdate ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); - if (null === updatedLanes) return null; + if (null === finishedWork) return null; 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); root.finishedWork = null; root.finishedLanes = 0; - if (updatedLanes === root.current) + if (finishedWork === root.current) throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." ); root.callbackNode = null; root.callbackPriority = 0; root.cancelPendingCommit = null; - completedRenderStartTime = updatedLanes.lanes | updatedLanes.childLanes; + completedRenderStartTime = finishedWork.lanes | finishedWork.childLanes; completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, didIncludeRenderPhaseUpdate, completedRenderStartTime, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === updatedLanes.actualDuration && - 0 === (updatedLanes.subtreeFlags & 10256) && - 0 === (updatedLanes.flags & 10256)) || + (0 === finishedWork.actualDuration && + 0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), (pendingPassiveEffectsRemainingLanes = completedRenderStartTime), (pendingPassiveEffectsRenderEndTime = completedRenderEndTime), (pendingPassiveTransitions = transitions), scheduleCallback$1(NormalPriority$1, function () { + schedulerEvent = window.event; flushPassiveEffects(!0); return null; })); @@ -15670,33 +15766,38 @@ ? logSuspendedCommitPhase(completedRenderEndTime, commitStartTime) : suspendedCommitReason === THROTTLED_COMMIT && logSuspenseThrottlePhase(completedRenderEndTime, commitStartTime); - transitions = 0 !== (updatedLanes.flags & 15990); - 0 !== (updatedLanes.subtreeFlags & 15990) || transitions + transitions = 0 !== (finishedWork.flags & 15990); + 0 !== (finishedWork.subtreeFlags & 15990) || transitions ? ((transitions = ReactSharedInternals.T), (ReactSharedInternals.T = null), (spawnedLane = ReactDOMSharedInternals.p), (ReactDOMSharedInternals.p = DiscreteEventPriority), - (suspendedCommitReason = executionContext), + (updatedLanes = executionContext), (executionContext |= CommitContext), - commitBeforeMutationEffects(root, updatedLanes), + commitBeforeMutationEffects(root, finishedWork), commitMutationEffects( root, - updatedLanes, + finishedWork, didIncludeRenderPhaseUpdate ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), - (root.current = updatedLanes), - commitLayoutEffects(updatedLanes, root, didIncludeRenderPhaseUpdate), + (root.current = finishedWork), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), - (executionContext = suspendedCommitReason), + (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), (ReactSharedInternals.T = transitions)) - : (root.current = updatedLanes); + : (root.current = finishedWork); commitEndTime = now(); - logCommitPhase(commitStartTime, commitEndTime); - (transitions = rootDoesHavePassiveEffects) + logCommitPhase( + suspendedCommitReason === IMMEDIATE_COMMIT + ? completedRenderEndTime + : commitStartTime, + commitEndTime + ); + (suspendedCommitReason = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) @@ -15706,24 +15807,25 @@ completedRenderStartTime = root.pendingLanes; 0 === completedRenderStartTime && (legacyErrorBoundariesThatAlreadyFailed = null); - transitions || commitDoubleInvokeEffectsInDEV(root); - onCommitRoot$1(updatedLanes.stateNode, renderPriorityLevel); + suspendedCommitReason || commitDoubleInvokeEffectsInDEV(root); + onCommitRoot$1(finishedWork.stateNode, renderPriorityLevel); isDevToolsPresent && root.memoizedUpdaters.clear(); onCommitRoot(); ensureRootIsScheduled(root); if (null !== recoverableErrors) for ( - renderPriorityLevel = root.onRecoverableError, updatedLanes = 0; - updatedLanes < recoverableErrors.length; - updatedLanes++ + renderPriorityLevel = root.onRecoverableError, + completedRenderEndTime = 0; + completedRenderEndTime < recoverableErrors.length; + completedRenderEndTime++ ) - (completedRenderStartTime = recoverableErrors[updatedLanes]), - (spawnedLane = makeErrorInfo(completedRenderStartTime.stack)), + (finishedWork = recoverableErrors[completedRenderEndTime]), + (completedRenderStartTime = makeErrorInfo(finishedWork.stack)), runWithFiberInDEV( - completedRenderStartTime.source, + finishedWork.source, renderPriorityLevel, - completedRenderStartTime.value, - spawnedLane + finishedWork.value, + completedRenderStartTime ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; @@ -15734,7 +15836,8 @@ ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); + suspendedCommitReason || + finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -15786,7 +15889,7 @@ throw Error( "Cannot flush passive effects while already rendering." ); - reusableComponentDevToolDetails.track = + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane(lanes); isFlushingPassiveEffects = !0; didScheduleUpdateDuringPassiveEffects = !1; @@ -15794,15 +15897,16 @@ passiveEffectStartTime = now$1(); var startTime = commitEndTime, endTime = passiveEffectStartTime; + wasDelayedCommit = !!wasDelayedCommit; supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), performance.measure( - "Waiting for Paint", - reusableComponentOptions + wasDelayedCommit ? "Waiting for Paint" : "", + reusableLaneOptions )); - startTime = executionContext; + wasDelayedCommit = executionContext; executionContext |= CommitContext; var finishedWork = priority.current; resetComponentEffectTimers(); @@ -15818,18 +15922,14 @@ finishedWork ); commitDoubleInvokeEffectsInDEV(priority); - executionContext = startTime; + executionContext = wasDelayedCommit; var passiveEffectsEndTime = now$1(); - wasDelayedCommit && - ((wasDelayedCommit = passiveEffectStartTime), - supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = wasDelayedCommit), - (reusableComponentOptions.end = passiveEffectsEndTime), - performance.measure( - "Remaining Effects", - reusableComponentOptions - ))); + finishedWork$jscomp$0 = passiveEffectStartTime; + supportsUserTiming && + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = finishedWork$jscomp$0), + (reusableLaneOptions.end = passiveEffectsEndTime), + performance.measure("Remaining Effects", reusableLaneOptions)); finalizeRender(lanes, passiveEffectsEndTime); flushSyncWorkAcrossRoots_impl(0, !1); didScheduleUpdateDuringPassiveEffects @@ -16174,6 +16274,7 @@ } } function processRootScheduleInMicrotask() { + schedulerEvent = window.event; mightHavePendingSyncWork = didScheduleMicrotask_act = didScheduleMicrotask = @@ -16238,7 +16339,10 @@ (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) + if ( + 0 !== (suspendedLanes & 3) && + !checkIfRootIsPrerendering(root, suspendedLanes) + ) return ( null !== pingedLanes && cancelCallback(pingedLanes), (root.callbackPriority = 2), @@ -16278,6 +16382,7 @@ } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; + schedulerEvent = window.event; var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) return null; @@ -19410,11 +19515,11 @@ } function resolveEventType() { var event = window.event; - return event ? event.type : null; + return event && event !== schedulerEvent ? event.type : null; } function resolveEventTimeStamp() { var event = window.event; - return event ? event.timeStamp : -1.1; + return event && event !== schedulerEvent ? event.timeStamp : -1.1; } function handleErrorInNextTick(error) { setTimeout(function () { @@ -22557,14 +22662,24 @@ reusableComponentDevToolDetails = { dataType: "track-entry", color: "primary", - track: "Blocking", - trackGroup: "Components \u269b" + track: "Components \u269b" }, reusableComponentOptions = { start: -0, end: -0, detail: { devtools: reusableComponentDevToolDetails } }, + reusableLaneDevToolDetails = { + dataType: "track-entry", + color: "primary", + track: "Blocking", + trackGroup: "Scheduler \u269b" + }, + reusableLaneOptions = { + start: -0, + end: -0, + detail: { devtools: reusableLaneDevToolDetails } + }, OffscreenVisible = 1, OffscreenDetached = 2, OffscreenPassiveEffectsConnected = 4, @@ -22590,13 +22705,17 @@ componentEffectDuration = -0, componentEffectStartTime = -1.1, componentEffectEndTime = -1.1, + blockingClampTime = -0, blockingUpdateTime = -1.1, blockingEventTime = -1.1, blockingEventType = null, + blockingEventIsRepeat = !1, + transitionClampTime = -0, transitionStartTime = -1.1, transitionUpdateTime = -1.1, transitionEventTime = -1.1, transitionEventType = null, + transitionEventIsRepeat = !1, currentUpdateIsNested = !1, nestedUpdateScheduled = !1, ReactStrictModeWarnings = { @@ -23051,15 +23170,23 @@ currentEntangledActionThenable = null, prevOnStartTransitionFinish = ReactSharedInternals.S; ReactSharedInternals.S = function (transition, returnValue) { - "object" === typeof returnValue && + if ( + "object" === typeof returnValue && null !== returnValue && - "function" === typeof returnValue.then && - (0 > transitionStartTime && - 0 > transitionUpdateTime && - ((transitionStartTime = now()), - (transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType())), - entangleAsyncAction(transition, returnValue)); + "function" === typeof returnValue.then + ) { + if (0 > transitionStartTime && 0 > transitionUpdateTime) { + transitionStartTime = now(); + var newEventTime = resolveEventTimeStamp(), + newEventType = resolveEventType(); + transitionEventIsRepeat = + newEventTime === transitionEventTime && + newEventType === transitionEventType; + transitionEventTime = newEventTime; + transitionEventType = newEventType; + } + entangleAsyncAction(transition, returnValue); + } null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); }; @@ -24391,6 +24518,7 @@ workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = RootInProgress, @@ -24530,6 +24658,7 @@ selectionInformation = null, warnedUnknownTags = { dialog: !0, webview: !0 }, currentPopstateTransitionEvent = null, + schedulerEvent = void 0, scheduleTimeout = "function" === typeof setTimeout ? setTimeout : void 0, cancelTimeout = "function" === typeof clearTimeout ? clearTimeout : void 0, @@ -24970,11 +25099,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25011,11 +25140,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113" + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25487,7 +25616,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; "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 5cd83e467a35a..3f9a08e38806d 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 @@ -677,28 +677,40 @@ function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -772,7 +784,14 @@ function markRootUpdated$1(root, updateLane) { 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } -function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { +function markRootFinished( + root, + finishedLanes, + remainingLanes, + spawnedLane, + updatedLanes, + suspendedRetryLanes +) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -782,31 +801,36 @@ function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index$6 = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index$6; - finishedLanes[index$6] = 0; - expirationTimes[index$6] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$6]; + var index$7 = 31 - clz32(remainingLanes), + lane = 1 << index$7; + entanglements[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$6] = null, index$6 = 0; - index$6 < hiddenUpdatesForLane.length; - index$6++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$6]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -821,19 +845,19 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$7 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$7; - (lane & entangledLanes) | (root[index$7] & entangledLanes) && - (root[index$7] |= entangledLanes); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } function addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - root[index$9].add(fiber); + var index$10 = 31 - clz32(lanes), + lane = 1 << index$10; + root[index$10].add(fiber); lanes &= ~lane; } } @@ -845,16 +869,16 @@ function movePendingFibersToMemoized(root, lanes) { 0 < lanes; ) { - var index$10 = 31 - clz32(lanes); - root = 1 << index$10; - index$10 = pendingUpdatersLaneMap[index$10]; - 0 < index$10.size && - (index$10.forEach(function (fiber) { + var index$11 = 31 - clz32(lanes); + root = 1 << index$11; + index$11 = pendingUpdatersLaneMap[index$11]; + 0 < index$11.size && + (index$11.forEach(function (fiber) { var alternate = fiber.alternate; (null !== alternate && memoizedUpdaters.has(alternate)) || memoizedUpdaters.add(fiber); }), - index$10.clear()); + index$11.clear()); lanes &= ~root; } } @@ -1015,8 +1039,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$11 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$11 && "aria-" !== prefix$11) { + var prefix$12 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$12 && "aria-" !== prefix$12) { node.removeAttribute(name); return; } @@ -1349,15 +1373,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$17 in styles) - (styleName = styles[styleName$17]), - styles.hasOwnProperty(styleName$17) && - prevStyles[styleName$17] !== styleName && - setValueForStyle(node, styleName$17, styleName); - } else for (var styleName$18 in styles) - styles.hasOwnProperty(styleName$18) && - setValueForStyle(node, styleName$18, styles[styleName$18]); + (styleName = styles[styleName$18]), + styles.hasOwnProperty(styleName$18) && + prevStyles[styleName$18] !== styleName && + setValueForStyle(node, styleName$18, styleName); + } else + for (var styleName$19 in styles) + styles.hasOwnProperty(styleName$19) && + setValueForStyle(node, styleName$19, styles[styleName$19]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -2086,19 +2110,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$297; + var JSCompiler_inline_result$jscomp$304; if (canUseDOM) { - var isSupported$jscomp$inline_432 = "oninput" in document; - if (!isSupported$jscomp$inline_432) { - var element$jscomp$inline_433 = document.createElement("div"); - element$jscomp$inline_433.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_432 = - "function" === typeof element$jscomp$inline_433.oninput; + var isSupported$jscomp$inline_439 = "oninput" in document; + if (!isSupported$jscomp$inline_439) { + var element$jscomp$inline_440 = document.createElement("div"); + element$jscomp$inline_440.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_439 = + "function" === typeof element$jscomp$inline_440.oninput; } - JSCompiler_inline_result$jscomp$297 = isSupported$jscomp$inline_432; - } else JSCompiler_inline_result$jscomp$297 = !1; + JSCompiler_inline_result$jscomp$304 = isSupported$jscomp$inline_439; + } else JSCompiler_inline_result$jscomp$304 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$297 && + JSCompiler_inline_result$jscomp$304 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -2442,13 +2466,23 @@ var supportsUserTiming = reusableComponentDevToolDetails = { dataType: "track-entry", color: "primary", - track: "Blocking", - trackGroup: "Components \u269b" + track: "Components \u269b" }, reusableComponentOptions = { start: -0, end: -0, detail: { devtools: reusableComponentDevToolDetails } + }, + reusableLaneDevToolDetails = { + dataType: "track-entry", + color: "primary", + track: "Blocking", + trackGroup: "Scheduler \u269b" + }, + reusableLaneOptions = { + start: -0, + end: -0, + detail: { devtools: reusableLaneDevToolDetails } }; function logComponentEffect(fiber, startTime, endTime, selfTime) { fiber = getComponentNameFromFiber(fiber); @@ -2468,31 +2502,31 @@ function logComponentEffect(fiber, startTime, endTime, selfTime) { } function logRenderPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Render", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Render", reusableLaneOptions)); } function logSuspenseThrottlePhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Throttled", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Throttled", reusableLaneOptions)); } function logSuspendedCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Suspended", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Suspended", reusableLaneOptions)); } function logCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Commit", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Commit", reusableLaneOptions)); } var concurrentQueues = [], concurrentQueuesIndex = 0, @@ -2586,27 +2620,40 @@ var emptyContextObject = {}, componentEffectDuration = -0, componentEffectStartTime = -1.1, componentEffectEndTime = -1.1, + blockingClampTime = -0, blockingUpdateTime = -1.1, blockingEventTime = -1.1, blockingEventType = null, + blockingEventIsRepeat = !1, + transitionClampTime = -0, transitionStartTime = -1.1, transitionUpdateTime = -1.1, transitionEventTime = -1.1, - transitionEventType = null; + transitionEventType = null, + transitionEventIsRepeat = !1; function startUpdateTimerByLane(lane) { var JSCompiler_temp; (JSCompiler_temp = 0 !== (lane & 3)) || (JSCompiler_temp = 0 !== (lane & 60)); JSCompiler_temp ? 0 > blockingUpdateTime && ((blockingUpdateTime = now()), - (blockingEventTime = resolveEventTimeStamp()), - (blockingEventType = resolveEventType())) + (lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (blockingEventIsRepeat = + lane === blockingEventTime && JSCompiler_temp === blockingEventType), + (blockingEventTime = lane), + (blockingEventType = JSCompiler_temp)) : 0 !== (lane & 4194176) && 0 > transitionUpdateTime && ((transitionUpdateTime = now()), 0 > transitionStartTime && - ((transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType()))); + ((lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (transitionEventIsRepeat = + lane === transitionEventTime && + JSCompiler_temp === transitionEventType), + (transitionEventTime = lane), + (transitionEventType = JSCompiler_temp))); } function pushNestedEffectDurations() { var prevEffectDuration = profilerEffectDuration; @@ -3907,15 +3954,23 @@ function chainThenableValue(thenable, result) { } var prevOnStartTransitionFinish = ReactSharedInternals.S; ReactSharedInternals.S = function (transition, returnValue) { - "object" === typeof returnValue && + if ( + "object" === typeof returnValue && null !== returnValue && - "function" === typeof returnValue.then && - (0 > transitionStartTime && - 0 > transitionUpdateTime && - ((transitionStartTime = now()), - (transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType())), - entangleAsyncAction(transition, returnValue)); + "function" === typeof returnValue.then + ) { + if (0 > transitionStartTime && 0 > transitionUpdateTime) { + transitionStartTime = now(); + var newEventTime = resolveEventTimeStamp(), + newEventType = resolveEventType(); + transitionEventIsRepeat = + newEventTime === transitionEventTime && + newEventType === transitionEventType; + transitionEventTime = newEventTime; + transitionEventType = newEventType; + } + entangleAsyncAction(transition, returnValue); + } null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); }; @@ -4204,7 +4259,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$56 = !1; + didReadFromEntangledAsyncAction$59 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -4225,11 +4280,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$56 = !0); + (didReadFromEntangledAsyncAction$59 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$56 = !0); + (didReadFromEntangledAsyncAction$59 = !0); continue; } else (updateLane = { @@ -4275,7 +4330,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$56 && + didReadFromEntangledAsyncAction$59 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4477,8 +4532,8 @@ function runActionStateAction(actionQueue, node) { try { (prevTransition = action(prevState, payload)), handleActionReturnValue(actionQueue, node, prevTransition); - } catch (error$62) { - onActionError(actionQueue, node, error$62); + } catch (error$65) { + onActionError(actionQueue, node, error$65); } } function handleActionReturnValue(actionQueue, node, returnValue) { @@ -4931,15 +4986,15 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$65 = enqueueUpdate(provider, fiber, lane); - null !== root$65 && + var root$68 = enqueueUpdate(provider, fiber, lane); + null !== root$68 && (startUpdateTimerByLane(lane), - scheduleUpdateOnFiber(root$65, provider, lane), - entangleTransitions(root$65, provider, lane)); + scheduleUpdateOnFiber(root$68, provider, lane), + entangleTransitions(root$68, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$65 && + null !== root$68 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -5484,9 +5539,9 @@ function resolveClassComponentProps(Component, baseProps) { } if ((Component = Component.defaultProps)) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$69 in Component) - void 0 === newProps[propName$69] && - (newProps[propName$69] = Component[propName$69]); + for (var propName$72 in Component) + void 0 === newProps[propName$72] && + (newProps[propName$72] = Component[propName$72]); } return newProps; } @@ -5532,9 +5587,9 @@ function logUncaughtError(root, errorInfo) { try { var onUncaughtError = root.onUncaughtError; onUncaughtError(errorInfo.value, { componentStack: errorInfo.stack }); - } catch (e$70) { + } catch (e$73) { setTimeout(function () { - throw e$70; + throw e$73; }); } } @@ -5545,9 +5600,9 @@ function logCaughtError(root, boundary, errorInfo) { componentStack: errorInfo.stack, errorBoundary: 1 === boundary.tag ? boundary.stateNode : null }); - } catch (e$71) { + } catch (e$74) { setTimeout(function () { - throw e$71; + throw e$74; }); } } @@ -8038,8 +8093,8 @@ function safelyCallComponentWillUnmount( } else try { instance.componentWillUnmount(); - } catch (error$119) { - captureCommitPhaseError(current, nearestMountedAncestor, error$119); + } catch (error$122) { + captureCommitPhaseError(current, nearestMountedAncestor, error$122); } } function safelyAttachRef(current, nearestMountedAncestor) { @@ -8099,8 +8154,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordEffectDuration(current); } else ref(null); - } catch (error$120) { - captureCommitPhaseError(current, nearestMountedAncestor, error$120); + } catch (error$123) { + captureCommitPhaseError(current, nearestMountedAncestor, error$123); } else ref.current = null; } @@ -8269,7 +8324,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$21) { + } catch (e$22) { JSCompiler_temp = null; break a; } @@ -8439,11 +8494,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$116) { + } catch (error$119) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$116 + error$119 ); } else { @@ -8460,11 +8515,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$117) { + } catch (error$120) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$117 + error$120 ); } recordEffectDuration(); @@ -8475,11 +8530,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$118) { + } catch (error$121) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$118 + error$121 ); } } @@ -8657,7 +8712,7 @@ function commitDeletionEffectsOnFiber( safelyDetachRef(deletedFiber, nearestMountedAncestor); case 6: prevHostParentIsContainer = hostParent; - var prevHostParentIsContainer$128 = hostParentIsContainer; + var prevHostParentIsContainer$131 = hostParentIsContainer; hostParent = null; recursivelyTraverseDeletionEffects( finishedRoot, @@ -8665,7 +8720,7 @@ function commitDeletionEffectsOnFiber( deletedFiber ); hostParent = prevHostParentIsContainer; - hostParentIsContainer = prevHostParentIsContainer$128; + hostParentIsContainer = prevHostParentIsContainer$131; if (null !== hostParent) if (hostParentIsContainer) try { @@ -9326,21 +9381,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$121 = JSCompiler_inline_result.stateNode; + var parent$124 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$121, ""), + (setTextContent(parent$124, ""), (JSCompiler_inline_result.flags &= -33)); - var before$122 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$122, parent$121); + var before$125 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$125, parent$124); break; case 3: case 4: - var parent$123 = JSCompiler_inline_result.stateNode.containerInfo, - before$124 = getHostSibling(finishedWork); + var parent$126 = JSCompiler_inline_result.stateNode.containerInfo, + before$127 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$124, - parent$123 + before$127, + parent$126 ); break; default: @@ -10346,20 +10401,32 @@ function markUpdate(workInProgress) { function preloadResourceAndSuspendIfNeeded(workInProgress, resource) { if ("stylesheet" !== resource.type || 0 !== (resource.state.loading & 4)) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -10376,14 +10443,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$143 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$143 = lastTailNode), + for (var lastTailNode$146 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$146 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$143 + null === lastTailNode$146 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$143.sibling = null); + : (lastTailNode$146.sibling = null); } } function bubbleProperties(completedWork) { @@ -10395,53 +10462,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$145 = completedWork.selfBaseDuration, - child$146 = completedWork.child; - null !== child$146; + var treeBaseDuration$148 = completedWork.selfBaseDuration, + child$149 = completedWork.child; + null !== child$149; ) - (newChildLanes |= child$146.lanes | child$146.childLanes), - (subtreeFlags |= child$146.subtreeFlags & 31457280), - (subtreeFlags |= child$146.flags & 31457280), - (treeBaseDuration$145 += child$146.treeBaseDuration), - (child$146 = child$146.sibling); - completedWork.treeBaseDuration = treeBaseDuration$145; + (newChildLanes |= child$149.lanes | child$149.childLanes), + (subtreeFlags |= child$149.subtreeFlags & 31457280), + (subtreeFlags |= child$149.flags & 31457280), + (treeBaseDuration$148 += child$149.treeBaseDuration), + (child$149 = child$149.sibling); + completedWork.treeBaseDuration = treeBaseDuration$148; } else for ( - treeBaseDuration$145 = completedWork.child; - null !== treeBaseDuration$145; + treeBaseDuration$148 = completedWork.child; + null !== treeBaseDuration$148; ) (newChildLanes |= - treeBaseDuration$145.lanes | treeBaseDuration$145.childLanes), - (subtreeFlags |= treeBaseDuration$145.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$145.flags & 31457280), - (treeBaseDuration$145.return = completedWork), - (treeBaseDuration$145 = treeBaseDuration$145.sibling); + treeBaseDuration$148.lanes | treeBaseDuration$148.childLanes), + (subtreeFlags |= treeBaseDuration$148.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$148.flags & 31457280), + (treeBaseDuration$148.return = completedWork), + (treeBaseDuration$148 = treeBaseDuration$148.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$145 = completedWork.actualDuration; - child$146 = completedWork.selfBaseDuration; + treeBaseDuration$148 = completedWork.actualDuration; + child$149 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$145 += child.actualDuration), - (child$146 += child.treeBaseDuration), + (treeBaseDuration$148 += child.actualDuration), + (child$149 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$145; - completedWork.treeBaseDuration = child$146; + completedWork.actualDuration = treeBaseDuration$148; + completedWork.treeBaseDuration = child$149; } else for ( - treeBaseDuration$145 = completedWork.child; - null !== treeBaseDuration$145; + treeBaseDuration$148 = completedWork.child; + null !== treeBaseDuration$148; ) (newChildLanes |= - treeBaseDuration$145.lanes | treeBaseDuration$145.childLanes), - (subtreeFlags |= treeBaseDuration$145.subtreeFlags), - (subtreeFlags |= treeBaseDuration$145.flags), - (treeBaseDuration$145.return = completedWork), - (treeBaseDuration$145 = treeBaseDuration$145.sibling); + treeBaseDuration$148.lanes | treeBaseDuration$148.childLanes), + (subtreeFlags |= treeBaseDuration$148.subtreeFlags), + (subtreeFlags |= treeBaseDuration$148.flags), + (treeBaseDuration$148.return = completedWork), + (treeBaseDuration$148 = treeBaseDuration$148.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -10734,11 +10801,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (type = newProps.alternate.memoizedState.cachePool.pool); - var cache$161 = null; + var cache$164 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$161 = newProps.memoizedState.cachePool.pool); - cache$161 !== type && (newProps.flags |= 2048); + (cache$164 = newProps.memoizedState.cachePool.pool); + cache$164 !== type && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -10768,8 +10835,8 @@ function completeWork(current, workInProgress, renderLanes) { type = workInProgress.memoizedState; if (null === type) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$161 = type.rendering; - if (null === cache$161) + cache$164 = type.rendering; + if (null === cache$164) if (newProps) cutOffTailIfNeeded(type, !1); else { if ( @@ -10777,11 +10844,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$161 = findFirstSuspended(current); - if (null !== cache$161) { + cache$164 = findFirstSuspended(current); + if (null !== cache$164) { workInProgress.flags |= 128; cutOffTailIfNeeded(type, !1); - current = cache$161.updateQueue; + current = cache$164.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -10806,7 +10873,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$161)), null !== current)) { + if (((current = findFirstSuspended(cache$164)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -10816,7 +10883,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !0), null === type.tail && "hidden" === type.tailMode && - !cache$161.alternate && + !cache$164.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -10829,13 +10896,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !1), (workInProgress.lanes = 4194304)); type.isBackwards - ? ((cache$161.sibling = workInProgress.child), - (workInProgress.child = cache$161)) + ? ((cache$164.sibling = workInProgress.child), + (workInProgress.child = cache$164)) : ((current = type.last), null !== current - ? (current.sibling = cache$161) - : (workInProgress.child = cache$161), - (type.last = cache$161)); + ? (current.sibling = cache$164) + : (workInProgress.child = cache$164), + (type.last = cache$164)); } if (null !== type.tail) return ( @@ -11018,6 +11085,7 @@ var DefaultAsyncDispatcher = { workInProgressSuspendedReason = 0, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, @@ -11069,7 +11137,8 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) @@ -11081,23 +11150,36 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root$jscomp$0.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root$jscomp$0, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root$jscomp$0, lanes) : renderRootSync(root$jscomp$0, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (0 === exitStatus) break; - else if (6 === exitStatus) markRootSuspended(root$jscomp$0, lanes, 0); + if (0 === exitStatus) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root$jscomp$0, lanes, 0, !1); + break; + } else if (6 === exitStatus) + finalizeRender(lanes, now$1()), + markRootSuspended( + root$jscomp$0, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root$jscomp$0.current.alternate; if ( @@ -11157,22 +11239,25 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { } if (1 === exitStatus) { prepareFreshStack(root$jscomp$0, 0); - markRootSuspended(root$jscomp$0, lanes, 0); + markRootSuspended(root$jscomp$0, lanes, 0, !0); break; } a: { - renderWasConcurrent = root$jscomp$0; - JSCompiler_inline_result = now$1(); - switch (exitStatus) { + shouldTimeSlice = root$jscomp$0; + renderWasConcurrent = exitStatus; + exitStatus = now$1(); + switch (renderWasConcurrent) { case 0: case 1: throw Error(formatProdErrorMessage(345)); case 4: if ((lanes & 4194176) === lanes) { + finalizeRender(lanes, now$1()); markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -11186,23 +11271,24 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { default: throw Error(formatProdErrorMessage(329)); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if ( (lanes & 62914560) === lanes && - ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), - 10 < exitStatus) + ((renderWasConcurrent = globalMostRecentFallbackTime + 300 - now$1()), + 10 < renderWasConcurrent) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -11214,14 +11300,14 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { workInProgressRootDidSkipSuspendedSiblings, 2, renderStartTime, - JSCompiler_inline_result + exitStatus ), - exitStatus + renderWasConcurrent ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -11233,7 +11319,7 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { workInProgressRootDidSkipSuspendedSiblings, 0, renderStartTime, - JSCompiler_inline_result + exitStatus ); } } @@ -11264,11 +11350,8 @@ function commitRootWhenReady( completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop$1 }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -11290,7 +11373,7 @@ function commitRootWhenReady( completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended(root, lanes, spawnedLane, !didSkipSuspendedSiblings); return; } commitRoot( @@ -11340,19 +11423,22 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes, spawnedLane) { +function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree +) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + didAttemptEntireTree[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -11382,80 +11468,90 @@ function resetWorkInProgressStack() { } function finalizeRender(lanes, finalizationTime) { if (0 !== (lanes & 3) || 0 !== (lanes & 60)) - 0 <= blockingUpdateTime && - blockingUpdateTime < finalizationTime && - (blockingUpdateTime = finalizationTime), - 0 <= blockingEventTime && - blockingEventTime < finalizationTime && - (blockingEventTime = finalizationTime); - 0 !== (lanes & 4194176) && - (0 <= transitionStartTime && - transitionStartTime < finalizationTime && - (transitionStartTime = finalizationTime), - 0 <= transitionUpdateTime && - transitionUpdateTime < finalizationTime && - (transitionUpdateTime = finalizationTime), - 0 <= transitionEventTime && - transitionEventTime < finalizationTime && - (transitionEventTime = finalizationTime)); + blockingClampTime = finalizationTime; + 0 !== (lanes & 4194176) && (transitionClampTime = finalizationTime); } function prepareFreshStack(root, lanes) { renderStartTime = now(); finalizeRender(workInProgressRootRenderLanes, renderStartTime); if (0 !== (lanes & 3) || 0 !== (lanes & 60)) { - var updateTime = blockingUpdateTime, - eventTime = blockingEventTime, + var updateTime = + 0 <= blockingUpdateTime && blockingUpdateTime < blockingClampTime + ? blockingClampTime + : blockingUpdateTime, + eventTime = + 0 <= blockingEventTime && blockingEventTime < blockingClampTime + ? blockingClampTime + : blockingEventTime, eventType = blockingEventType, + eventIsRepeat = blockingEventIsRepeat, renderStartTime$jscomp$0 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Blocking"), + ((reusableLaneDevToolDetails.track = "Blocking"), 0 < eventTime && null !== eventType && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = eventIsRepeat + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : renderStartTime$jscomp$0), - performance.measure(eventType, reusableComponentOptions)), + performance.measure( + eventIsRepeat ? "" : "Event: " + eventType, + reusableLaneOptions + )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = renderStartTime$jscomp$0), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = renderStartTime$jscomp$0), + performance.measure("Blocked", reusableLaneOptions))); blockingUpdateTime = -1.1; } if (0 !== (lanes & 4194176)) { - updateTime = transitionStartTime; - eventTime = transitionUpdateTime; - eventType = transitionEventTime; - renderStartTime$jscomp$0 = transitionEventType; + updateTime = + 0 <= transitionStartTime && transitionStartTime < transitionClampTime + ? transitionClampTime + : transitionStartTime; + eventTime = + 0 <= transitionUpdateTime && transitionUpdateTime < transitionClampTime + ? transitionClampTime + : transitionUpdateTime; + eventType = + 0 <= transitionEventTime && transitionEventTime < transitionClampTime + ? transitionClampTime + : transitionEventTime; + eventIsRepeat = transitionEventType; + renderStartTime$jscomp$0 = transitionEventIsRepeat; var renderStartTime$jscomp$1 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Transition"), + ((reusableLaneDevToolDetails.track = "Transition"), 0 < eventType && - null !== renderStartTime$jscomp$0 && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventType), - (reusableComponentOptions.end = + null !== eventIsRepeat && + ((reusableLaneDevToolDetails.color = renderStartTime$jscomp$0 + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventType), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : 0 < eventTime ? eventTime : renderStartTime$jscomp$1), performance.measure( - renderStartTime$jscomp$0, - reusableComponentOptions + renderStartTime$jscomp$0 ? "" : "Event: " + eventIsRepeat, + reusableLaneOptions )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = 0 < eventTime ? eventTime : renderStartTime$jscomp$1), - performance.measure("Action", reusableComponentOptions)), + performance.measure("Action", reusableLaneOptions)), 0 < eventTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = renderStartTime$jscomp$1), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = renderStartTime$jscomp$1), + performance.measure("Blocked", reusableLaneOptions))); transitionUpdateTime = transitionStartTime = -1.1; } root.finishedWork = null; @@ -11471,7 +11567,7 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressSuspendedRetryLanes = workInProgressDeferredLane = @@ -11488,9 +11584,9 @@ function prepareFreshStack(root, lanes) { if (0 !== eventTime) for (root = root.entanglements, eventTime &= lanes; 0 < eventTime; ) (eventType = 31 - clz32(eventTime)), - (renderStartTime$jscomp$0 = 1 << eventType), + (eventIsRepeat = 1 << eventType), (lanes |= root[eventType]), - (eventTime &= ~renderStartTime$jscomp$0); + (eventTime &= ~eventIsRepeat); entangledRenderLanes = lanes; finishQueueingConcurrentUpdates(); return updateTime; @@ -11500,12 +11596,7 @@ function handleThrow(root, thrownValue) { ReactSharedInternals.H = ContextOnlyDispatcher; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 2 - : 3)) + (workInProgressSuspendedReason = 3)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = 4)) @@ -11528,21 +11619,6 @@ function handleThrow(root, thrownValue) { : erroredWork.mode & 2 && stopProfilerTimerIfRunningAndRecordDuration(erroredWork); } -function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; -} function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -11555,13 +11631,19 @@ function pushAsyncDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } function queueConcurrentError(error) { @@ -11569,7 +11651,7 @@ function queueConcurrentError(error) { ? (workInProgressRootConcurrentErrors = [error]) : workInProgressRootConcurrentErrors.push(error); } -function renderRootSync(root, lanes) { +function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= 2; var prevDispatcher = pushDispatcher(), @@ -11605,6 +11687,13 @@ function renderRootSync(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + memoizedUpdaters = 0; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -11616,8 +11705,8 @@ function renderRootSync(root, lanes) { workLoopSync(); memoizedUpdaters = workInProgressRootExitStatus; break; - } catch (thrownValue$177) { - handleThrow(root, thrownValue$177); + } catch (thrownValue$184) { + handleThrow(root, thrownValue$184); } while (1); lanes && root.shellSuspendCounter++; @@ -11650,7 +11739,8 @@ function renderRootConcurrent(root, lanes) { workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + 500; prepareFreshStack(root, lanes); - } else checkIfRootIsPrerendering(root, lanes); + } else + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); a: do try { if (0 !== workInProgressSuspendedReason && null !== workInProgress) @@ -11735,8 +11825,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$179) { - handleThrow(root, thrownValue$179); + } catch (thrownValue$186) { + handleThrow(root, thrownValue$186); } while (1); lastContextDependency = currentlyRenderingFiber = null; @@ -11805,7 +11895,12 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason +) { lastContextDependency = currentlyRenderingFiber = null; resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -11839,9 +11934,23 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || 1 === suspendedReason) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + 2 === suspendedReason || 3 === suspendedReason || 6 === suspendedReason) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -11953,39 +12062,42 @@ function commitRootImpl( do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - updatedLanes = root.finishedWork; + var finishedWork = root.finishedWork; didIncludeRenderPhaseUpdate = root.finishedLanes; - reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane( didIncludeRenderPhaseUpdate ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); - if (null === updatedLanes) return null; + if (null === finishedWork) return null; root.finishedWork = null; root.finishedLanes = 0; - if (updatedLanes === root.current) throw Error(formatProdErrorMessage(177)); + if (finishedWork === root.current) throw Error(formatProdErrorMessage(177)); root.callbackNode = null; root.callbackPriority = 0; root.cancelPendingCommit = null; - completedRenderStartTime = updatedLanes.lanes | updatedLanes.childLanes; + completedRenderStartTime = finishedWork.lanes | finishedWork.childLanes; completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, didIncludeRenderPhaseUpdate, completedRenderStartTime, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === updatedLanes.actualDuration && - 0 === (updatedLanes.subtreeFlags & 10256) && - 0 === (updatedLanes.flags & 10256)) || + (0 === finishedWork.actualDuration && + 0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), (pendingPassiveEffectsRemainingLanes = completedRenderStartTime), (pendingPassiveEffectsRenderEndTime = completedRenderEndTime), (pendingPassiveTransitions = transitions), scheduleCallback$1(NormalPriority$1, function () { + schedulerEvent = window.event; flushPassiveEffects(!0); return null; })); @@ -11994,29 +12106,32 @@ function commitRootImpl( ? logSuspendedCommitPhase(completedRenderEndTime, commitStartTime) : 2 === suspendedCommitReason && logSuspenseThrottlePhase(completedRenderEndTime, commitStartTime); - transitions = 0 !== (updatedLanes.flags & 15990); - 0 !== (updatedLanes.subtreeFlags & 15990) || transitions + transitions = 0 !== (finishedWork.flags & 15990); + 0 !== (finishedWork.subtreeFlags & 15990) || transitions ? ((transitions = ReactSharedInternals.T), (ReactSharedInternals.T = null), (spawnedLane = ReactDOMSharedInternals.p), (ReactDOMSharedInternals.p = 2), - (suspendedCommitReason = executionContext), + (updatedLanes = executionContext), (executionContext |= 4), - commitBeforeMutationEffects(root, updatedLanes), - commitMutationEffects(root, updatedLanes, didIncludeRenderPhaseUpdate), + commitBeforeMutationEffects(root, finishedWork), + commitMutationEffects(root, finishedWork, didIncludeRenderPhaseUpdate), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), - (root.current = updatedLanes), - commitLayoutEffects(updatedLanes, root, didIncludeRenderPhaseUpdate), + (root.current = finishedWork), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), - (executionContext = suspendedCommitReason), + (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), (ReactSharedInternals.T = transitions)) - : (root.current = updatedLanes); + : (root.current = finishedWork); commitEndTime = now(); - logCommitPhase(commitStartTime, commitEndTime); - (transitions = rootDoesHavePassiveEffects) + logCommitPhase( + 0 === suspendedCommitReason ? completedRenderEndTime : commitStartTime, + commitEndTime + ); + (suspendedCommitReason = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) @@ -12024,18 +12139,18 @@ function commitRootImpl( completedRenderStartTime = root.pendingLanes; 0 === completedRenderStartTime && (legacyErrorBoundariesThatAlreadyFailed = null); - onCommitRoot(updatedLanes.stateNode, renderPriorityLevel); + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); isDevToolsPresent && root.memoizedUpdaters.clear(); ensureRootIsScheduled(root); if (null !== recoverableErrors) for ( - renderPriorityLevel = root.onRecoverableError, updatedLanes = 0; - updatedLanes < recoverableErrors.length; - updatedLanes++ + renderPriorityLevel = root.onRecoverableError, completedRenderEndTime = 0; + completedRenderEndTime < recoverableErrors.length; + completedRenderEndTime++ ) - (completedRenderStartTime = recoverableErrors[updatedLanes]), - renderPriorityLevel(completedRenderStartTime.value, { - componentStack: completedRenderStartTime.stack + (finishedWork = recoverableErrors[completedRenderEndTime]), + renderPriorityLevel(finishedWork.value, { + componentStack: finishedWork.stack }); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; @@ -12046,7 +12161,7 @@ function commitRootImpl( ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); + suspendedCommitReason || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -12058,7 +12173,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects(wasDelayedCommit) { if (null !== rootWithPendingPassiveEffects) { - var root$183 = rootWithPendingPassiveEffects, + var root$190 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -12078,18 +12193,22 @@ function flushPassiveEffects(wasDelayedCommit) { pendingPassiveEffectsLanes = 0; if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(331)); - reusableComponentDevToolDetails.track = + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane(lanes); var passiveEffectStartTime = 0; passiveEffectStartTime = now$1(); var startTime = commitEndTime, endTime = passiveEffectStartTime; + wasDelayedCommit = !!wasDelayedCommit; supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Waiting for Paint", reusableComponentOptions)); - startTime = executionContext; + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure( + wasDelayedCommit ? "Waiting for Paint" : "", + reusableLaneOptions + )); + wasDelayedCommit = executionContext; executionContext |= 4; var finishedWork = renderPriority.current; resetComponentEffectTimers(); @@ -12104,18 +12223,14 @@ function flushPassiveEffects(wasDelayedCommit) { transitions, finishedWork ); - executionContext = startTime; + executionContext = wasDelayedCommit; var passiveEffectsEndTime = now$1(); - wasDelayedCommit && - ((wasDelayedCommit = passiveEffectStartTime), - supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = wasDelayedCommit), - (reusableComponentOptions.end = passiveEffectsEndTime), - performance.measure( - "Remaining Effects", - reusableComponentOptions - ))); + finishedWork$jscomp$0 = passiveEffectStartTime; + supportsUserTiming && + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = finishedWork$jscomp$0), + (reusableLaneOptions.end = passiveEffectsEndTime), + performance.measure("Remaining Effects", reusableLaneOptions)); finalizeRender(lanes, passiveEffectsEndTime); flushSyncWorkAcrossRoots_impl(0, !1); if ( @@ -12134,7 +12249,7 @@ function flushPassiveEffects(wasDelayedCommit) { } finally { (ReactDOMSharedInternals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$183, remainingLanes); + releaseRootPooledCache(root$190, remainingLanes); } } return !1; @@ -12284,14 +12399,14 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$185 = firstScheduledRoot; null !== root$185; ) { + for (var root$192 = firstScheduledRoot; null !== root$192; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { - var pendingLanes = root$185.pendingLanes; + var pendingLanes = root$192.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { - var suspendedLanes = root$185.suspendedLanes, - pingedLanes = root$185.pingedLanes; + var suspendedLanes = root$192.suspendedLanes, + pingedLanes = root$192.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= @@ -12305,24 +12420,25 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$185, JSCompiler_inline_result)); + performSyncWorkOnRoot(root$192, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( - root$185, - root$185 === workInProgressRoot ? JSCompiler_inline_result : 0 + root$192, + root$192 === workInProgressRoot ? JSCompiler_inline_result : 0 )), 0 === (JSCompiler_inline_result & 3) || - checkIfRootIsPrerendering(root$185, JSCompiler_inline_result) || + checkIfRootIsPrerendering(root$192, JSCompiler_inline_result) || ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$185, JSCompiler_inline_result)); - root$185 = root$185.next; + performSyncWorkOnRoot(root$192, JSCompiler_inline_result)); + root$192 = root$192.next; } } while (didPerformSomeWork); isFlushingWork = !1; } } function processRootScheduleInMicrotask() { + schedulerEvent = window.event; mightHavePendingSyncWork = didScheduleMicrotask = !1; var syncTransitionLanes = 0; 0 !== currentEventTransitionLane && @@ -12357,12 +12473,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4, - expirationTime = expirationTimes[index$4]; + var index$5 = 31 - clz32(lanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$4] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -12385,7 +12501,10 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) + if ( + 0 !== (suspendedLanes & 3) && + !checkIfRootIsPrerendering(root, suspendedLanes) + ) return ( null !== pingedLanes && null !== pingedLanes && @@ -12419,6 +12538,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; + schedulerEvent = window.event; var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) return null; @@ -12547,20 +12667,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1496 = 0; - i$jscomp$inline_1496 < simpleEventPluginEvents.length; - i$jscomp$inline_1496++ + var i$jscomp$inline_1514 = 0; + i$jscomp$inline_1514 < simpleEventPluginEvents.length; + i$jscomp$inline_1514++ ) { - var eventName$jscomp$inline_1497 = - simpleEventPluginEvents[i$jscomp$inline_1496], - domEventName$jscomp$inline_1498 = - eventName$jscomp$inline_1497.toLowerCase(), - capitalizedEvent$jscomp$inline_1499 = - eventName$jscomp$inline_1497[0].toUpperCase() + - eventName$jscomp$inline_1497.slice(1); + var eventName$jscomp$inline_1515 = + simpleEventPluginEvents[i$jscomp$inline_1514], + domEventName$jscomp$inline_1516 = + eventName$jscomp$inline_1515.toLowerCase(), + capitalizedEvent$jscomp$inline_1517 = + eventName$jscomp$inline_1515[0].toUpperCase() + + eventName$jscomp$inline_1515.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1498, - "on" + capitalizedEvent$jscomp$inline_1499 + domEventName$jscomp$inline_1516, + "on" + capitalizedEvent$jscomp$inline_1517 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -13743,34 +13863,34 @@ function setInitialProperties(domElement, tag, props) { defaultChecked = null; for (hasSrc in props) if (props.hasOwnProperty(hasSrc)) { - var propValue$199 = props[hasSrc]; - if (null != propValue$199) + var propValue$206 = props[hasSrc]; + if (null != propValue$206) switch (hasSrc) { case "name": - hasSrcSet = propValue$199; + hasSrcSet = propValue$206; break; case "type": - propValue = propValue$199; + propValue = propValue$206; break; case "checked": - checked = propValue$199; + checked = propValue$206; break; case "defaultChecked": - defaultChecked = propValue$199; + defaultChecked = propValue$206; break; case "value": - propKey = propValue$199; + propKey = propValue$206; break; case "defaultValue": - defaultValue = propValue$199; + defaultValue = propValue$206; break; case "children": case "dangerouslySetInnerHTML": - if (null != propValue$199) + if (null != propValue$206) throw Error(formatProdErrorMessage(137, tag)); break; default: - setProp(domElement, tag, hasSrc, propValue$199, props, null); + setProp(domElement, tag, hasSrc, propValue$206, props, null); } } initInput( @@ -13907,14 +14027,14 @@ function setInitialProperties(domElement, tag, props) { return; default: if (isCustomElement(tag)) { - for (propValue$199 in props) - props.hasOwnProperty(propValue$199) && - ((hasSrc = props[propValue$199]), + for (propValue$206 in props) + props.hasOwnProperty(propValue$206) && + ((hasSrc = props[propValue$206]), void 0 !== hasSrc && setPropOnCustomElement( domElement, tag, - propValue$199, + propValue$206, hasSrc, props, void 0 @@ -13962,14 +14082,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$216 in nextProps) { - var propKey = nextProps[propKey$216]; - lastProp = lastProps[propKey$216]; + for (var propKey$223 in nextProps) { + var propKey = nextProps[propKey$223]; + lastProp = lastProps[propKey$223]; if ( - nextProps.hasOwnProperty(propKey$216) && + nextProps.hasOwnProperty(propKey$223) && (null != propKey || null != lastProp) ) - switch (propKey$216) { + switch (propKey$223) { case "type": type = propKey; break; @@ -13998,7 +14118,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$216, + propKey$223, propKey, nextProps, lastProp @@ -14017,7 +14137,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$216 = null; + propKey = value = defaultValue = propKey$223 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -14048,7 +14168,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$216 = type; + propKey$223 = type; break; case "defaultValue": defaultValue = type; @@ -14069,15 +14189,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$216 - ? updateOptions(domElement, !!lastProps, propKey$216, !1) + null != propKey$223 + ? updateOptions(domElement, !!lastProps, propKey$223, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$216 = null; + propKey = propKey$223 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -14101,7 +14221,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$216 = name; + propKey$223 = name; break; case "defaultValue": propKey = name; @@ -14115,17 +14235,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$216, propKey); + updateTextarea(domElement, propKey$223, propKey); return; case "option": - for (var propKey$232 in lastProps) + for (var propKey$239 in lastProps) if ( - ((propKey$216 = lastProps[propKey$232]), - lastProps.hasOwnProperty(propKey$232) && - null != propKey$216 && - !nextProps.hasOwnProperty(propKey$232)) + ((propKey$223 = lastProps[propKey$239]), + lastProps.hasOwnProperty(propKey$239) && + null != propKey$223 && + !nextProps.hasOwnProperty(propKey$239)) ) - switch (propKey$232) { + switch (propKey$239) { case "selected": domElement.selected = !1; break; @@ -14133,33 +14253,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$232, + propKey$239, null, nextProps, - propKey$216 + propKey$223 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$216 = nextProps[lastDefaultValue]), + ((propKey$223 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$216 !== propKey && - (null != propKey$216 || null != propKey)) + propKey$223 !== propKey && + (null != propKey$223 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$216 && - "function" !== typeof propKey$216 && - "symbol" !== typeof propKey$216; + propKey$223 && + "function" !== typeof propKey$223 && + "symbol" !== typeof propKey$223; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$216, + propKey$223, nextProps, propKey ); @@ -14180,24 +14300,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$237 in lastProps) - (propKey$216 = lastProps[propKey$237]), - lastProps.hasOwnProperty(propKey$237) && - null != propKey$216 && - !nextProps.hasOwnProperty(propKey$237) && - setProp(domElement, tag, propKey$237, null, nextProps, propKey$216); + for (var propKey$244 in lastProps) + (propKey$223 = lastProps[propKey$244]), + lastProps.hasOwnProperty(propKey$244) && + null != propKey$223 && + !nextProps.hasOwnProperty(propKey$244) && + setProp(domElement, tag, propKey$244, null, nextProps, propKey$223); for (checked in nextProps) if ( - ((propKey$216 = nextProps[checked]), + ((propKey$223 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$216 !== propKey && - (null != propKey$216 || null != propKey)) + propKey$223 !== propKey && + (null != propKey$223 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$216) + if (null != propKey$223) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -14205,7 +14325,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$216, + propKey$223, nextProps, propKey ); @@ -14213,49 +14333,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$242 in lastProps) - (propKey$216 = lastProps[propKey$242]), - lastProps.hasOwnProperty(propKey$242) && - void 0 !== propKey$216 && - !nextProps.hasOwnProperty(propKey$242) && + for (var propKey$249 in lastProps) + (propKey$223 = lastProps[propKey$249]), + lastProps.hasOwnProperty(propKey$249) && + void 0 !== propKey$223 && + !nextProps.hasOwnProperty(propKey$249) && setPropOnCustomElement( domElement, tag, - propKey$242, + propKey$249, void 0, nextProps, - propKey$216 + propKey$223 ); for (defaultChecked in nextProps) - (propKey$216 = nextProps[defaultChecked]), + (propKey$223 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$216 === propKey || - (void 0 === propKey$216 && void 0 === propKey) || + propKey$223 === propKey || + (void 0 === propKey$223 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$216, + propKey$223, nextProps, propKey ); return; } } - for (var propKey$247 in lastProps) - (propKey$216 = lastProps[propKey$247]), - lastProps.hasOwnProperty(propKey$247) && - null != propKey$216 && - !nextProps.hasOwnProperty(propKey$247) && - setProp(domElement, tag, propKey$247, null, nextProps, propKey$216); + for (var propKey$254 in lastProps) + (propKey$223 = lastProps[propKey$254]), + lastProps.hasOwnProperty(propKey$254) && + null != propKey$223 && + !nextProps.hasOwnProperty(propKey$254) && + setProp(domElement, tag, propKey$254, null, nextProps, propKey$223); for (lastProp in nextProps) - (propKey$216 = nextProps[lastProp]), + (propKey$223 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$216 === propKey || - (null == propKey$216 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$216, nextProps, propKey); + propKey$223 === propKey || + (null == propKey$223 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$223, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -14311,13 +14431,14 @@ function shouldAttemptEagerTransition() { currentPopstateTransitionEvent = null; return !1; } +var schedulerEvent = void 0; function resolveEventType() { var event = window.event; - return event ? event.type : null; + return event && event !== schedulerEvent ? event.type : null; } function resolveEventTimeStamp() { var event = window.event; - return event ? event.timeStamp : -1.1; + return event && event !== schedulerEvent ? event.timeStamp : -1.1; } var scheduleTimeout = "function" === typeof setTimeout ? setTimeout : void 0, cancelTimeout = "function" === typeof clearTimeout ? clearTimeout : void 0, @@ -14808,26 +14929,26 @@ function getResource(type, currentProps, pendingProps, currentResource) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$255 = getResourcesFromRoot( + var styles$262 = getResourcesFromRoot( JSCompiler_inline_result ).hoistableStyles, - resource$256 = styles$255.get(type); - resource$256 || + resource$263 = styles$262.get(type); + resource$263 || ((JSCompiler_inline_result = JSCompiler_inline_result.ownerDocument || JSCompiler_inline_result), - (resource$256 = { + (resource$263 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$255.set(type, resource$256), - (styles$255 = JSCompiler_inline_result.querySelector( + styles$262.set(type, resource$263), + (styles$262 = JSCompiler_inline_result.querySelector( getStylesheetSelectorFromKey(type) )) && - !styles$255._p && - ((resource$256.instance = styles$255), - (resource$256.state.loading = 5)), + !styles$262._p && + ((resource$263.instance = styles$262), + (resource$263.state.loading = 5)), preloadPropsMap.has(type) || ((pendingProps = { rel: "preload", @@ -14840,16 +14961,16 @@ function getResource(type, currentProps, pendingProps, currentResource) { referrerPolicy: pendingProps.referrerPolicy }), preloadPropsMap.set(type, pendingProps), - styles$255 || + styles$262 || preloadStylesheet( JSCompiler_inline_result, type, pendingProps, - resource$256.state + resource$263.state ))); if (currentProps && null === currentResource) throw Error(formatProdErrorMessage(528, "")); - return resource$256; + return resource$263; } if (currentProps && null !== currentResource) throw Error(formatProdErrorMessage(529, "")); @@ -14946,37 +15067,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$261 = hoistableRoot.querySelector( + var instance$268 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$261) + if (instance$268) return ( (resource.state.loading |= 4), - (resource.instance = instance$261), - markNodeAsHoistable(instance$261), - instance$261 + (resource.instance = instance$268), + markNodeAsHoistable(instance$268), + instance$268 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$261 = ( + instance$268 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$261); - var linkInstance = instance$261; + markNodeAsHoistable(instance$268); + var linkInstance = instance$268; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$261, "link", instance); + setInitialProperties(instance$268, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$261, props.precedence, hoistableRoot); - return (resource.instance = instance$261); + insertStylesheet(instance$268, props.precedence, hoistableRoot); + return (resource.instance = instance$268); case "script": - instance$261 = getScriptKey(props.src); + instance$268 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$261) + getScriptSelectorFromKey(instance$268) )) ) return ( @@ -14985,7 +15106,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$261))) + if ((styleProps = preloadPropsMap.get(instance$268))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -16026,16 +16147,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1743 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1761 = React.version; if ( - "19.0.0-experimental-380f5d67-20241113" !== - isomorphicReactPackageVersion$jscomp$inline_1743 + "19.0.0-experimental-b01722d5-20241114" !== + isomorphicReactPackageVersion$jscomp$inline_1761 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1743, - "19.0.0-experimental-380f5d67-20241113" + isomorphicReactPackageVersion$jscomp$inline_1761, + "19.0.0-experimental-b01722d5-20241114" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -16055,25 +16176,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2186 = { +var internals$jscomp$inline_2207 = { bundleType: 0, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113" + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2187 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2208 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2187.isDisabled && - hook$jscomp$inline_2187.supportsFiber + !hook$jscomp$inline_2208.isDisabled && + hook$jscomp$inline_2208.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2187.inject( - internals$jscomp$inline_2186 + (rendererID = hook$jscomp$inline_2208.inject( + internals$jscomp$inline_2207 )), - (injectedHook = hook$jscomp$inline_2187); + (injectedHook = hook$jscomp$inline_2208); } catch (err) {} } function noop() {} @@ -16326,7 +16447,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; "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 9570978b19606..765a3126fb102 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-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 98c54d40170f6..5223004f47d7c 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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 d795fc78ac91e..26bf4b9758e76 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-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 88d04e699c09c..cab31bf69da87 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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 65f548ac57387..466d1f4313429 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\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-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 00130d4f609ac..c909fa605c0c6 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-experimental-380f5d67-20241113" + "19.0.0-experimental-b01722d5-20241114" ) ); } @@ -6849,4 +6849,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 4afc5546a1f58..7268280b43681 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-380f5d67-20241113" !== + "19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 824ed12f440bb..451b137ee84a8 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\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-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 1dfe5f38366d4..d266f1a5d0e5c 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 8611d6e1fc494..7cc9b05a42547 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -9857,5 +9857,5 @@ } }; }; - exports.version = "19.0.0-experimental-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 b9d5291efd970..6c0dd533479bd 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 d712bbb579d2d..1a43ca33ff73f 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 @@ -1035,28 +1035,40 @@ var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -1141,7 +1153,9 @@ root, finishedLanes, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; @@ -1152,17 +1166,17 @@ root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index; - finishedLanes[index] = 0; + var index = 31 - clz32(remainingLanes), + lane = 1 << index; + entanglements[index] = 0; expirationTimes[index] = -1; var hiddenUpdatesForLane = hiddenUpdates[index]; if (null !== hiddenUpdatesForLane) @@ -1174,9 +1188,14 @@ var update = hiddenUpdatesForLane[index]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -3820,31 +3839,31 @@ } function logRenderPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Render", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Render", reusableLaneOptions)); } function logSuspenseThrottlePhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Throttled", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Throttled", reusableLaneOptions)); } function logSuspendedCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Suspended", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Suspended", reusableLaneOptions)); } function logCommitPhase(startTime, endTime) { supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), - performance.measure("Commit", reusableComponentOptions)); + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), + performance.measure("Commit", reusableLaneOptions)); } function finishQueueingConcurrentUpdates() { for ( @@ -4070,14 +4089,24 @@ JSCompiler_temp ? 0 > blockingUpdateTime && ((blockingUpdateTime = now()), - (blockingEventTime = resolveEventTimeStamp()), - (blockingEventType = resolveEventType())) + (lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (blockingEventIsRepeat = + lane === blockingEventTime && + JSCompiler_temp === blockingEventType), + (blockingEventTime = lane), + (blockingEventType = JSCompiler_temp)) : 0 !== (lane & 4194176) && 0 > transitionUpdateTime && ((transitionUpdateTime = now()), 0 > transitionStartTime && - ((transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType()))); + ((lane = resolveEventTimeStamp()), + (JSCompiler_temp = resolveEventType()), + (transitionEventIsRepeat = + lane === transitionEventTime && + JSCompiler_temp === transitionEventType), + (transitionEventTime = lane), + (transitionEventType = JSCompiler_temp))); } function pushNestedEffectDurations() { var prevEffectDuration = profilerEffectDuration; @@ -8949,33 +8978,33 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_componentStack_2329; - var JSCompiler_object_inline_stack_2328 = workInProgress.pendingProps; + var JSCompiler_object_inline_componentStack_2343; + var JSCompiler_object_inline_stack_2342 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_message_2326 = !1; + var JSCompiler_object_inline_message_2340 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_componentStack_2329 = didSuspend) || - (JSCompiler_object_inline_componentStack_2329 = + (JSCompiler_object_inline_componentStack_2343 = didSuspend) || + (JSCompiler_object_inline_componentStack_2343 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_componentStack_2329 && - ((JSCompiler_object_inline_message_2326 = !0), + JSCompiler_object_inline_componentStack_2343 && + ((JSCompiler_object_inline_message_2340 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_componentStack_2329 = + JSCompiler_object_inline_componentStack_2343 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_message_2326 + JSCompiler_object_inline_message_2340 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_digest_2327 = nextHydratableInstance; + var JSCompiler_object_inline_digest_2341 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2327)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2341)) { c: { - var instance = JSCompiler_object_inline_digest_2327; + var instance = JSCompiler_object_inline_digest_2341; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -9016,19 +9045,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_digest_2327 + JSCompiler_object_inline_digest_2341 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_digest_2327 = workInProgress.memoizedState; + JSCompiler_object_inline_digest_2341 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_digest_2327 && - ((JSCompiler_object_inline_digest_2327 = - JSCompiler_object_inline_digest_2327.dehydrated), - null !== JSCompiler_object_inline_digest_2327) + null !== JSCompiler_object_inline_digest_2341 && + ((JSCompiler_object_inline_digest_2341 = + JSCompiler_object_inline_digest_2341.dehydrated), + null !== JSCompiler_object_inline_digest_2341) ) return ( - JSCompiler_object_inline_digest_2327.data === + JSCompiler_object_inline_digest_2341.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -9036,68 +9065,68 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_digest_2327 = - JSCompiler_object_inline_stack_2328.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2328.fallback; - if (JSCompiler_object_inline_message_2326) + JSCompiler_object_inline_digest_2341 = + JSCompiler_object_inline_stack_2342.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2342.fallback; + if (JSCompiler_object_inline_message_2340) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2328 = + (JSCompiler_object_inline_stack_2342 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2327, + JSCompiler_object_inline_digest_2341, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2326 = workInProgress.child), - (JSCompiler_object_inline_message_2326.memoizedState = + (JSCompiler_object_inline_message_2340 = workInProgress.child), + (JSCompiler_object_inline_message_2340.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2326.childLanes = + (JSCompiler_object_inline_message_2340.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2329, + JSCompiler_object_inline_componentStack_2343, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2328 + JSCompiler_object_inline_stack_2342 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2328.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2342.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2328 = + (JSCompiler_object_inline_stack_2342 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2327, + JSCompiler_object_inline_digest_2341, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2326 = workInProgress.child), - (JSCompiler_object_inline_message_2326.memoizedState = + (JSCompiler_object_inline_message_2340 = workInProgress.child), + (JSCompiler_object_inline_message_2340.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2326.childLanes = + (JSCompiler_object_inline_message_2340.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2329, + JSCompiler_object_inline_componentStack_2343, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2328 + JSCompiler_object_inline_stack_2342 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_digest_2327 + JSCompiler_object_inline_digest_2341 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_digest_2327 = prevState.dehydrated), - null !== JSCompiler_object_inline_digest_2327) + ((JSCompiler_object_inline_digest_2341 = prevState.dehydrated), + null !== JSCompiler_object_inline_digest_2341) ) { if (didSuspend) workInProgress.flags & 256 @@ -9114,95 +9143,95 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2326 = - JSCompiler_object_inline_stack_2328.fallback), - (JSCompiler_object_inline_digest_2327 = workInProgress.mode), - (JSCompiler_object_inline_stack_2328 = + (JSCompiler_object_inline_message_2340 = + JSCompiler_object_inline_stack_2342.fallback), + (JSCompiler_object_inline_digest_2341 = workInProgress.mode), + (JSCompiler_object_inline_stack_2342 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2328.children + children: JSCompiler_object_inline_stack_2342.children }, - JSCompiler_object_inline_digest_2327 + JSCompiler_object_inline_digest_2341 )), - (JSCompiler_object_inline_message_2326 = + (JSCompiler_object_inline_message_2340 = createFiberFromFragment( - JSCompiler_object_inline_message_2326, - JSCompiler_object_inline_digest_2327, + JSCompiler_object_inline_message_2340, + JSCompiler_object_inline_digest_2341, renderLanes, null )), - (JSCompiler_object_inline_message_2326.flags |= 2), - (JSCompiler_object_inline_stack_2328.return = workInProgress), - (JSCompiler_object_inline_message_2326.return = workInProgress), - (JSCompiler_object_inline_stack_2328.sibling = - JSCompiler_object_inline_message_2326), - (workInProgress.child = JSCompiler_object_inline_stack_2328), + (JSCompiler_object_inline_message_2340.flags |= 2), + (JSCompiler_object_inline_stack_2342.return = workInProgress), + (JSCompiler_object_inline_message_2340.return = workInProgress), + (JSCompiler_object_inline_stack_2342.sibling = + JSCompiler_object_inline_message_2340), + (workInProgress.child = JSCompiler_object_inline_stack_2342), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2328 = workInProgress.child), - (JSCompiler_object_inline_stack_2328.memoizedState = + (JSCompiler_object_inline_stack_2342 = workInProgress.child), + (JSCompiler_object_inline_stack_2342.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2328.childLanes = + (JSCompiler_object_inline_stack_2342.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2329, + JSCompiler_object_inline_componentStack_2343, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress = JSCompiler_object_inline_message_2326)); + (workInProgress = JSCompiler_object_inline_message_2340)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_digest_2327.data === + JSCompiler_object_inline_digest_2341.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_componentStack_2329 = - JSCompiler_object_inline_digest_2327.nextSibling && - JSCompiler_object_inline_digest_2327.nextSibling.dataset; - if (JSCompiler_object_inline_componentStack_2329) { - JSCompiler_temp = JSCompiler_object_inline_componentStack_2329.dgst; - var message = JSCompiler_object_inline_componentStack_2329.msg; - instance = JSCompiler_object_inline_componentStack_2329.stck; + JSCompiler_object_inline_componentStack_2343 = + JSCompiler_object_inline_digest_2341.nextSibling && + JSCompiler_object_inline_digest_2341.nextSibling.dataset; + if (JSCompiler_object_inline_componentStack_2343) { + JSCompiler_temp = JSCompiler_object_inline_componentStack_2343.dgst; + var message = JSCompiler_object_inline_componentStack_2343.msg; + instance = JSCompiler_object_inline_componentStack_2343.stck; var componentStack = - JSCompiler_object_inline_componentStack_2329.cstck; + JSCompiler_object_inline_componentStack_2343.cstck; } - JSCompiler_object_inline_message_2326 = message; - JSCompiler_object_inline_digest_2327 = JSCompiler_temp; - JSCompiler_object_inline_stack_2328 = instance; - JSCompiler_temp = JSCompiler_object_inline_componentStack_2329 = + JSCompiler_object_inline_message_2340 = message; + JSCompiler_object_inline_digest_2341 = JSCompiler_temp; + JSCompiler_object_inline_stack_2342 = instance; + JSCompiler_temp = JSCompiler_object_inline_componentStack_2343 = componentStack; - "POSTPONE" !== JSCompiler_object_inline_digest_2327 && - ((JSCompiler_object_inline_componentStack_2329 = - JSCompiler_object_inline_message_2326 - ? Error(JSCompiler_object_inline_message_2326) + "POSTPONE" !== JSCompiler_object_inline_digest_2341 && + ((JSCompiler_object_inline_componentStack_2343 = + JSCompiler_object_inline_message_2340 + ? Error(JSCompiler_object_inline_message_2340) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), - (JSCompiler_object_inline_componentStack_2329.stack = - JSCompiler_object_inline_stack_2328 || ""), - (JSCompiler_object_inline_componentStack_2329.digest = - JSCompiler_object_inline_digest_2327), - (JSCompiler_object_inline_stack_2328 = + (JSCompiler_object_inline_componentStack_2343.stack = + JSCompiler_object_inline_stack_2342 || ""), + (JSCompiler_object_inline_componentStack_2343.digest = + JSCompiler_object_inline_digest_2341), + (JSCompiler_object_inline_stack_2342 = void 0 === JSCompiler_temp ? null : JSCompiler_temp), - (JSCompiler_object_inline_message_2326 = { - value: JSCompiler_object_inline_componentStack_2329, + (JSCompiler_object_inline_message_2340 = { + value: JSCompiler_object_inline_componentStack_2343, source: null, - stack: JSCompiler_object_inline_stack_2328 + stack: JSCompiler_object_inline_stack_2342 }), - "string" === typeof JSCompiler_object_inline_stack_2328 && + "string" === typeof JSCompiler_object_inline_stack_2342 && CapturedStacks.set( - JSCompiler_object_inline_componentStack_2329, - JSCompiler_object_inline_message_2326 + JSCompiler_object_inline_componentStack_2343, + JSCompiler_object_inline_message_2340 ), - queueHydrationError(JSCompiler_object_inline_message_2326)); + queueHydrationError(JSCompiler_object_inline_message_2340)); workInProgress = retrySuspenseComponentWithoutHydrating( current, workInProgress, @@ -9216,25 +9245,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_componentStack_2329 = + (JSCompiler_object_inline_componentStack_2343 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_componentStack_2329) + didReceiveUpdate || JSCompiler_object_inline_componentStack_2343) ) { - JSCompiler_object_inline_componentStack_2329 = workInProgressRoot; - if (null !== JSCompiler_object_inline_componentStack_2329) { - JSCompiler_object_inline_stack_2328 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2328 & 42)) - JSCompiler_object_inline_stack_2328 = 1; + JSCompiler_object_inline_componentStack_2343 = workInProgressRoot; + if (null !== JSCompiler_object_inline_componentStack_2343) { + JSCompiler_object_inline_stack_2342 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2342 & 42)) + JSCompiler_object_inline_stack_2342 = 1; else - switch (JSCompiler_object_inline_stack_2328) { + switch (JSCompiler_object_inline_stack_2342) { case 2: - JSCompiler_object_inline_stack_2328 = 1; + JSCompiler_object_inline_stack_2342 = 1; break; case 8: - JSCompiler_object_inline_stack_2328 = 4; + JSCompiler_object_inline_stack_2342 = 4; break; case 32: - JSCompiler_object_inline_stack_2328 = 16; + JSCompiler_object_inline_stack_2342 = 16; break; case 128: case 256: @@ -9255,40 +9284,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2328 = 64; + JSCompiler_object_inline_stack_2342 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2328 = 134217728; + JSCompiler_object_inline_stack_2342 = 134217728; break; default: - JSCompiler_object_inline_stack_2328 = 0; + JSCompiler_object_inline_stack_2342 = 0; } - JSCompiler_object_inline_stack_2328 = + JSCompiler_object_inline_stack_2342 = 0 !== - (JSCompiler_object_inline_stack_2328 & - (JSCompiler_object_inline_componentStack_2329.suspendedLanes | + (JSCompiler_object_inline_stack_2342 & + (JSCompiler_object_inline_componentStack_2343.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2328; + : JSCompiler_object_inline_stack_2342; if ( - 0 !== JSCompiler_object_inline_stack_2328 && - JSCompiler_object_inline_stack_2328 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2342 && + JSCompiler_object_inline_stack_2342 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2328), + ((prevState.retryLane = JSCompiler_object_inline_stack_2342), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2328 + JSCompiler_object_inline_stack_2342 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_componentStack_2329, + JSCompiler_object_inline_componentStack_2343, current, - JSCompiler_object_inline_stack_2328 + JSCompiler_object_inline_stack_2342 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_digest_2327.data === + JSCompiler_object_inline_digest_2341.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9296,7 +9325,7 @@ renderLanes ); } else - JSCompiler_object_inline_digest_2327.data === + JSCompiler_object_inline_digest_2341.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9304,12 +9333,12 @@ null, current )), - (JSCompiler_object_inline_digest_2327._reactRetry = + (JSCompiler_object_inline_digest_2341._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_digest_2327.nextSibling + JSCompiler_object_inline_digest_2341.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9327,54 +9356,54 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2328.children + JSCompiler_object_inline_stack_2342.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_message_2326) + if (JSCompiler_object_inline_message_2340) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2326 = - JSCompiler_object_inline_stack_2328.fallback), - (JSCompiler_object_inline_digest_2327 = workInProgress.mode), + (JSCompiler_object_inline_message_2340 = + JSCompiler_object_inline_stack_2342.fallback), + (JSCompiler_object_inline_digest_2341 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2328 = createWorkInProgress( + (JSCompiler_object_inline_stack_2342 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2328.children + children: JSCompiler_object_inline_stack_2342.children } )), - (JSCompiler_object_inline_stack_2328.subtreeFlags = + (JSCompiler_object_inline_stack_2342.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_message_2326 = createWorkInProgress( + ? (JSCompiler_object_inline_message_2340 = createWorkInProgress( instance, - JSCompiler_object_inline_message_2326 + JSCompiler_object_inline_message_2340 )) - : ((JSCompiler_object_inline_message_2326 = createFiberFromFragment( - JSCompiler_object_inline_message_2326, - JSCompiler_object_inline_digest_2327, + : ((JSCompiler_object_inline_message_2340 = createFiberFromFragment( + JSCompiler_object_inline_message_2340, + JSCompiler_object_inline_digest_2341, renderLanes, null )), - (JSCompiler_object_inline_message_2326.flags |= 2)), - (JSCompiler_object_inline_message_2326.return = workInProgress), - (JSCompiler_object_inline_stack_2328.return = workInProgress), - (JSCompiler_object_inline_stack_2328.sibling = - JSCompiler_object_inline_message_2326), - (workInProgress.child = JSCompiler_object_inline_stack_2328), - (JSCompiler_object_inline_stack_2328 = - JSCompiler_object_inline_message_2326), - (JSCompiler_object_inline_message_2326 = workInProgress.child), - (JSCompiler_object_inline_digest_2327 = current.child.memoizedState), - null === JSCompiler_object_inline_digest_2327 - ? (JSCompiler_object_inline_digest_2327 = + (JSCompiler_object_inline_message_2340.flags |= 2)), + (JSCompiler_object_inline_message_2340.return = workInProgress), + (JSCompiler_object_inline_stack_2342.return = workInProgress), + (JSCompiler_object_inline_stack_2342.sibling = + JSCompiler_object_inline_message_2340), + (workInProgress.child = JSCompiler_object_inline_stack_2342), + (JSCompiler_object_inline_stack_2342 = + JSCompiler_object_inline_message_2340), + (JSCompiler_object_inline_message_2340 = workInProgress.child), + (JSCompiler_object_inline_digest_2341 = current.child.memoizedState), + null === JSCompiler_object_inline_digest_2341 + ? (JSCompiler_object_inline_digest_2341 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_digest_2327.cachePool), + JSCompiler_object_inline_digest_2341.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9382,38 +9411,38 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_digest_2327 = { + (JSCompiler_object_inline_digest_2341 = { baseLanes: - JSCompiler_object_inline_digest_2327.baseLanes | renderLanes, + JSCompiler_object_inline_digest_2341.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_message_2326.memoizedState = - JSCompiler_object_inline_digest_2327), - (JSCompiler_object_inline_message_2326.childLanes = + (JSCompiler_object_inline_message_2340.memoizedState = + JSCompiler_object_inline_digest_2341), + (JSCompiler_object_inline_message_2340.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2329, + JSCompiler_object_inline_componentStack_2343, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2328 + JSCompiler_object_inline_stack_2342 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2328.children + children: JSCompiler_object_inline_stack_2342.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_componentStack_2329 = + ((JSCompiler_object_inline_componentStack_2343 = workInProgress.deletions), - null === JSCompiler_object_inline_componentStack_2329 + null === JSCompiler_object_inline_componentStack_2343 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_componentStack_2329.push(current)); + : JSCompiler_object_inline_componentStack_2343.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -13827,20 +13856,34 @@ (resource.state.loading & Inserted) !== NotLoaded ) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if ( + ((workInProgress.flags |= 16777216), !preloadResource(resource)) + ) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -14819,7 +14862,8 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if ( @@ -14861,25 +14905,37 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root, lanes, forceSync) { if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (exitStatus === RootInProgress) break; - else if (exitStatus === RootDidNotComplete) - markRootSuspended(root, lanes, 0); + if (exitStatus === RootInProgress) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root, lanes, 0, !1); + break; + } else if (exitStatus === RootDidNotComplete) + finalizeRender(lanes, now$1()), + markRootSuspended( + root, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root.current.alternate; if ( @@ -14944,22 +15000,24 @@ } if (exitStatus === RootFatalErrored) { prepareFreshStack(root, 0); - markRootSuspended(root, lanes, 0); + markRootSuspended(root, lanes, 0, !0); break; } a: { - renderWasConcurrent = root; - errorRetryLanes = now$1(); + shouldTimeSlice = root; + renderWasConcurrent = now$1(); switch (exitStatus) { case RootInProgress: case RootFatalErrored: throw Error("Root did not complete. This is a bug in React."); case RootSuspendedWithDelay: if ((lanes & 4194176) === lanes) { + finalizeRender(lanes, now$1()); markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -14973,11 +15031,11 @@ default: throw Error("Unknown root exit status."); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if (null !== ReactSharedInternals.actQueue) commitRoot( - renderWasConcurrent, + shouldTimeSlice, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, @@ -14986,7 +15044,7 @@ workInProgressSuspendedRetryLanes, IMMEDIATE_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ); else { if ( @@ -14998,15 +15056,16 @@ 10 < exitStatus) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -15018,14 +15077,14 @@ workInProgressRootDidSkipSuspendedSiblings, THROTTLED_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ), exitStatus ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -15037,7 +15096,7 @@ workInProgressRootDidSkipSuspendedSiblings, IMMEDIATE_COMMIT, renderStartTime, - errorRetryLanes + renderWasConcurrent ); } } @@ -15069,11 +15128,8 @@ completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -15095,7 +15151,12 @@ completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended( + root, + lanes, + spawnedLane, + !didSkipSuspendedSiblings + ); return; } commitRoot( @@ -15145,19 +15206,22 @@ } return !0; } - function markRootSuspended(root, suspendedLanes, spawnedLane) { + function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree + ) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { var index = 31 - clz32(lanes), lane = 1 << index; - expirationTimes[index] = -1; + didAttemptEntireTree[index] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -15187,80 +15251,91 @@ } function finalizeRender(lanes, finalizationTime) { if (0 !== (lanes & 3) || 0 !== (lanes & 60)) - 0 <= blockingUpdateTime && - blockingUpdateTime < finalizationTime && - (blockingUpdateTime = finalizationTime), - 0 <= blockingEventTime && - blockingEventTime < finalizationTime && - (blockingEventTime = finalizationTime); - 0 !== (lanes & 4194176) && - (0 <= transitionStartTime && - transitionStartTime < finalizationTime && - (transitionStartTime = finalizationTime), - 0 <= transitionUpdateTime && - transitionUpdateTime < finalizationTime && - (transitionUpdateTime = finalizationTime), - 0 <= transitionEventTime && - transitionEventTime < finalizationTime && - (transitionEventTime = finalizationTime)); + blockingClampTime = finalizationTime; + 0 !== (lanes & 4194176) && (transitionClampTime = finalizationTime); } function prepareFreshStack(root, lanes) { renderStartTime = now(); finalizeRender(workInProgressRootRenderLanes, renderStartTime); if (0 !== (lanes & 3) || 0 !== (lanes & 60)) { - var updateTime = blockingUpdateTime, - eventTime = blockingEventTime, + var updateTime = + 0 <= blockingUpdateTime && blockingUpdateTime < blockingClampTime + ? blockingClampTime + : blockingUpdateTime, + eventTime = + 0 <= blockingEventTime && blockingEventTime < blockingClampTime + ? blockingClampTime + : blockingEventTime, eventType = blockingEventType, + eventIsRepeat = blockingEventIsRepeat, renderStartTime$jscomp$0 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Blocking"), + ((reusableLaneDevToolDetails.track = "Blocking"), 0 < eventTime && null !== eventType && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = eventIsRepeat + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : renderStartTime$jscomp$0), - performance.measure(eventType, reusableComponentOptions)), + performance.measure( + eventIsRepeat ? "" : "Event: " + eventType, + reusableLaneOptions + )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = renderStartTime$jscomp$0), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = renderStartTime$jscomp$0), + performance.measure("Blocked", reusableLaneOptions))); blockingUpdateTime = -1.1; } if (0 !== (lanes & 4194176)) { - updateTime = transitionStartTime; - eventTime = transitionUpdateTime; - eventType = transitionEventTime; - renderStartTime$jscomp$0 = transitionEventType; + updateTime = + 0 <= transitionStartTime && transitionStartTime < transitionClampTime + ? transitionClampTime + : transitionStartTime; + eventTime = + 0 <= transitionUpdateTime && + transitionUpdateTime < transitionClampTime + ? transitionClampTime + : transitionUpdateTime; + eventType = + 0 <= transitionEventTime && transitionEventTime < transitionClampTime + ? transitionClampTime + : transitionEventTime; + eventIsRepeat = transitionEventType; + renderStartTime$jscomp$0 = transitionEventIsRepeat; var renderStartTime$jscomp$1 = renderStartTime; supportsUserTiming && - ((reusableComponentDevToolDetails.track = "Transition"), + ((reusableLaneDevToolDetails.track = "Transition"), 0 < eventType && - null !== renderStartTime$jscomp$0 && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = eventType), - (reusableComponentOptions.end = + null !== eventIsRepeat && + ((reusableLaneDevToolDetails.color = renderStartTime$jscomp$0 + ? "secondary-light" + : "warning"), + (reusableLaneOptions.start = eventType), + (reusableLaneOptions.end = 0 < updateTime ? updateTime : 0 < eventTime ? eventTime : renderStartTime$jscomp$1), performance.measure( - renderStartTime$jscomp$0, - reusableComponentOptions + renderStartTime$jscomp$0 ? "" : "Event: " + eventIsRepeat, + reusableLaneOptions )), 0 < updateTime && - ((reusableComponentDevToolDetails.color = "primary-dark"), - (reusableComponentOptions.start = updateTime), - (reusableComponentOptions.end = + ((reusableLaneDevToolDetails.color = "primary-dark"), + (reusableLaneOptions.start = updateTime), + (reusableLaneOptions.end = 0 < eventTime ? eventTime : renderStartTime$jscomp$1), - performance.measure("Action", reusableComponentOptions)), + performance.measure("Action", reusableLaneOptions)), 0 < eventTime && - ((reusableComponentDevToolDetails.color = "primary-light"), - (reusableComponentOptions.start = eventTime), - (reusableComponentOptions.end = renderStartTime$jscomp$1), - performance.measure("Blocked", reusableComponentOptions))); + ((reusableLaneDevToolDetails.color = "primary-light"), + (reusableLaneOptions.start = eventTime), + (reusableLaneOptions.end = renderStartTime$jscomp$1), + performance.measure("Blocked", reusableLaneOptions))); transitionUpdateTime = transitionStartTime = -1.1; } root.finishedWork = null; @@ -15277,7 +15352,7 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = RootInProgress; workInProgressSuspendedRetryLanes = @@ -15294,9 +15369,9 @@ if (0 !== eventTime) for (root = root.entanglements, eventTime &= lanes; 0 < eventTime; ) (eventType = 31 - clz32(eventTime)), - (renderStartTime$jscomp$0 = 1 << eventType), + (eventIsRepeat = 1 << eventType), (lanes |= root[eventType]), - (eventTime &= ~renderStartTime$jscomp$0); + (eventTime &= ~eventIsRepeat); entangledRenderLanes = lanes; finishQueueingConcurrentUpdates(); ReactStrictModeWarnings.discardPendingWarnings(); @@ -15310,12 +15385,7 @@ current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? SuspendedOnData - : SuspendedOnImmediate)) + (workInProgressSuspendedReason = SuspendedOnImmediate)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = SuspendedOnInstance)) @@ -15338,21 +15408,6 @@ : erroredWork.mode & ProfileMode && stopProfilerTimerIfRunningAndRecordDuration(erroredWork); } - function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; - } function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -15365,13 +15420,19 @@ } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = RootSuspendedWithDelay; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } function queueConcurrentError(error) { @@ -15379,7 +15440,7 @@ ? (workInProgressRootConcurrentErrors = [error]) : workInProgressRootConcurrentErrors.push(error); } - function renderRootSync(root, lanes) { + function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(), @@ -15421,6 +15482,13 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + memoizedUpdaters = RootInProgress; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -15469,7 +15537,11 @@ workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS; prepareFreshStack(root, lanes); - } else checkIfRootIsPrerendering(root, lanes); + } else + workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + ); a: do try { if ( @@ -15673,7 +15745,12 @@ stopProfilerTimerIfRunningAndRecordDuration(unitOfWork); return current; } - function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason + ) { resetContextDependencies(); resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -15707,9 +15784,25 @@ workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || suspendedReason === SuspendedOnError) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + suspendedReason === SuspendedOnData || + suspendedReason === SuspendedOnImmediate || + suspendedReason === SuspendedOnDeprecatedThrowPromise) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -15833,46 +15926,49 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - updatedLanes = root.finishedWork; + var finishedWork = root.finishedWork; didIncludeRenderPhaseUpdate = root.finishedLanes; - reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane( didIncludeRenderPhaseUpdate ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); - if (null === updatedLanes) return null; + if (null === finishedWork) return null; 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); root.finishedWork = null; root.finishedLanes = 0; - if (updatedLanes === root.current) + if (finishedWork === root.current) throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." ); root.callbackNode = null; root.callbackPriority = 0; root.cancelPendingCommit = null; - completedRenderStartTime = updatedLanes.lanes | updatedLanes.childLanes; + completedRenderStartTime = finishedWork.lanes | finishedWork.childLanes; completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, didIncludeRenderPhaseUpdate, completedRenderStartTime, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); - (0 === updatedLanes.actualDuration && - 0 === (updatedLanes.subtreeFlags & 10256) && - 0 === (updatedLanes.flags & 10256)) || + (0 === finishedWork.actualDuration && + 0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || rootDoesHavePassiveEffects || ((rootDoesHavePassiveEffects = !0), (pendingPassiveEffectsRemainingLanes = completedRenderStartTime), (pendingPassiveEffectsRenderEndTime = completedRenderEndTime), (pendingPassiveTransitions = transitions), scheduleCallback$1(NormalPriority$1, function () { + schedulerEvent = window.event; flushPassiveEffects(!0); return null; })); @@ -15881,33 +15977,38 @@ ? logSuspendedCommitPhase(completedRenderEndTime, commitStartTime) : suspendedCommitReason === THROTTLED_COMMIT && logSuspenseThrottlePhase(completedRenderEndTime, commitStartTime); - transitions = 0 !== (updatedLanes.flags & 15990); - 0 !== (updatedLanes.subtreeFlags & 15990) || transitions + transitions = 0 !== (finishedWork.flags & 15990); + 0 !== (finishedWork.subtreeFlags & 15990) || transitions ? ((transitions = ReactSharedInternals.T), (ReactSharedInternals.T = null), (spawnedLane = ReactDOMSharedInternals.p), (ReactDOMSharedInternals.p = DiscreteEventPriority), - (suspendedCommitReason = executionContext), + (updatedLanes = executionContext), (executionContext |= CommitContext), - commitBeforeMutationEffects(root, updatedLanes), + commitBeforeMutationEffects(root, finishedWork), commitMutationEffects( root, - updatedLanes, + finishedWork, didIncludeRenderPhaseUpdate ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), - (root.current = updatedLanes), - commitLayoutEffects(updatedLanes, root, didIncludeRenderPhaseUpdate), + (root.current = finishedWork), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), - (executionContext = suspendedCommitReason), + (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), (ReactSharedInternals.T = transitions)) - : (root.current = updatedLanes); + : (root.current = finishedWork); commitEndTime = now(); - logCommitPhase(commitStartTime, commitEndTime); - (transitions = rootDoesHavePassiveEffects) + logCommitPhase( + suspendedCommitReason === IMMEDIATE_COMMIT + ? completedRenderEndTime + : commitStartTime, + commitEndTime + ); + (suspendedCommitReason = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) @@ -15917,24 +16018,25 @@ completedRenderStartTime = root.pendingLanes; 0 === completedRenderStartTime && (legacyErrorBoundariesThatAlreadyFailed = null); - transitions || commitDoubleInvokeEffectsInDEV(root); - onCommitRoot$1(updatedLanes.stateNode, renderPriorityLevel); + suspendedCommitReason || commitDoubleInvokeEffectsInDEV(root); + onCommitRoot$1(finishedWork.stateNode, renderPriorityLevel); isDevToolsPresent && root.memoizedUpdaters.clear(); onCommitRoot(); ensureRootIsScheduled(root); if (null !== recoverableErrors) for ( - renderPriorityLevel = root.onRecoverableError, updatedLanes = 0; - updatedLanes < recoverableErrors.length; - updatedLanes++ + renderPriorityLevel = root.onRecoverableError, + completedRenderEndTime = 0; + completedRenderEndTime < recoverableErrors.length; + completedRenderEndTime++ ) - (completedRenderStartTime = recoverableErrors[updatedLanes]), - (spawnedLane = makeErrorInfo(completedRenderStartTime.stack)), + (finishedWork = recoverableErrors[completedRenderEndTime]), + (completedRenderStartTime = makeErrorInfo(finishedWork.stack)), runWithFiberInDEV( - completedRenderStartTime.source, + finishedWork.source, renderPriorityLevel, - completedRenderStartTime.value, - spawnedLane + finishedWork.value, + completedRenderStartTime ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; @@ -15945,7 +16047,8 @@ ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); + suspendedCommitReason || + finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -15997,7 +16100,7 @@ throw Error( "Cannot flush passive effects while already rendering." ); - reusableComponentDevToolDetails.track = + reusableLaneDevToolDetails.track = getGroupNameOfHighestPriorityLane(lanes); isFlushingPassiveEffects = !0; didScheduleUpdateDuringPassiveEffects = !1; @@ -16005,15 +16108,16 @@ passiveEffectStartTime = now$1(); var startTime = commitEndTime, endTime = passiveEffectStartTime; + wasDelayedCommit = !!wasDelayedCommit; supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-light"), - (reusableComponentOptions.start = startTime), - (reusableComponentOptions.end = endTime), + ((reusableLaneDevToolDetails.color = "secondary-light"), + (reusableLaneOptions.start = startTime), + (reusableLaneOptions.end = endTime), performance.measure( - "Waiting for Paint", - reusableComponentOptions + wasDelayedCommit ? "Waiting for Paint" : "", + reusableLaneOptions )); - startTime = executionContext; + wasDelayedCommit = executionContext; executionContext |= CommitContext; var finishedWork = priority.current; resetComponentEffectTimers(); @@ -16029,18 +16133,14 @@ finishedWork ); commitDoubleInvokeEffectsInDEV(priority); - executionContext = startTime; + executionContext = wasDelayedCommit; var passiveEffectsEndTime = now$1(); - wasDelayedCommit && - ((wasDelayedCommit = passiveEffectStartTime), - supportsUserTiming && - ((reusableComponentDevToolDetails.color = "secondary-dark"), - (reusableComponentOptions.start = wasDelayedCommit), - (reusableComponentOptions.end = passiveEffectsEndTime), - performance.measure( - "Remaining Effects", - reusableComponentOptions - ))); + finishedWork$jscomp$0 = passiveEffectStartTime; + supportsUserTiming && + ((reusableLaneDevToolDetails.color = "secondary-dark"), + (reusableLaneOptions.start = finishedWork$jscomp$0), + (reusableLaneOptions.end = passiveEffectsEndTime), + performance.measure("Remaining Effects", reusableLaneOptions)); finalizeRender(lanes, passiveEffectsEndTime); flushSyncWorkAcrossRoots_impl(0, !1); didScheduleUpdateDuringPassiveEffects @@ -16385,6 +16485,7 @@ } } function processRootScheduleInMicrotask() { + schedulerEvent = window.event; mightHavePendingSyncWork = didScheduleMicrotask_act = didScheduleMicrotask = @@ -16449,7 +16550,10 @@ (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) + if ( + 0 !== (suspendedLanes & 3) && + !checkIfRootIsPrerendering(root, suspendedLanes) + ) return ( null !== pingedLanes && cancelCallback(pingedLanes), (root.callbackPriority = 2), @@ -16489,6 +16593,7 @@ } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; + schedulerEvent = window.event; var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) return null; @@ -19621,11 +19726,11 @@ } function resolveEventType() { var event = window.event; - return event ? event.type : null; + return event && event !== schedulerEvent ? event.type : null; } function resolveEventTimeStamp() { var event = window.event; - return event ? event.timeStamp : -1.1; + return event && event !== schedulerEvent ? event.timeStamp : -1.1; } function handleErrorInNextTick(error) { setTimeout(function () { @@ -22829,14 +22934,24 @@ reusableComponentDevToolDetails = { dataType: "track-entry", color: "primary", - track: "Blocking", - trackGroup: "Components \u269b" + track: "Components \u269b" }, reusableComponentOptions = { start: -0, end: -0, detail: { devtools: reusableComponentDevToolDetails } }, + reusableLaneDevToolDetails = { + dataType: "track-entry", + color: "primary", + track: "Blocking", + trackGroup: "Scheduler \u269b" + }, + reusableLaneOptions = { + start: -0, + end: -0, + detail: { devtools: reusableLaneDevToolDetails } + }, OffscreenVisible = 1, OffscreenDetached = 2, OffscreenPassiveEffectsConnected = 4, @@ -22862,13 +22977,17 @@ componentEffectDuration = -0, componentEffectStartTime = -1.1, componentEffectEndTime = -1.1, + blockingClampTime = -0, blockingUpdateTime = -1.1, blockingEventTime = -1.1, blockingEventType = null, + blockingEventIsRepeat = !1, + transitionClampTime = -0, transitionStartTime = -1.1, transitionUpdateTime = -1.1, transitionEventTime = -1.1, transitionEventType = null, + transitionEventIsRepeat = !1, currentUpdateIsNested = !1, nestedUpdateScheduled = !1, ReactStrictModeWarnings = { @@ -23323,15 +23442,23 @@ currentEntangledActionThenable = null, prevOnStartTransitionFinish = ReactSharedInternals.S; ReactSharedInternals.S = function (transition, returnValue) { - "object" === typeof returnValue && + if ( + "object" === typeof returnValue && null !== returnValue && - "function" === typeof returnValue.then && - (0 > transitionStartTime && - 0 > transitionUpdateTime && - ((transitionStartTime = now()), - (transitionEventTime = resolveEventTimeStamp()), - (transitionEventType = resolveEventType())), - entangleAsyncAction(transition, returnValue)); + "function" === typeof returnValue.then + ) { + if (0 > transitionStartTime && 0 > transitionUpdateTime) { + transitionStartTime = now(); + var newEventTime = resolveEventTimeStamp(), + newEventType = resolveEventType(); + transitionEventIsRepeat = + newEventTime === transitionEventTime && + newEventType === transitionEventType; + transitionEventTime = newEventTime; + transitionEventType = newEventType; + } + entangleAsyncAction(transition, returnValue); + } null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); }; @@ -24668,6 +24795,7 @@ workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = RootInProgress, @@ -24807,6 +24935,7 @@ selectionInformation = null, warnedUnknownTags = { dialog: !0, webview: !0 }, currentPopstateTransitionEvent = null, + schedulerEvent = void 0, scheduleTimeout = "function" === typeof setTimeout ? setTimeout : void 0, cancelTimeout = "function" === typeof clearTimeout ? clearTimeout : void 0, @@ -25247,11 +25376,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25288,11 +25417,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113" + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25600,5 +25729,5 @@ } }; }; - exports.version = "19.0.0-experimental-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 ff61fc5693293..4a005e63381c3 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 @@ -599,28 +599,40 @@ function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -694,7 +706,14 @@ function markRootUpdated$1(root, updateLane) { 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } -function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { +function markRootFinished( + root, + finishedLanes, + remainingLanes, + spawnedLane, + updatedLanes, + suspendedRetryLanes +) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -704,31 +723,36 @@ function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index$6 = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index$6; - finishedLanes[index$6] = 0; - expirationTimes[index$6] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$6]; + var index$7 = 31 - clz32(remainingLanes), + lane = 1 << index$7; + entanglements[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$6] = null, index$6 = 0; - index$6 < hiddenUpdatesForLane.length; - index$6++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$6]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -743,10 +767,10 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$7 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$7; - (lane & entangledLanes) | (root[index$7] & entangledLanes) && - (root[index$7] |= entangledLanes); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } @@ -982,8 +1006,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$9 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$9 && "aria-" !== prefix$9) { + var prefix$10 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$10 && "aria-" !== prefix$10) { node.removeAttribute(name); return; } @@ -1316,15 +1340,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$15 in styles) - (styleName = styles[styleName$15]), - styles.hasOwnProperty(styleName$15) && - prevStyles[styleName$15] !== styleName && - setValueForStyle(node, styleName$15, styleName); - } else for (var styleName$16 in styles) - styles.hasOwnProperty(styleName$16) && - setValueForStyle(node, styleName$16, styles[styleName$16]); + (styleName = styles[styleName$16]), + styles.hasOwnProperty(styleName$16) && + prevStyles[styleName$16] !== styleName && + setValueForStyle(node, styleName$16, styleName); + } else + for (var styleName$17 in styles) + styles.hasOwnProperty(styleName$17) && + setValueForStyle(node, styleName$17, styles[styleName$17]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -2053,19 +2077,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$282; + var JSCompiler_inline_result$jscomp$287; if (canUseDOM) { - var isSupported$jscomp$inline_420 = "oninput" in document; - if (!isSupported$jscomp$inline_420) { - var element$jscomp$inline_421 = document.createElement("div"); - element$jscomp$inline_421.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_420 = - "function" === typeof element$jscomp$inline_421.oninput; + var isSupported$jscomp$inline_425 = "oninput" in document; + if (!isSupported$jscomp$inline_425) { + var element$jscomp$inline_426 = document.createElement("div"); + element$jscomp$inline_426.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_425 = + "function" === typeof element$jscomp$inline_426.oninput; } - JSCompiler_inline_result$jscomp$282 = isSupported$jscomp$inline_420; - } else JSCompiler_inline_result$jscomp$282 = !1; + JSCompiler_inline_result$jscomp$287 = isSupported$jscomp$inline_425; + } else JSCompiler_inline_result$jscomp$287 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$282 && + JSCompiler_inline_result$jscomp$287 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -4009,7 +4033,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$54 = !1; + didReadFromEntangledAsyncAction$55 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -4030,11 +4054,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$55 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$55 = !0); continue; } else (updateLane = { @@ -4080,7 +4104,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$54 && + didReadFromEntangledAsyncAction$55 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4282,8 +4306,8 @@ function runActionStateAction(actionQueue, node) { try { (prevTransition = action(prevState, payload)), handleActionReturnValue(actionQueue, node, prevTransition); - } catch (error$60) { - onActionError(actionQueue, node, error$60); + } catch (error$61) { + onActionError(actionQueue, node, error$61); } } function handleActionReturnValue(actionQueue, node, returnValue) { @@ -4736,14 +4760,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$63 = enqueueUpdate(provider, fiber, lane); - null !== root$63 && - (scheduleUpdateOnFiber(root$63, provider, lane), - entangleTransitions(root$63, provider, lane)); + var root$64 = enqueueUpdate(provider, fiber, lane); + null !== root$64 && + (scheduleUpdateOnFiber(root$64, provider, lane), + entangleTransitions(root$64, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$63 && + null !== root$64 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -5282,9 +5306,9 @@ function resolveClassComponentProps(Component, baseProps) { } if ((Component = Component.defaultProps)) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$67 in Component) - void 0 === newProps[propName$67] && - (newProps[propName$67] = Component[propName$67]); + for (var propName$68 in Component) + void 0 === newProps[propName$68] && + (newProps[propName$68] = Component[propName$68]); } return newProps; } @@ -5330,9 +5354,9 @@ function logUncaughtError(root, errorInfo) { try { var onUncaughtError = root.onUncaughtError; onUncaughtError(errorInfo.value, { componentStack: errorInfo.stack }); - } catch (e$68) { + } catch (e$69) { setTimeout(function () { - throw e$68; + throw e$69; }); } } @@ -5343,9 +5367,9 @@ function logCaughtError(root, boundary, errorInfo) { componentStack: errorInfo.stack, errorBoundary: 1 === boundary.tag ? boundary.stateNode : null }); - } catch (e$69) { + } catch (e$70) { setTimeout(function () { - throw e$69; + throw e$70; }); } } @@ -7801,8 +7825,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$114) { - captureCommitPhaseError(current, nearestMountedAncestor, error$114); + } catch (error$115) { + captureCommitPhaseError(current, nearestMountedAncestor, error$115); } else ref.current = null; } @@ -7936,7 +7960,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$19) { + } catch (e$20) { JSCompiler_temp = null; break a; } @@ -8111,11 +8135,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$113) { + } catch (error$114) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$113 + error$114 ); } } @@ -8269,7 +8293,7 @@ function commitDeletionEffectsOnFiber( safelyDetachRef(deletedFiber, nearestMountedAncestor); case 6: prevHostParentIsContainer = hostParent; - var prevHostParentIsContainer$121 = hostParentIsContainer; + var prevHostParentIsContainer$122 = hostParentIsContainer; hostParent = null; recursivelyTraverseDeletionEffects( finishedRoot, @@ -8277,7 +8301,7 @@ function commitDeletionEffectsOnFiber( deletedFiber ); hostParent = prevHostParentIsContainer; - hostParentIsContainer = prevHostParentIsContainer$121; + hostParentIsContainer = prevHostParentIsContainer$122; if (null !== hostParent) if (hostParentIsContainer) try { @@ -8910,21 +8934,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$115 = JSCompiler_inline_result.stateNode; + var parent$116 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$115, ""), + (setTextContent(parent$116, ""), (JSCompiler_inline_result.flags &= -33)); - var before$116 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$116, parent$115); + var before$117 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$117, parent$116); break; case 3: case 4: - var parent$117 = JSCompiler_inline_result.stateNode.containerInfo, - before$118 = getHostSibling(finishedWork); + var parent$118 = JSCompiler_inline_result.stateNode.containerInfo, + before$119 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$118, - parent$117 + before$119, + parent$118 ); break; default: @@ -9808,20 +9832,32 @@ function markUpdate(workInProgress) { function preloadResourceAndSuspendIfNeeded(workInProgress, resource) { if ("stylesheet" !== resource.type || 0 !== (resource.state.loading & 4)) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -9838,14 +9874,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$133 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$133 = lastTailNode), + for (var lastTailNode$134 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$134 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$133 + null === lastTailNode$134 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$133.sibling = null); + : (lastTailNode$134.sibling = null); } } function bubbleProperties(completedWork) { @@ -9855,19 +9891,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$134 = completedWork.child; null !== child$134; ) - (newChildLanes |= child$134.lanes | child$134.childLanes), - (subtreeFlags |= child$134.subtreeFlags & 31457280), - (subtreeFlags |= child$134.flags & 31457280), - (child$134.return = completedWork), - (child$134 = child$134.sibling); + for (var child$135 = completedWork.child; null !== child$135; ) + (newChildLanes |= child$135.lanes | child$135.childLanes), + (subtreeFlags |= child$135.subtreeFlags & 31457280), + (subtreeFlags |= child$135.flags & 31457280), + (child$135.return = completedWork), + (child$135 = child$135.sibling); else - for (child$134 = completedWork.child; null !== child$134; ) - (newChildLanes |= child$134.lanes | child$134.childLanes), - (subtreeFlags |= child$134.subtreeFlags), - (subtreeFlags |= child$134.flags), - (child$134.return = completedWork), - (child$134 = child$134.sibling); + for (child$135 = completedWork.child; null !== child$135; ) + (newChildLanes |= child$135.lanes | child$135.childLanes), + (subtreeFlags |= child$135.subtreeFlags), + (subtreeFlags |= child$135.flags), + (child$135.return = completedWork), + (child$135 = child$135.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -10144,11 +10180,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (type = newProps.alternate.memoizedState.cachePool.pool); - var cache$146 = null; + var cache$147 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$146 = newProps.memoizedState.cachePool.pool); - cache$146 !== type && (newProps.flags |= 2048); + (cache$147 = newProps.memoizedState.cachePool.pool); + cache$147 !== type && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -10173,8 +10209,8 @@ function completeWork(current, workInProgress, renderLanes) { type = workInProgress.memoizedState; if (null === type) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$146 = type.rendering; - if (null === cache$146) + cache$147 = type.rendering; + if (null === cache$147) if (newProps) cutOffTailIfNeeded(type, !1); else { if ( @@ -10182,11 +10218,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$146 = findFirstSuspended(current); - if (null !== cache$146) { + cache$147 = findFirstSuspended(current); + if (null !== cache$147) { workInProgress.flags |= 128; cutOffTailIfNeeded(type, !1); - current = cache$146.updateQueue; + current = cache$147.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -10211,7 +10247,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$146)), null !== current)) { + if (((current = findFirstSuspended(cache$147)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -10221,7 +10257,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !0), null === type.tail && "hidden" === type.tailMode && - !cache$146.alternate && + !cache$147.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -10234,13 +10270,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !1), (workInProgress.lanes = 4194304)); type.isBackwards - ? ((cache$146.sibling = workInProgress.child), - (workInProgress.child = cache$146)) + ? ((cache$147.sibling = workInProgress.child), + (workInProgress.child = cache$147)) : ((current = type.last), null !== current - ? (current.sibling = cache$146) - : (workInProgress.child = cache$146), - (type.last = cache$146)); + ? (current.sibling = cache$147) + : (workInProgress.child = cache$147), + (type.last = cache$147)); } if (null !== type.tail) return ( @@ -10600,6 +10636,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressSuspendedReason = 0, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, @@ -10650,7 +10687,8 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) @@ -10661,23 +10699,35 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root$jscomp$0.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root$jscomp$0, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root$jscomp$0, lanes) : renderRootSync(root$jscomp$0, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (0 === exitStatus) break; - else if (6 === exitStatus) markRootSuspended(root$jscomp$0, lanes, 0); + if (0 === exitStatus) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root$jscomp$0, lanes, 0, !1); + break; + } else if (6 === exitStatus) + markRootSuspended( + root$jscomp$0, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root$jscomp$0.current.alternate; if ( @@ -10737,11 +10787,11 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { } if (1 === exitStatus) { prepareFreshStack(root$jscomp$0, 0); - markRootSuspended(root$jscomp$0, lanes, 0); + markRootSuspended(root$jscomp$0, lanes, 0, !0); break; } a: { - renderWasConcurrent = root$jscomp$0; + shouldTimeSlice = root$jscomp$0; switch (exitStatus) { case 0: case 1: @@ -10749,9 +10799,10 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { case 4: if ((lanes & 4194176) === lanes) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -10765,23 +10816,24 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { default: throw Error(formatProdErrorMessage(329)); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if ( (lanes & 62914560) === lanes && - ((exitStatus = globalMostRecentFallbackTime + 300 - now()), - 10 < exitStatus) + ((renderWasConcurrent = globalMostRecentFallbackTime + 300 - now()), + 10 < renderWasConcurrent) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10795,12 +10847,12 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { -0, 0 ), - exitStatus + renderWasConcurrent ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10843,11 +10895,8 @@ function commitRootWhenReady( completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -10869,7 +10918,7 @@ function commitRootWhenReady( completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended(root, lanes, spawnedLane, !didSkipSuspendedSiblings); return; } commitRoot( @@ -10919,19 +10968,22 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes, spawnedLane) { +function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree +) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + didAttemptEntireTree[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -10975,7 +11027,7 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressSuspendedRetryLanes = workInProgressDeferredLane = @@ -10995,9 +11047,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$3 = 31 - clz32(allEntangledLanes), - lane = 1 << index$3; - lanes |= root[index$3]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -11009,12 +11061,7 @@ function handleThrow(root, thrownValue) { ReactSharedInternals.H = ContextOnlyDispatcher; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 2 - : 3)) + (workInProgressSuspendedReason = 3)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = 4)) @@ -11034,21 +11081,6 @@ function handleThrow(root, thrownValue) { createCapturedValueAtFiber(thrownValue, root.current) )); } -function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; -} function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -11061,13 +11093,19 @@ function pushAsyncDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } function queueConcurrentError(error) { @@ -11075,7 +11113,7 @@ function queueConcurrentError(error) { ? (workInProgressRootConcurrentErrors = [error]) : workInProgressRootConcurrentErrors.push(error); } -function renderRootSync(root, lanes) { +function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= 2; var prevDispatcher = pushDispatcher(), @@ -11102,6 +11140,13 @@ function renderRootSync(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + exitStatus = 0; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -11113,8 +11158,8 @@ function renderRootSync(root, lanes) { workLoopSync(); exitStatus = workInProgressRootExitStatus; break; - } catch (thrownValue$163) { - handleThrow(root, thrownValue$163); + } catch (thrownValue$168) { + handleThrow(root, thrownValue$168); } while (1); lanes && root.shellSuspendCounter++; @@ -11140,7 +11185,10 @@ function renderRootConcurrent(root, lanes) { ? ((workInProgressTransitions = null), (workInProgressRootRenderTargetTime = now() + 500), prepareFreshStack(root, lanes)) - : checkIfRootIsPrerendering(root, lanes); + : (workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + )); a: do try { if (0 !== workInProgressSuspendedReason && null !== workInProgress) { @@ -11224,8 +11272,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$165) { - handleThrow(root, thrownValue$165); + } catch (thrownValue$170) { + handleThrow(root, thrownValue$170); } while (1); lastContextDependency = currentlyRenderingFiber = null; @@ -11283,7 +11331,12 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason +) { lastContextDependency = currentlyRenderingFiber = null; resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -11317,9 +11370,23 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || 1 === suspendedReason) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + 2 === suspendedReason || 3 === suspendedReason || 6 === suspendedReason) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -11414,7 +11481,9 @@ function commitRootImpl( transitions, didIncludeRenderPhaseUpdate, renderPriorityLevel, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -11434,7 +11503,9 @@ function commitRootImpl( root, didIncludeRenderPhaseUpdate, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), @@ -11450,25 +11521,25 @@ function commitRootImpl( return null; })); transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactSharedInternals.T; - ReactSharedInternals.T = null; - spawnedLane = ReactDOMSharedInternals.p; - ReactDOMSharedInternals.p = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - restoreSelection(selectionInformation, root.containerInfo); - _enabled = !!eventsEnabled; - selectionInformation = eventsEnabled = null; - root.current = finishedWork; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - requestPaint(); - executionContext = prevExecutionContext; - ReactDOMSharedInternals.p = spawnedLane; - ReactSharedInternals.T = transitions; - } else root.current = finishedWork; + 0 !== (finishedWork.subtreeFlags & 15990) || transitions + ? ((transitions = ReactSharedInternals.T), + (ReactSharedInternals.T = null), + (spawnedLane = ReactDOMSharedInternals.p), + (ReactDOMSharedInternals.p = 2), + (updatedLanes = executionContext), + (executionContext |= 4), + commitBeforeMutationEffects(root, finishedWork), + commitMutationEffectsOnFiber(finishedWork, root), + restoreSelection(selectionInformation, root.containerInfo), + (_enabled = !!eventsEnabled), + (selectionInformation = eventsEnabled = null), + (root.current = finishedWork), + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork), + requestPaint(), + (executionContext = updatedLanes), + (ReactDOMSharedInternals.p = spawnedLane), + (ReactSharedInternals.T = transitions)) + : (root.current = finishedWork); rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), @@ -11506,7 +11577,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$169 = rootWithPendingPassiveEffects, + var root$174 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11545,7 +11616,7 @@ function flushPassiveEffects() { } finally { (ReactDOMSharedInternals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$169, remainingLanes); + releaseRootPooledCache(root$174, remainingLanes); } } return !1; @@ -11688,14 +11759,14 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$171 = firstScheduledRoot; null !== root$171; ) { + for (var root$176 = firstScheduledRoot; null !== root$176; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { - var pendingLanes = root$171.pendingLanes; + var pendingLanes = root$176.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { - var suspendedLanes = root$171.suspendedLanes, - pingedLanes = root$171.pingedLanes; + var suspendedLanes = root$176.suspendedLanes, + pingedLanes = root$176.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= @@ -11709,18 +11780,18 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$171, JSCompiler_inline_result)); + performSyncWorkOnRoot(root$176, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( - root$171, - root$171 === workInProgressRoot ? JSCompiler_inline_result : 0 + root$176, + root$176 === workInProgressRoot ? JSCompiler_inline_result : 0 )), 0 === (JSCompiler_inline_result & 3) || - checkIfRootIsPrerendering(root$171, JSCompiler_inline_result) || + checkIfRootIsPrerendering(root$176, JSCompiler_inline_result) || ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$171, JSCompiler_inline_result)); - root$171 = root$171.next; + performSyncWorkOnRoot(root$176, JSCompiler_inline_result)); + root$176 = root$176.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -11761,12 +11832,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4, - expirationTime = expirationTimes[index$4]; + var index$5 = 31 - clz32(lanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$4] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -11789,37 +11860,37 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) - return ( - null !== pingedLanes && - null !== pingedLanes && - cancelCallback$1(pingedLanes), - (root.callbackPriority = 2), - (root.callbackNode = null), - 2 - ); - currentTime = suspendedLanes & -suspendedLanes; - if (currentTime === root.callbackPriority) return currentTime; - null !== pingedLanes && cancelCallback$1(pingedLanes); - switch (lanesToEventPriority(suspendedLanes)) { - case 2: - case 8: - suspendedLanes = UserBlockingPriority; - break; - case 32: - suspendedLanes = NormalPriority$1; - break; - case 268435456: - suspendedLanes = IdlePriority; - break; - default: - suspendedLanes = NormalPriority$1; - } - pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); - suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); - root.callbackPriority = currentTime; - root.callbackNode = suspendedLanes; - return currentTime; + if ( + 0 === (suspendedLanes & 3) || + checkIfRootIsPrerendering(root, suspendedLanes) + ) { + currentTime = suspendedLanes & -suspendedLanes; + if (currentTime === root.callbackPriority) return currentTime; + null !== pingedLanes && cancelCallback$1(pingedLanes); + switch (lanesToEventPriority(suspendedLanes)) { + case 2: + case 8: + suspendedLanes = UserBlockingPriority; + break; + case 32: + suspendedLanes = NormalPriority$1; + break; + case 268435456: + suspendedLanes = IdlePriority; + break; + default: + suspendedLanes = NormalPriority$1; + } + pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); + suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); + root.callbackPriority = currentTime; + root.callbackNode = suspendedLanes; + return currentTime; + } + null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes); + root.callbackPriority = 2; + root.callbackNode = null; + return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { var originalCallbackNode = root.callbackNode; @@ -11948,20 +12019,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1452 = 0; - i$jscomp$inline_1452 < simpleEventPluginEvents.length; - i$jscomp$inline_1452++ + var i$jscomp$inline_1461 = 0; + i$jscomp$inline_1461 < simpleEventPluginEvents.length; + i$jscomp$inline_1461++ ) { - var eventName$jscomp$inline_1453 = - simpleEventPluginEvents[i$jscomp$inline_1452], - domEventName$jscomp$inline_1454 = - eventName$jscomp$inline_1453.toLowerCase(), - capitalizedEvent$jscomp$inline_1455 = - eventName$jscomp$inline_1453[0].toUpperCase() + - eventName$jscomp$inline_1453.slice(1); + var eventName$jscomp$inline_1462 = + simpleEventPluginEvents[i$jscomp$inline_1461], + domEventName$jscomp$inline_1463 = + eventName$jscomp$inline_1462.toLowerCase(), + capitalizedEvent$jscomp$inline_1464 = + eventName$jscomp$inline_1462[0].toUpperCase() + + eventName$jscomp$inline_1462.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1454, - "on" + capitalizedEvent$jscomp$inline_1455 + domEventName$jscomp$inline_1463, + "on" + capitalizedEvent$jscomp$inline_1464 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -13144,34 +13215,34 @@ function setInitialProperties(domElement, tag, props) { defaultChecked = null; for (hasSrc in props) if (props.hasOwnProperty(hasSrc)) { - var propValue$185 = props[hasSrc]; - if (null != propValue$185) + var propValue$190 = props[hasSrc]; + if (null != propValue$190) switch (hasSrc) { case "name": - hasSrcSet = propValue$185; + hasSrcSet = propValue$190; break; case "type": - propValue = propValue$185; + propValue = propValue$190; break; case "checked": - checked = propValue$185; + checked = propValue$190; break; case "defaultChecked": - defaultChecked = propValue$185; + defaultChecked = propValue$190; break; case "value": - propKey = propValue$185; + propKey = propValue$190; break; case "defaultValue": - defaultValue = propValue$185; + defaultValue = propValue$190; break; case "children": case "dangerouslySetInnerHTML": - if (null != propValue$185) + if (null != propValue$190) throw Error(formatProdErrorMessage(137, tag)); break; default: - setProp(domElement, tag, hasSrc, propValue$185, props, null); + setProp(domElement, tag, hasSrc, propValue$190, props, null); } } initInput( @@ -13308,14 +13379,14 @@ function setInitialProperties(domElement, tag, props) { return; default: if (isCustomElement(tag)) { - for (propValue$185 in props) - props.hasOwnProperty(propValue$185) && - ((hasSrc = props[propValue$185]), + for (propValue$190 in props) + props.hasOwnProperty(propValue$190) && + ((hasSrc = props[propValue$190]), void 0 !== hasSrc && setPropOnCustomElement( domElement, tag, - propValue$185, + propValue$190, hasSrc, props, void 0 @@ -13363,14 +13434,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$202 in nextProps) { - var propKey = nextProps[propKey$202]; - lastProp = lastProps[propKey$202]; + for (var propKey$207 in nextProps) { + var propKey = nextProps[propKey$207]; + lastProp = lastProps[propKey$207]; if ( - nextProps.hasOwnProperty(propKey$202) && + nextProps.hasOwnProperty(propKey$207) && (null != propKey || null != lastProp) ) - switch (propKey$202) { + switch (propKey$207) { case "type": type = propKey; break; @@ -13399,7 +13470,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$202, + propKey$207, propKey, nextProps, lastProp @@ -13418,7 +13489,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$202 = null; + propKey = value = defaultValue = propKey$207 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -13449,7 +13520,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$202 = type; + propKey$207 = type; break; case "defaultValue": defaultValue = type; @@ -13470,15 +13541,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$202 - ? updateOptions(domElement, !!lastProps, propKey$202, !1) + null != propKey$207 + ? updateOptions(domElement, !!lastProps, propKey$207, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$202 = null; + propKey = propKey$207 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -13502,7 +13573,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$202 = name; + propKey$207 = name; break; case "defaultValue": propKey = name; @@ -13516,17 +13587,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$202, propKey); + updateTextarea(domElement, propKey$207, propKey); return; case "option": - for (var propKey$218 in lastProps) + for (var propKey$223 in lastProps) if ( - ((propKey$202 = lastProps[propKey$218]), - lastProps.hasOwnProperty(propKey$218) && - null != propKey$202 && - !nextProps.hasOwnProperty(propKey$218)) + ((propKey$207 = lastProps[propKey$223]), + lastProps.hasOwnProperty(propKey$223) && + null != propKey$207 && + !nextProps.hasOwnProperty(propKey$223)) ) - switch (propKey$218) { + switch (propKey$223) { case "selected": domElement.selected = !1; break; @@ -13534,33 +13605,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$218, + propKey$223, null, nextProps, - propKey$202 + propKey$207 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$202 = nextProps[lastDefaultValue]), + ((propKey$207 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$202 !== propKey && - (null != propKey$202 || null != propKey)) + propKey$207 !== propKey && + (null != propKey$207 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$202 && - "function" !== typeof propKey$202 && - "symbol" !== typeof propKey$202; + propKey$207 && + "function" !== typeof propKey$207 && + "symbol" !== typeof propKey$207; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$202, + propKey$207, nextProps, propKey ); @@ -13581,24 +13652,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$223 in lastProps) - (propKey$202 = lastProps[propKey$223]), - lastProps.hasOwnProperty(propKey$223) && - null != propKey$202 && - !nextProps.hasOwnProperty(propKey$223) && - setProp(domElement, tag, propKey$223, null, nextProps, propKey$202); + for (var propKey$228 in lastProps) + (propKey$207 = lastProps[propKey$228]), + lastProps.hasOwnProperty(propKey$228) && + null != propKey$207 && + !nextProps.hasOwnProperty(propKey$228) && + setProp(domElement, tag, propKey$228, null, nextProps, propKey$207); for (checked in nextProps) if ( - ((propKey$202 = nextProps[checked]), + ((propKey$207 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$202 !== propKey && - (null != propKey$202 || null != propKey)) + propKey$207 !== propKey && + (null != propKey$207 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$202) + if (null != propKey$207) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -13606,7 +13677,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$202, + propKey$207, nextProps, propKey ); @@ -13614,49 +13685,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$228 in lastProps) - (propKey$202 = lastProps[propKey$228]), - lastProps.hasOwnProperty(propKey$228) && - void 0 !== propKey$202 && - !nextProps.hasOwnProperty(propKey$228) && + for (var propKey$233 in lastProps) + (propKey$207 = lastProps[propKey$233]), + lastProps.hasOwnProperty(propKey$233) && + void 0 !== propKey$207 && + !nextProps.hasOwnProperty(propKey$233) && setPropOnCustomElement( domElement, tag, - propKey$228, + propKey$233, void 0, nextProps, - propKey$202 + propKey$207 ); for (defaultChecked in nextProps) - (propKey$202 = nextProps[defaultChecked]), + (propKey$207 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$202 === propKey || - (void 0 === propKey$202 && void 0 === propKey) || + propKey$207 === propKey || + (void 0 === propKey$207 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$202, + propKey$207, nextProps, propKey ); return; } } - for (var propKey$233 in lastProps) - (propKey$202 = lastProps[propKey$233]), - lastProps.hasOwnProperty(propKey$233) && - null != propKey$202 && - !nextProps.hasOwnProperty(propKey$233) && - setProp(domElement, tag, propKey$233, null, nextProps, propKey$202); + for (var propKey$238 in lastProps) + (propKey$207 = lastProps[propKey$238]), + lastProps.hasOwnProperty(propKey$238) && + null != propKey$207 && + !nextProps.hasOwnProperty(propKey$238) && + setProp(domElement, tag, propKey$238, null, nextProps, propKey$207); for (lastProp in nextProps) - (propKey$202 = nextProps[lastProp]), + (propKey$207 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$202 === propKey || - (null == propKey$202 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$202, nextProps, propKey); + propKey$207 === propKey || + (null == propKey$207 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$207, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -14258,26 +14329,26 @@ function getResource(type, currentProps, pendingProps, currentResource) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$241 = getResourcesFromRoot( + var styles$246 = getResourcesFromRoot( JSCompiler_inline_result ).hoistableStyles, - resource$242 = styles$241.get(type); - resource$242 || + resource$247 = styles$246.get(type); + resource$247 || ((JSCompiler_inline_result = JSCompiler_inline_result.ownerDocument || JSCompiler_inline_result), - (resource$242 = { + (resource$247 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$241.set(type, resource$242), - (styles$241 = JSCompiler_inline_result.querySelector( + styles$246.set(type, resource$247), + (styles$246 = JSCompiler_inline_result.querySelector( getStylesheetSelectorFromKey(type) )) && - !styles$241._p && - ((resource$242.instance = styles$241), - (resource$242.state.loading = 5)), + !styles$246._p && + ((resource$247.instance = styles$246), + (resource$247.state.loading = 5)), preloadPropsMap.has(type) || ((pendingProps = { rel: "preload", @@ -14290,16 +14361,16 @@ function getResource(type, currentProps, pendingProps, currentResource) { referrerPolicy: pendingProps.referrerPolicy }), preloadPropsMap.set(type, pendingProps), - styles$241 || + styles$246 || preloadStylesheet( JSCompiler_inline_result, type, pendingProps, - resource$242.state + resource$247.state ))); if (currentProps && null === currentResource) throw Error(formatProdErrorMessage(528, "")); - return resource$242; + return resource$247; } if (currentProps && null !== currentResource) throw Error(formatProdErrorMessage(529, "")); @@ -14396,37 +14467,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$247 = hoistableRoot.querySelector( + var instance$252 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$247) + if (instance$252) return ( (resource.state.loading |= 4), - (resource.instance = instance$247), - markNodeAsHoistable(instance$247), - instance$247 + (resource.instance = instance$252), + markNodeAsHoistable(instance$252), + instance$252 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$247 = ( + instance$252 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$247); - var linkInstance = instance$247; + markNodeAsHoistable(instance$252); + var linkInstance = instance$252; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$247, "link", instance); + setInitialProperties(instance$252, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$247, props.precedence, hoistableRoot); - return (resource.instance = instance$247); + insertStylesheet(instance$252, props.precedence, hoistableRoot); + return (resource.instance = instance$252); case "script": - instance$247 = getScriptKey(props.src); + instance$252 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$247) + getScriptSelectorFromKey(instance$252) )) ) return ( @@ -14435,7 +14506,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$247))) + if ((styleProps = preloadPropsMap.get(instance$252))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -15459,16 +15530,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1699 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1708 = React.version; if ( - "19.0.0-experimental-380f5d67-20241113" !== - isomorphicReactPackageVersion$jscomp$inline_1699 + "19.0.0-experimental-b01722d5-20241114" !== + isomorphicReactPackageVersion$jscomp$inline_1708 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1699, - "19.0.0-experimental-380f5d67-20241113" + isomorphicReactPackageVersion$jscomp$inline_1708, + "19.0.0-experimental-b01722d5-20241114" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15488,25 +15559,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2174 = { +var internals$jscomp$inline_2186 = { bundleType: 0, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113" + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2175 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2187 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2175.isDisabled && - hook$jscomp$inline_2175.supportsFiber + !hook$jscomp$inline_2187.isDisabled && + hook$jscomp$inline_2187.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2175.inject( - internals$jscomp$inline_2174 + (rendererID = hook$jscomp$inline_2187.inject( + internals$jscomp$inline_2186 )), - (injectedHook = hook$jscomp$inline_2175); + (injectedHook = hook$jscomp$inline_2187); } catch (err) {} } exports.createComponentSelector = function (component) { @@ -15749,4 +15820,4 @@ exports.observeVisibleRects = function ( } }; }; -exports.version = "19.0.0-experimental-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 b42e06fa81798..fb5a496e7b463 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-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; "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 f448262843566..896a2a2974a6a 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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 dd681736496e0..193dffe155d92 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-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 4fe0342ce72c7..6323eeaa9ff39 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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; diff --git a/packages/next/src/compiled/react-dom-experimental/package.json b/packages/next/src/compiled/react-dom-experimental/package.json index 45cfad08ada6b..8e84edabbd474 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-380f5d67-20241113" + "scheduler": "0.0.0-experimental-b01722d5-20241114" }, "peerDependencies": { - "react": "0.0.0-experimental-380f5d67-20241113" + "react": "0.0.0-experimental-b01722d5-20241114" }, "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 ca4bd7dc326a4..76b7b2e44b034 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 @@ -1002,28 +1002,40 @@ var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -1108,7 +1120,9 @@ root, finishedLanes, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; @@ -1119,17 +1133,17 @@ root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index; - finishedLanes[index] = 0; + var index = 31 - clz32(remainingLanes), + lane = 1 << index; + entanglements[index] = 0; expirationTimes[index] = -1; var hiddenUpdatesForLane = hiddenUpdates[index]; if (null !== hiddenUpdatesForLane) @@ -1141,9 +1155,14 @@ var update = hiddenUpdatesForLane[index]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -8656,32 +8675,32 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2310; - var JSCompiler_object_inline_stack_2311 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2317; + var JSCompiler_object_inline_stack_2318 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2312 = !1; + var JSCompiler_object_inline_componentStack_2319 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2310 = didSuspend) || - (JSCompiler_object_inline_digest_2310 = + (JSCompiler_object_inline_digest_2317 = didSuspend) || + (JSCompiler_object_inline_digest_2317 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2310 && - ((JSCompiler_object_inline_componentStack_2312 = !0), + JSCompiler_object_inline_digest_2317 && + ((JSCompiler_object_inline_componentStack_2319 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2310 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2317 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2312 + JSCompiler_object_inline_componentStack_2319 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2309 = nextHydratableInstance; + var JSCompiler_object_inline_message_2316 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2309)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2316)) { c: { - var instance = JSCompiler_object_inline_message_2309; + var instance = JSCompiler_object_inline_message_2316; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8722,19 +8741,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2309 + JSCompiler_object_inline_message_2316 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2309 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2316 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2309 && - ((JSCompiler_object_inline_message_2309 = - JSCompiler_object_inline_message_2309.dehydrated), - null !== JSCompiler_object_inline_message_2309) + null !== JSCompiler_object_inline_message_2316 && + ((JSCompiler_object_inline_message_2316 = + JSCompiler_object_inline_message_2316.dehydrated), + null !== JSCompiler_object_inline_message_2316) ) return ( - JSCompiler_object_inline_message_2309.data === + JSCompiler_object_inline_message_2316.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -8742,58 +8761,58 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2309 = - JSCompiler_object_inline_stack_2311.children; - JSCompiler_object_inline_stack_2311 = - JSCompiler_object_inline_stack_2311.fallback; - if (JSCompiler_object_inline_componentStack_2312) + JSCompiler_object_inline_message_2316 = + JSCompiler_object_inline_stack_2318.children; + JSCompiler_object_inline_stack_2318 = + JSCompiler_object_inline_stack_2318.fallback; + if (JSCompiler_object_inline_componentStack_2319) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2312 = + (JSCompiler_object_inline_componentStack_2319 = workInProgress.mode), - (JSCompiler_object_inline_message_2309 = + (JSCompiler_object_inline_message_2316 = mountWorkInProgressOffscreenFiber( { mode: "hidden", - children: JSCompiler_object_inline_message_2309 + children: JSCompiler_object_inline_message_2316 }, - JSCompiler_object_inline_componentStack_2312 + JSCompiler_object_inline_componentStack_2319 )), - (JSCompiler_object_inline_stack_2311 = createFiberFromFragment( - JSCompiler_object_inline_stack_2311, - JSCompiler_object_inline_componentStack_2312, + (JSCompiler_object_inline_stack_2318 = createFiberFromFragment( + JSCompiler_object_inline_stack_2318, + JSCompiler_object_inline_componentStack_2319, renderLanes, null )), - (JSCompiler_object_inline_message_2309.return = workInProgress), - (JSCompiler_object_inline_stack_2311.return = workInProgress), - (JSCompiler_object_inline_message_2309.sibling = - JSCompiler_object_inline_stack_2311), - (workInProgress.child = JSCompiler_object_inline_message_2309), - (JSCompiler_object_inline_componentStack_2312 = + (JSCompiler_object_inline_message_2316.return = workInProgress), + (JSCompiler_object_inline_stack_2318.return = workInProgress), + (JSCompiler_object_inline_message_2316.sibling = + JSCompiler_object_inline_stack_2318), + (workInProgress.child = JSCompiler_object_inline_message_2316), + (JSCompiler_object_inline_componentStack_2319 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2312.memoizedState = + (JSCompiler_object_inline_componentStack_2319.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2312.childLanes = + (JSCompiler_object_inline_componentStack_2319.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2310, + JSCompiler_object_inline_digest_2317, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2311 + JSCompiler_object_inline_stack_2318 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2309 + JSCompiler_object_inline_message_2316 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2309 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2309) + ((JSCompiler_object_inline_message_2316 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2316) ) { if (didSuspend) workInProgress.flags & 256 @@ -8810,95 +8829,95 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2312 = - JSCompiler_object_inline_stack_2311.fallback), - (JSCompiler_object_inline_message_2309 = workInProgress.mode), - (JSCompiler_object_inline_stack_2311 = + (JSCompiler_object_inline_componentStack_2319 = + JSCompiler_object_inline_stack_2318.fallback), + (JSCompiler_object_inline_message_2316 = workInProgress.mode), + (JSCompiler_object_inline_stack_2318 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2311.children + children: JSCompiler_object_inline_stack_2318.children }, - JSCompiler_object_inline_message_2309 + JSCompiler_object_inline_message_2316 )), - (JSCompiler_object_inline_componentStack_2312 = + (JSCompiler_object_inline_componentStack_2319 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2312, - JSCompiler_object_inline_message_2309, + JSCompiler_object_inline_componentStack_2319, + JSCompiler_object_inline_message_2316, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2312.flags |= 2), - (JSCompiler_object_inline_stack_2311.return = workInProgress), - (JSCompiler_object_inline_componentStack_2312.return = + (JSCompiler_object_inline_componentStack_2319.flags |= 2), + (JSCompiler_object_inline_stack_2318.return = workInProgress), + (JSCompiler_object_inline_componentStack_2319.return = workInProgress), - (JSCompiler_object_inline_stack_2311.sibling = - JSCompiler_object_inline_componentStack_2312), - (workInProgress.child = JSCompiler_object_inline_stack_2311), + (JSCompiler_object_inline_stack_2318.sibling = + JSCompiler_object_inline_componentStack_2319), + (workInProgress.child = JSCompiler_object_inline_stack_2318), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2311 = workInProgress.child), - (JSCompiler_object_inline_stack_2311.memoizedState = + (JSCompiler_object_inline_stack_2318 = workInProgress.child), + (JSCompiler_object_inline_stack_2318.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2311.childLanes = + (JSCompiler_object_inline_stack_2318.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2310, + JSCompiler_object_inline_digest_2317, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2312)); + JSCompiler_object_inline_componentStack_2319)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2309.data === + JSCompiler_object_inline_message_2316.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2310 = - JSCompiler_object_inline_message_2309.nextSibling && - JSCompiler_object_inline_message_2309.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2310) { - JSCompiler_temp = JSCompiler_object_inline_digest_2310.dgst; - var message = JSCompiler_object_inline_digest_2310.msg; - instance = JSCompiler_object_inline_digest_2310.stck; - var componentStack = JSCompiler_object_inline_digest_2310.cstck; + JSCompiler_object_inline_digest_2317 = + JSCompiler_object_inline_message_2316.nextSibling && + JSCompiler_object_inline_message_2316.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2317) { + JSCompiler_temp = JSCompiler_object_inline_digest_2317.dgst; + var message = JSCompiler_object_inline_digest_2317.msg; + instance = JSCompiler_object_inline_digest_2317.stck; + var componentStack = JSCompiler_object_inline_digest_2317.cstck; } - JSCompiler_object_inline_message_2309 = message; - JSCompiler_object_inline_digest_2310 = JSCompiler_temp; - JSCompiler_object_inline_stack_2311 = instance; - JSCompiler_temp = JSCompiler_object_inline_componentStack_2312 = + JSCompiler_object_inline_message_2316 = message; + JSCompiler_object_inline_digest_2317 = JSCompiler_temp; + JSCompiler_object_inline_stack_2318 = instance; + JSCompiler_temp = JSCompiler_object_inline_componentStack_2319 = componentStack; - JSCompiler_object_inline_componentStack_2312 = - JSCompiler_object_inline_message_2309 - ? Error(JSCompiler_object_inline_message_2309) + JSCompiler_object_inline_componentStack_2319 = + JSCompiler_object_inline_message_2316 + ? Error(JSCompiler_object_inline_message_2316) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_componentStack_2312.stack = - JSCompiler_object_inline_stack_2311 || ""; - JSCompiler_object_inline_componentStack_2312.digest = - JSCompiler_object_inline_digest_2310; - JSCompiler_object_inline_digest_2310 = + JSCompiler_object_inline_componentStack_2319.stack = + JSCompiler_object_inline_stack_2318 || ""; + JSCompiler_object_inline_componentStack_2319.digest = + JSCompiler_object_inline_digest_2317; + JSCompiler_object_inline_digest_2317 = void 0 === JSCompiler_temp ? null : JSCompiler_temp; - JSCompiler_object_inline_stack_2311 = { - value: JSCompiler_object_inline_componentStack_2312, + JSCompiler_object_inline_stack_2318 = { + value: JSCompiler_object_inline_componentStack_2319, source: null, - stack: JSCompiler_object_inline_digest_2310 + stack: JSCompiler_object_inline_digest_2317 }; - "string" === typeof JSCompiler_object_inline_digest_2310 && + "string" === typeof JSCompiler_object_inline_digest_2317 && CapturedStacks.set( - JSCompiler_object_inline_componentStack_2312, - JSCompiler_object_inline_stack_2311 + JSCompiler_object_inline_componentStack_2319, + JSCompiler_object_inline_stack_2318 ); - queueHydrationError(JSCompiler_object_inline_stack_2311); + queueHydrationError(JSCompiler_object_inline_stack_2318); workInProgress = retrySuspenseComponentWithoutHydrating( current, workInProgress, @@ -8912,25 +8931,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_digest_2310 = + (JSCompiler_object_inline_digest_2317 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2310) + didReceiveUpdate || JSCompiler_object_inline_digest_2317) ) { - JSCompiler_object_inline_digest_2310 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2310) { - JSCompiler_object_inline_stack_2311 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2311 & 42)) - JSCompiler_object_inline_stack_2311 = 1; + JSCompiler_object_inline_digest_2317 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2317) { + JSCompiler_object_inline_stack_2318 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2318 & 42)) + JSCompiler_object_inline_stack_2318 = 1; else - switch (JSCompiler_object_inline_stack_2311) { + switch (JSCompiler_object_inline_stack_2318) { case 2: - JSCompiler_object_inline_stack_2311 = 1; + JSCompiler_object_inline_stack_2318 = 1; break; case 8: - JSCompiler_object_inline_stack_2311 = 4; + JSCompiler_object_inline_stack_2318 = 4; break; case 32: - JSCompiler_object_inline_stack_2311 = 16; + JSCompiler_object_inline_stack_2318 = 16; break; case 128: case 256: @@ -8951,40 +8970,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2311 = 64; + JSCompiler_object_inline_stack_2318 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2311 = 134217728; + JSCompiler_object_inline_stack_2318 = 134217728; break; default: - JSCompiler_object_inline_stack_2311 = 0; + JSCompiler_object_inline_stack_2318 = 0; } - JSCompiler_object_inline_stack_2311 = + JSCompiler_object_inline_stack_2318 = 0 !== - (JSCompiler_object_inline_stack_2311 & - (JSCompiler_object_inline_digest_2310.suspendedLanes | + (JSCompiler_object_inline_stack_2318 & + (JSCompiler_object_inline_digest_2317.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2311; + : JSCompiler_object_inline_stack_2318; if ( - 0 !== JSCompiler_object_inline_stack_2311 && - JSCompiler_object_inline_stack_2311 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2318 && + JSCompiler_object_inline_stack_2318 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2311), + ((prevState.retryLane = JSCompiler_object_inline_stack_2318), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2311 + JSCompiler_object_inline_stack_2318 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2310, + JSCompiler_object_inline_digest_2317, current, - JSCompiler_object_inline_stack_2311 + JSCompiler_object_inline_stack_2318 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2309.data === + JSCompiler_object_inline_message_2316.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -8992,7 +9011,7 @@ renderLanes ); } else - JSCompiler_object_inline_message_2309.data === + JSCompiler_object_inline_message_2316.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9000,12 +9019,12 @@ null, current )), - (JSCompiler_object_inline_message_2309._reactRetry = + (JSCompiler_object_inline_message_2316._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2309.nextSibling + JSCompiler_object_inline_message_2316.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9023,57 +9042,57 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2311.children + JSCompiler_object_inline_stack_2318.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2312) + if (JSCompiler_object_inline_componentStack_2319) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2312 = - JSCompiler_object_inline_stack_2311.fallback), - (JSCompiler_object_inline_message_2309 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2319 = + JSCompiler_object_inline_stack_2318.fallback), + (JSCompiler_object_inline_message_2316 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2311 = createWorkInProgress( + (JSCompiler_object_inline_stack_2318 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2311.children + children: JSCompiler_object_inline_stack_2318.children } )), - (JSCompiler_object_inline_stack_2311.subtreeFlags = + (JSCompiler_object_inline_stack_2318.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_componentStack_2312 = + ? (JSCompiler_object_inline_componentStack_2319 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2312 + JSCompiler_object_inline_componentStack_2319 )) - : ((JSCompiler_object_inline_componentStack_2312 = + : ((JSCompiler_object_inline_componentStack_2319 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2312, - JSCompiler_object_inline_message_2309, + JSCompiler_object_inline_componentStack_2319, + JSCompiler_object_inline_message_2316, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2312.flags |= 2)), - (JSCompiler_object_inline_componentStack_2312.return = + (JSCompiler_object_inline_componentStack_2319.flags |= 2)), + (JSCompiler_object_inline_componentStack_2319.return = workInProgress), - (JSCompiler_object_inline_stack_2311.return = workInProgress), - (JSCompiler_object_inline_stack_2311.sibling = - JSCompiler_object_inline_componentStack_2312), - (workInProgress.child = JSCompiler_object_inline_stack_2311), - (JSCompiler_object_inline_stack_2311 = - JSCompiler_object_inline_componentStack_2312), - (JSCompiler_object_inline_componentStack_2312 = workInProgress.child), - (JSCompiler_object_inline_message_2309 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2309 - ? (JSCompiler_object_inline_message_2309 = + (JSCompiler_object_inline_stack_2318.return = workInProgress), + (JSCompiler_object_inline_stack_2318.sibling = + JSCompiler_object_inline_componentStack_2319), + (workInProgress.child = JSCompiler_object_inline_stack_2318), + (JSCompiler_object_inline_stack_2318 = + JSCompiler_object_inline_componentStack_2319), + (JSCompiler_object_inline_componentStack_2319 = workInProgress.child), + (JSCompiler_object_inline_message_2316 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2316 + ? (JSCompiler_object_inline_message_2316 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2309.cachePool), + JSCompiler_object_inline_message_2316.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9081,37 +9100,37 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2309 = { + (JSCompiler_object_inline_message_2316 = { baseLanes: - JSCompiler_object_inline_message_2309.baseLanes | renderLanes, + JSCompiler_object_inline_message_2316.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2312.memoizedState = - JSCompiler_object_inline_message_2309), - (JSCompiler_object_inline_componentStack_2312.childLanes = + (JSCompiler_object_inline_componentStack_2319.memoizedState = + JSCompiler_object_inline_message_2316), + (JSCompiler_object_inline_componentStack_2319.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2310, + JSCompiler_object_inline_digest_2317, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2311 + JSCompiler_object_inline_stack_2318 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2311.children + children: JSCompiler_object_inline_stack_2318.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_digest_2310 = workInProgress.deletions), - null === JSCompiler_object_inline_digest_2310 + ((JSCompiler_object_inline_digest_2317 = workInProgress.deletions), + null === JSCompiler_object_inline_digest_2317 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_digest_2310.push(current)); + : JSCompiler_object_inline_digest_2317.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -13430,20 +13449,34 @@ (resource.state.loading & Inserted) !== NotLoaded ) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if ( + ((workInProgress.flags |= 16777216), !preloadResource(resource)) + ) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -14240,7 +14273,8 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if ( @@ -14282,25 +14316,36 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root, lanes, forceSync) { if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (exitStatus === RootInProgress) break; - else if (exitStatus === RootDidNotComplete) - markRootSuspended(root, lanes, 0); + if (exitStatus === RootInProgress) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root, lanes, 0, !1); + break; + } else if (exitStatus === RootDidNotComplete) + markRootSuspended( + root, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root.current.alternate; if ( @@ -14365,11 +14410,11 @@ } if (exitStatus === RootFatalErrored) { prepareFreshStack(root, 0); - markRootSuspended(root, lanes, 0); + markRootSuspended(root, lanes, 0, !0); break; } a: { - renderWasConcurrent = root; + shouldTimeSlice = root; switch (exitStatus) { case RootInProgress: case RootFatalErrored: @@ -14377,9 +14422,10 @@ case RootSuspendedWithDelay: if ((lanes & 4194176) === lanes) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -14393,11 +14439,11 @@ default: throw Error("Unknown root exit status."); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if (null !== ReactSharedInternals.actQueue) commitRoot( - renderWasConcurrent, + shouldTimeSlice, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, @@ -14418,15 +14464,16 @@ 10 < exitStatus) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14445,7 +14492,7 @@ break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14489,11 +14536,8 @@ completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -14515,7 +14559,12 @@ completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended( + root, + lanes, + spawnedLane, + !didSkipSuspendedSiblings + ); return; } commitRoot( @@ -14565,19 +14614,22 @@ } return !0; } - function markRootSuspended(root, suspendedLanes, spawnedLane) { + function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree + ) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { var index = 31 - clz32(lanes), lane = 1 << index; - expirationTimes[index] = -1; + didAttemptEntireTree[index] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -14621,7 +14673,7 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = RootInProgress; workInProgressSuspendedRetryLanes = @@ -14659,12 +14711,7 @@ current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? SuspendedOnData - : SuspendedOnImmediate)) + (workInProgressSuspendedReason = SuspendedOnImmediate)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = SuspendedOnInstance)) @@ -14715,21 +14762,6 @@ ); } } - function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; - } function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -14742,16 +14774,22 @@ } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = RootSuspendedWithDelay; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } - function renderRootSync(root, lanes) { + function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(), @@ -14794,6 +14832,13 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + memoizedUpdaters = RootInProgress; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -14843,7 +14888,11 @@ workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS; prepareFreshStack(root, lanes); - } else checkIfRootIsPrerendering(root, lanes); + } else + workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + ); markRenderStarted(lanes); a: do try { @@ -15055,7 +15104,12 @@ stopProfilerTimerIfRunningAndRecordDuration(unitOfWork); return current; } - function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason + ) { resetContextDependencies(); resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -15089,9 +15143,25 @@ workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || suspendedReason === SuspendedOnError) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + suspendedReason === SuspendedOnData || + suspendedReason === SuspendedOnImmediate || + suspendedReason === SuspendedOnDeprecatedThrowPromise) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -15202,7 +15272,9 @@ transitions, didIncludeRenderPhaseUpdate, renderPriorityLevel, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -15235,7 +15307,9 @@ root, didIncludeRenderPhaseUpdate, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), @@ -15252,35 +15326,39 @@ })); commitStartTime = now(); transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactSharedInternals.T; - ReactSharedInternals.T = null; - spawnedLane = ReactDOMSharedInternals.p; - ReactDOMSharedInternals.p = DiscreteEventPriority; - var prevExecutionContext = executionContext; - executionContext |= CommitContext; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffects(root, finishedWork, didIncludeRenderPhaseUpdate); - restoreSelection(selectionInformation, root.containerInfo); - _enabled = !!eventsEnabled; - selectionInformation = eventsEnabled = null; - root.current = finishedWork; - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted( + 0 !== (finishedWork.subtreeFlags & 15990) || transitions + ? ((transitions = ReactSharedInternals.T), + (ReactSharedInternals.T = null), + (spawnedLane = ReactDOMSharedInternals.p), + (ReactDOMSharedInternals.p = DiscreteEventPriority), + (updatedLanes = executionContext), + (executionContext |= CommitContext), + commitBeforeMutationEffects(root, finishedWork), + commitMutationEffects( + root, + finishedWork, didIncludeRenderPhaseUpdate - ); - commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate); - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markLayoutEffectsStopped && - injectedProfilingHooks.markLayoutEffectsStopped(); - requestPaint(); - executionContext = prevExecutionContext; - ReactDOMSharedInternals.p = spawnedLane; - ReactSharedInternals.T = transitions; - } else root.current = finishedWork; + ), + restoreSelection(selectionInformation, root.containerInfo), + (_enabled = !!eventsEnabled), + (selectionInformation = eventsEnabled = null), + (root.current = finishedWork), + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markLayoutEffectsStarted && + injectedProfilingHooks.markLayoutEffectsStarted( + didIncludeRenderPhaseUpdate + ), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markLayoutEffectsStopped && + injectedProfilingHooks.markLayoutEffectsStopped(), + requestPaint(), + (executionContext = updatedLanes), + (ReactDOMSharedInternals.p = spawnedLane), + (ReactSharedInternals.T = transitions)) + : (root.current = finishedWork); (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), @@ -15798,43 +15876,45 @@ (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) - return ( - null !== pingedLanes && cancelCallback(pingedLanes), - (root.callbackPriority = 2), - (root.callbackNode = null), - 2 - ); - currentTime = suspendedLanes & -suspendedLanes; if ( - currentTime !== root.callbackPriority || - (null !== ReactSharedInternals.actQueue && - pingedLanes !== fakeActCallbackNode) - ) - cancelCallback(pingedLanes); - else return currentTime; - switch (lanesToEventPriority(suspendedLanes)) { - case DiscreteEventPriority: - case ContinuousEventPriority: - suspendedLanes = UserBlockingPriority; - break; - case DefaultEventPriority: - suspendedLanes = NormalPriority$1; - break; - case IdleEventPriority: - suspendedLanes = IdlePriority; - break; - default: - suspendedLanes = NormalPriority$1; - } - pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); - null !== ReactSharedInternals.actQueue - ? (ReactSharedInternals.actQueue.push(pingedLanes), - (suspendedLanes = fakeActCallbackNode)) - : (suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes)); - root.callbackPriority = currentTime; - root.callbackNode = suspendedLanes; - return currentTime; + 0 === (suspendedLanes & 3) || + checkIfRootIsPrerendering(root, suspendedLanes) + ) { + currentTime = suspendedLanes & -suspendedLanes; + if ( + currentTime !== root.callbackPriority || + (null !== ReactSharedInternals.actQueue && + pingedLanes !== fakeActCallbackNode) + ) + cancelCallback(pingedLanes); + else return currentTime; + switch (lanesToEventPriority(suspendedLanes)) { + case DiscreteEventPriority: + case ContinuousEventPriority: + suspendedLanes = UserBlockingPriority; + break; + case DefaultEventPriority: + suspendedLanes = NormalPriority$1; + break; + case IdleEventPriority: + suspendedLanes = IdlePriority; + break; + default: + suspendedLanes = NormalPriority$1; + } + pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); + null !== ReactSharedInternals.actQueue + ? (ReactSharedInternals.actQueue.push(pingedLanes), + (suspendedLanes = fakeActCallbackNode)) + : (suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes)); + root.callbackPriority = currentTime; + root.callbackNode = suspendedLanes; + return currentTime; + } + null !== pingedLanes && cancelCallback(pingedLanes); + root.callbackPriority = 2; + root.callbackNode = null; + return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; @@ -23860,6 +23940,7 @@ workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = RootInProgress, @@ -24438,11 +24519,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24479,11 +24560,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-380f5d67-20241113", + version: "19.0.0-rc-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-380f5d67-20241113" + reconcilerVersion: "19.0.0-rc-b01722d5-20241114" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -24627,7 +24708,7 @@ listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-rc-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; "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 718afc30a5827..882542ef45b5c 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 @@ -597,28 +597,40 @@ function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -692,7 +704,14 @@ function markRootUpdated$1(root, updateLane) { 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } -function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { +function markRootFinished( + root, + finishedLanes, + remainingLanes, + spawnedLane, + updatedLanes, + suspendedRetryLanes +) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -702,31 +721,36 @@ function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index$6 = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index$6; - finishedLanes[index$6] = 0; - expirationTimes[index$6] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$6]; + var index$7 = 31 - clz32(remainingLanes), + lane = 1 << index$7; + entanglements[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$6] = null, index$6 = 0; - index$6 < hiddenUpdatesForLane.length; - index$6++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$6]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -741,10 +765,10 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$7 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$7; - (lane & entangledLanes) | (root[index$7] & entangledLanes) && - (root[index$7] |= entangledLanes); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } @@ -894,8 +918,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$9 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$9 && "aria-" !== prefix$9) { + var prefix$10 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$10 && "aria-" !== prefix$10) { node.removeAttribute(name); return; } @@ -1228,15 +1252,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$15 in styles) - (styleName = styles[styleName$15]), - styles.hasOwnProperty(styleName$15) && - prevStyles[styleName$15] !== styleName && - setValueForStyle(node, styleName$15, styleName); - } else for (var styleName$16 in styles) - styles.hasOwnProperty(styleName$16) && - setValueForStyle(node, styleName$16, styles[styleName$16]); + (styleName = styles[styleName$16]), + styles.hasOwnProperty(styleName$16) && + prevStyles[styleName$16] !== styleName && + setValueForStyle(node, styleName$16, styleName); + } else + for (var styleName$17 in styles) + styles.hasOwnProperty(styleName$17) && + setValueForStyle(node, styleName$17, styles[styleName$17]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -1965,19 +1989,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$278; + var JSCompiler_inline_result$jscomp$283; if (canUseDOM) { - var isSupported$jscomp$inline_413 = "oninput" in document; - if (!isSupported$jscomp$inline_413) { - var element$jscomp$inline_414 = document.createElement("div"); - element$jscomp$inline_414.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_413 = - "function" === typeof element$jscomp$inline_414.oninput; + var isSupported$jscomp$inline_418 = "oninput" in document; + if (!isSupported$jscomp$inline_418) { + var element$jscomp$inline_419 = document.createElement("div"); + element$jscomp$inline_419.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_418 = + "function" === typeof element$jscomp$inline_419.oninput; } - JSCompiler_inline_result$jscomp$278 = isSupported$jscomp$inline_413; - } else JSCompiler_inline_result$jscomp$278 = !1; + JSCompiler_inline_result$jscomp$283 = isSupported$jscomp$inline_418; + } else JSCompiler_inline_result$jscomp$283 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$278 && + JSCompiler_inline_result$jscomp$283 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -3883,7 +3907,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$53 = !1; + didReadFromEntangledAsyncAction$54 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3904,11 +3928,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$53 = !0); + (didReadFromEntangledAsyncAction$54 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$53 = !0); + (didReadFromEntangledAsyncAction$54 = !0); continue; } else (updateLane = { @@ -3954,7 +3978,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$53 && + didReadFromEntangledAsyncAction$54 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4156,8 +4180,8 @@ function runActionStateAction(actionQueue, node) { try { (prevTransition = action(prevState, payload)), handleActionReturnValue(actionQueue, node, prevTransition); - } catch (error$59) { - onActionError(actionQueue, node, error$59); + } catch (error$60) { + onActionError(actionQueue, node, error$60); } } function handleActionReturnValue(actionQueue, node, returnValue) { @@ -4588,10 +4612,10 @@ function refreshCache(fiber) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$62 = enqueueUpdate(provider, fiber, lane); - null !== root$62 && - (scheduleUpdateOnFiber(root$62, provider, lane), - entangleTransitions(root$62, provider, lane)); + var root$63 = enqueueUpdate(provider, fiber, lane); + null !== root$63 && + (scheduleUpdateOnFiber(root$63, provider, lane), + entangleTransitions(root$63, provider, lane)); provider = { cache: createCache() }; fiber.payload = provider; return; @@ -5118,9 +5142,9 @@ function resolveClassComponentProps(Component, baseProps) { } if ((Component = Component.defaultProps)) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$66 in Component) - void 0 === newProps[propName$66] && - (newProps[propName$66] = Component[propName$66]); + for (var propName$67 in Component) + void 0 === newProps[propName$67] && + (newProps[propName$67] = Component[propName$67]); } return newProps; } @@ -5166,9 +5190,9 @@ function logUncaughtError(root, errorInfo) { try { var onUncaughtError = root.onUncaughtError; onUncaughtError(errorInfo.value, { componentStack: errorInfo.stack }); - } catch (e$67) { + } catch (e$68) { setTimeout(function () { - throw e$67; + throw e$68; }); } } @@ -5179,9 +5203,9 @@ function logCaughtError(root, boundary, errorInfo) { componentStack: errorInfo.stack, errorBoundary: 1 === boundary.tag ? boundary.stateNode : null }); - } catch (e$68) { + } catch (e$69) { setTimeout(function () { - throw e$68; + throw e$69; }); } } @@ -7571,8 +7595,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$111) { - captureCommitPhaseError(current, nearestMountedAncestor, error$111); + } catch (error$112) { + captureCommitPhaseError(current, nearestMountedAncestor, error$112); } else ref.current = null; } @@ -7706,7 +7730,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$19) { + } catch (e$20) { JSCompiler_temp = null; break a; } @@ -7868,11 +7892,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$110) { + } catch (error$111) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$110 + error$111 ); } } @@ -8026,7 +8050,7 @@ function commitDeletionEffectsOnFiber( safelyDetachRef(deletedFiber, nearestMountedAncestor); case 6: prevHostParentIsContainer = hostParent; - var prevHostParentIsContainer$118 = hostParentIsContainer; + var prevHostParentIsContainer$119 = hostParentIsContainer; hostParent = null; recursivelyTraverseDeletionEffects( finishedRoot, @@ -8034,7 +8058,7 @@ function commitDeletionEffectsOnFiber( deletedFiber ); hostParent = prevHostParentIsContainer; - hostParentIsContainer = prevHostParentIsContainer$118; + hostParentIsContainer = prevHostParentIsContainer$119; if (null !== hostParent) if (hostParentIsContainer) try { @@ -8667,21 +8691,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$112 = JSCompiler_inline_result.stateNode; + var parent$113 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$112, ""), + (setTextContent(parent$113, ""), (JSCompiler_inline_result.flags &= -33)); - var before$113 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$113, parent$112); + var before$114 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$114, parent$113); break; case 3: case 4: - var parent$114 = JSCompiler_inline_result.stateNode.containerInfo, - before$115 = getHostSibling(finishedWork); + var parent$115 = JSCompiler_inline_result.stateNode.containerInfo, + before$116 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$115, - parent$114 + before$116, + parent$115 ); break; default: @@ -9565,20 +9589,32 @@ function markUpdate(workInProgress) { function preloadResourceAndSuspendIfNeeded(workInProgress, resource) { if ("stylesheet" !== resource.type || 0 !== (resource.state.loading & 4)) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -9595,14 +9631,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$130 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$130 = lastTailNode), + for (var lastTailNode$131 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$131 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$130 + null === lastTailNode$131 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$130.sibling = null); + : (lastTailNode$131.sibling = null); } } function bubbleProperties(completedWork) { @@ -9612,19 +9648,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$131 = completedWork.child; null !== child$131; ) - (newChildLanes |= child$131.lanes | child$131.childLanes), - (subtreeFlags |= child$131.subtreeFlags & 31457280), - (subtreeFlags |= child$131.flags & 31457280), - (child$131.return = completedWork), - (child$131 = child$131.sibling); + for (var child$132 = completedWork.child; null !== child$132; ) + (newChildLanes |= child$132.lanes | child$132.childLanes), + (subtreeFlags |= child$132.subtreeFlags & 31457280), + (subtreeFlags |= child$132.flags & 31457280), + (child$132.return = completedWork), + (child$132 = child$132.sibling); else - for (child$131 = completedWork.child; null !== child$131; ) - (newChildLanes |= child$131.lanes | child$131.childLanes), - (subtreeFlags |= child$131.subtreeFlags), - (subtreeFlags |= child$131.flags), - (child$131.return = completedWork), - (child$131 = child$131.sibling); + for (child$132 = completedWork.child; null !== child$132; ) + (newChildLanes |= child$132.lanes | child$132.childLanes), + (subtreeFlags |= child$132.subtreeFlags), + (subtreeFlags |= child$132.flags), + (child$132.return = completedWork), + (child$132 = child$132.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -9901,11 +9937,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (type = newProps.alternate.memoizedState.cachePool.pool); - var cache$143 = null; + var cache$144 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$143 = newProps.memoizedState.cachePool.pool); - cache$143 !== type && (newProps.flags |= 2048); + (cache$144 = newProps.memoizedState.cachePool.pool); + cache$144 !== type && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -9930,8 +9966,8 @@ function completeWork(current, workInProgress, renderLanes) { type = workInProgress.memoizedState; if (null === type) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$143 = type.rendering; - if (null === cache$143) + cache$144 = type.rendering; + if (null === cache$144) if (newProps) cutOffTailIfNeeded(type, !1); else { if ( @@ -9939,11 +9975,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$143 = findFirstSuspended(current); - if (null !== cache$143) { + cache$144 = findFirstSuspended(current); + if (null !== cache$144) { workInProgress.flags |= 128; cutOffTailIfNeeded(type, !1); - current = cache$143.updateQueue; + current = cache$144.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -9968,7 +10004,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$143)), null !== current)) { + if (((current = findFirstSuspended(cache$144)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -9978,7 +10014,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !0), null === type.tail && "hidden" === type.tailMode && - !cache$143.alternate && + !cache$144.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -9991,13 +10027,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !1), (workInProgress.lanes = 4194304)); type.isBackwards - ? ((cache$143.sibling = workInProgress.child), - (workInProgress.child = cache$143)) + ? ((cache$144.sibling = workInProgress.child), + (workInProgress.child = cache$144)) : ((current = type.last), null !== current - ? (current.sibling = cache$143) - : (workInProgress.child = cache$143), - (type.last = cache$143)); + ? (current.sibling = cache$144) + : (workInProgress.child = cache$144), + (type.last = cache$144)); } if (null !== type.tail) return ( @@ -10171,6 +10207,7 @@ var DefaultAsyncDispatcher = { workInProgressSuspendedReason = 0, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, @@ -10221,7 +10258,8 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) @@ -10232,23 +10270,35 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root$jscomp$0.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root$jscomp$0, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root$jscomp$0, lanes) : renderRootSync(root$jscomp$0, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (0 === exitStatus) break; - else if (6 === exitStatus) markRootSuspended(root$jscomp$0, lanes, 0); + if (0 === exitStatus) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root$jscomp$0, lanes, 0, !1); + break; + } else if (6 === exitStatus) + markRootSuspended( + root$jscomp$0, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root$jscomp$0.current.alternate; if ( @@ -10308,11 +10358,11 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { } if (1 === exitStatus) { prepareFreshStack(root$jscomp$0, 0); - markRootSuspended(root$jscomp$0, lanes, 0); + markRootSuspended(root$jscomp$0, lanes, 0, !0); break; } a: { - renderWasConcurrent = root$jscomp$0; + shouldTimeSlice = root$jscomp$0; switch (exitStatus) { case 0: case 1: @@ -10320,9 +10370,10 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { case 4: if ((lanes & 4194176) === lanes) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -10336,23 +10387,24 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { default: throw Error(formatProdErrorMessage(329)); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if ( (lanes & 62914560) === lanes && - ((exitStatus = globalMostRecentFallbackTime + 300 - now()), - 10 < exitStatus) + ((renderWasConcurrent = globalMostRecentFallbackTime + 300 - now()), + 10 < renderWasConcurrent) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10366,12 +10418,12 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { -0, 0 ), - exitStatus + renderWasConcurrent ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10414,11 +10466,8 @@ function commitRootWhenReady( completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -10440,7 +10489,7 @@ function commitRootWhenReady( completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended(root, lanes, spawnedLane, !didSkipSuspendedSiblings); return; } commitRoot( @@ -10490,19 +10539,22 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes, spawnedLane) { +function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree +) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + didAttemptEntireTree[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -10546,7 +10598,7 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressSuspendedRetryLanes = workInProgressDeferredLane = @@ -10566,9 +10618,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$3 = 31 - clz32(allEntangledLanes), - lane = 1 << index$3; - lanes |= root[index$3]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -10580,12 +10632,7 @@ function handleThrow(root, thrownValue) { ReactSharedInternals.H = ContextOnlyDispatcher; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 2 - : 3)) + (workInProgressSuspendedReason = 3)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = 4)) @@ -10605,21 +10652,6 @@ function handleThrow(root, thrownValue) { createCapturedValueAtFiber(thrownValue, root.current) )); } -function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; -} function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -10632,16 +10664,22 @@ function pushAsyncDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } -function renderRootSync(root, lanes) { +function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= 2; var prevDispatcher = pushDispatcher(), @@ -10668,6 +10706,13 @@ function renderRootSync(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + exitStatus = 0; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -10679,8 +10724,8 @@ function renderRootSync(root, lanes) { workLoopSync(); exitStatus = workInProgressRootExitStatus; break; - } catch (thrownValue$159) { - handleThrow(root, thrownValue$159); + } catch (thrownValue$164) { + handleThrow(root, thrownValue$164); } while (1); lanes && root.shellSuspendCounter++; @@ -10706,7 +10751,10 @@ function renderRootConcurrent(root, lanes) { ? ((workInProgressTransitions = null), (workInProgressRootRenderTargetTime = now() + 500), prepareFreshStack(root, lanes)) - : checkIfRootIsPrerendering(root, lanes); + : (workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + )); a: do try { if (0 !== workInProgressSuspendedReason && null !== workInProgress) { @@ -10790,8 +10838,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$161) { - handleThrow(root, thrownValue$161); + } catch (thrownValue$166) { + handleThrow(root, thrownValue$166); } while (1); lastContextDependency = currentlyRenderingFiber = null; @@ -10849,7 +10897,12 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason +) { lastContextDependency = currentlyRenderingFiber = null; resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -10883,9 +10936,23 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || 1 === suspendedReason) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + 2 === suspendedReason || 3 === suspendedReason || 6 === suspendedReason) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -10980,7 +11047,9 @@ function commitRootImpl( transitions, didIncludeRenderPhaseUpdate, renderPriorityLevel, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -11000,7 +11069,9 @@ function commitRootImpl( root, didIncludeRenderPhaseUpdate, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), @@ -11016,25 +11087,25 @@ function commitRootImpl( return null; })); transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactSharedInternals.T; - ReactSharedInternals.T = null; - spawnedLane = ReactDOMSharedInternals.p; - ReactDOMSharedInternals.p = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - restoreSelection(selectionInformation, root.containerInfo); - _enabled = !!eventsEnabled; - selectionInformation = eventsEnabled = null; - root.current = finishedWork; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - requestPaint(); - executionContext = prevExecutionContext; - ReactDOMSharedInternals.p = spawnedLane; - ReactSharedInternals.T = transitions; - } else root.current = finishedWork; + 0 !== (finishedWork.subtreeFlags & 15990) || transitions + ? ((transitions = ReactSharedInternals.T), + (ReactSharedInternals.T = null), + (spawnedLane = ReactDOMSharedInternals.p), + (ReactDOMSharedInternals.p = 2), + (updatedLanes = executionContext), + (executionContext |= 4), + commitBeforeMutationEffects(root, finishedWork), + commitMutationEffectsOnFiber(finishedWork, root), + restoreSelection(selectionInformation, root.containerInfo), + (_enabled = !!eventsEnabled), + (selectionInformation = eventsEnabled = null), + (root.current = finishedWork), + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork), + requestPaint(), + (executionContext = updatedLanes), + (ReactDOMSharedInternals.p = spawnedLane), + (ReactSharedInternals.T = transitions)) + : (root.current = finishedWork); rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), @@ -11072,7 +11143,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$165 = rootWithPendingPassiveEffects, + var root$170 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11111,7 +11182,7 @@ function flushPassiveEffects() { } finally { (ReactDOMSharedInternals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$165, remainingLanes); + releaseRootPooledCache(root$170, remainingLanes); } } return !1; @@ -11254,14 +11325,14 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$167 = firstScheduledRoot; null !== root$167; ) { + for (var root$172 = firstScheduledRoot; null !== root$172; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { - var pendingLanes = root$167.pendingLanes; + var pendingLanes = root$172.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { - var suspendedLanes = root$167.suspendedLanes, - pingedLanes = root$167.pingedLanes; + var suspendedLanes = root$172.suspendedLanes, + pingedLanes = root$172.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= @@ -11275,18 +11346,18 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$167, JSCompiler_inline_result)); + performSyncWorkOnRoot(root$172, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( - root$167, - root$167 === workInProgressRoot ? JSCompiler_inline_result : 0 + root$172, + root$172 === workInProgressRoot ? JSCompiler_inline_result : 0 )), 0 === (JSCompiler_inline_result & 3) || - checkIfRootIsPrerendering(root$167, JSCompiler_inline_result) || + checkIfRootIsPrerendering(root$172, JSCompiler_inline_result) || ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$167, JSCompiler_inline_result)); - root$167 = root$167.next; + performSyncWorkOnRoot(root$172, JSCompiler_inline_result)); + root$172 = root$172.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -11327,12 +11398,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4, - expirationTime = expirationTimes[index$4]; + var index$5 = 31 - clz32(lanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$4] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -11355,37 +11426,37 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) - return ( - null !== pingedLanes && - null !== pingedLanes && - cancelCallback$1(pingedLanes), - (root.callbackPriority = 2), - (root.callbackNode = null), - 2 - ); - currentTime = suspendedLanes & -suspendedLanes; - if (currentTime === root.callbackPriority) return currentTime; - null !== pingedLanes && cancelCallback$1(pingedLanes); - switch (lanesToEventPriority(suspendedLanes)) { - case 2: - case 8: - suspendedLanes = UserBlockingPriority; - break; - case 32: - suspendedLanes = NormalPriority$1; - break; - case 268435456: - suspendedLanes = IdlePriority; - break; - default: - suspendedLanes = NormalPriority$1; - } - pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); - suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); - root.callbackPriority = currentTime; - root.callbackNode = suspendedLanes; - return currentTime; + if ( + 0 === (suspendedLanes & 3) || + checkIfRootIsPrerendering(root, suspendedLanes) + ) { + currentTime = suspendedLanes & -suspendedLanes; + if (currentTime === root.callbackPriority) return currentTime; + null !== pingedLanes && cancelCallback$1(pingedLanes); + switch (lanesToEventPriority(suspendedLanes)) { + case 2: + case 8: + suspendedLanes = UserBlockingPriority; + break; + case 32: + suspendedLanes = NormalPriority$1; + break; + case 268435456: + suspendedLanes = IdlePriority; + break; + default: + suspendedLanes = NormalPriority$1; + } + pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); + suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); + root.callbackPriority = currentTime; + root.callbackNode = suspendedLanes; + return currentTime; + } + null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes); + root.callbackPriority = 2; + root.callbackNode = null; + return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { var originalCallbackNode = root.callbackNode; @@ -11514,20 +11585,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1430 = 0; - i$jscomp$inline_1430 < simpleEventPluginEvents.length; - i$jscomp$inline_1430++ + var i$jscomp$inline_1439 = 0; + i$jscomp$inline_1439 < simpleEventPluginEvents.length; + i$jscomp$inline_1439++ ) { - var eventName$jscomp$inline_1431 = - simpleEventPluginEvents[i$jscomp$inline_1430], - domEventName$jscomp$inline_1432 = - eventName$jscomp$inline_1431.toLowerCase(), - capitalizedEvent$jscomp$inline_1433 = - eventName$jscomp$inline_1431[0].toUpperCase() + - eventName$jscomp$inline_1431.slice(1); + var eventName$jscomp$inline_1440 = + simpleEventPluginEvents[i$jscomp$inline_1439], + domEventName$jscomp$inline_1441 = + eventName$jscomp$inline_1440.toLowerCase(), + capitalizedEvent$jscomp$inline_1442 = + eventName$jscomp$inline_1440[0].toUpperCase() + + eventName$jscomp$inline_1440.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1432, - "on" + capitalizedEvent$jscomp$inline_1433 + domEventName$jscomp$inline_1441, + "on" + capitalizedEvent$jscomp$inline_1442 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -12710,34 +12781,34 @@ function setInitialProperties(domElement, tag, props) { defaultChecked = null; for (hasSrc in props) if (props.hasOwnProperty(hasSrc)) { - var propValue$181 = props[hasSrc]; - if (null != propValue$181) + var propValue$186 = props[hasSrc]; + if (null != propValue$186) switch (hasSrc) { case "name": - hasSrcSet = propValue$181; + hasSrcSet = propValue$186; break; case "type": - propValue = propValue$181; + propValue = propValue$186; break; case "checked": - checked = propValue$181; + checked = propValue$186; break; case "defaultChecked": - defaultChecked = propValue$181; + defaultChecked = propValue$186; break; case "value": - propKey = propValue$181; + propKey = propValue$186; break; case "defaultValue": - defaultValue = propValue$181; + defaultValue = propValue$186; break; case "children": case "dangerouslySetInnerHTML": - if (null != propValue$181) + if (null != propValue$186) throw Error(formatProdErrorMessage(137, tag)); break; default: - setProp(domElement, tag, hasSrc, propValue$181, props, null); + setProp(domElement, tag, hasSrc, propValue$186, props, null); } } initInput( @@ -12874,14 +12945,14 @@ function setInitialProperties(domElement, tag, props) { return; default: if (isCustomElement(tag)) { - for (propValue$181 in props) - props.hasOwnProperty(propValue$181) && - ((hasSrc = props[propValue$181]), + for (propValue$186 in props) + props.hasOwnProperty(propValue$186) && + ((hasSrc = props[propValue$186]), void 0 !== hasSrc && setPropOnCustomElement( domElement, tag, - propValue$181, + propValue$186, hasSrc, props, void 0 @@ -12929,14 +13000,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$198 in nextProps) { - var propKey = nextProps[propKey$198]; - lastProp = lastProps[propKey$198]; + for (var propKey$203 in nextProps) { + var propKey = nextProps[propKey$203]; + lastProp = lastProps[propKey$203]; if ( - nextProps.hasOwnProperty(propKey$198) && + nextProps.hasOwnProperty(propKey$203) && (null != propKey || null != lastProp) ) - switch (propKey$198) { + switch (propKey$203) { case "type": type = propKey; break; @@ -12965,7 +13036,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$198, + propKey$203, propKey, nextProps, lastProp @@ -12984,7 +13055,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$198 = null; + propKey = value = defaultValue = propKey$203 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -13015,7 +13086,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$198 = type; + propKey$203 = type; break; case "defaultValue": defaultValue = type; @@ -13036,15 +13107,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$198 - ? updateOptions(domElement, !!lastProps, propKey$198, !1) + null != propKey$203 + ? updateOptions(domElement, !!lastProps, propKey$203, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$198 = null; + propKey = propKey$203 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -13068,7 +13139,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$198 = name; + propKey$203 = name; break; case "defaultValue": propKey = name; @@ -13082,17 +13153,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$198, propKey); + updateTextarea(domElement, propKey$203, propKey); return; case "option": - for (var propKey$214 in lastProps) + for (var propKey$219 in lastProps) if ( - ((propKey$198 = lastProps[propKey$214]), - lastProps.hasOwnProperty(propKey$214) && - null != propKey$198 && - !nextProps.hasOwnProperty(propKey$214)) + ((propKey$203 = lastProps[propKey$219]), + lastProps.hasOwnProperty(propKey$219) && + null != propKey$203 && + !nextProps.hasOwnProperty(propKey$219)) ) - switch (propKey$214) { + switch (propKey$219) { case "selected": domElement.selected = !1; break; @@ -13100,33 +13171,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$214, + propKey$219, null, nextProps, - propKey$198 + propKey$203 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$198 = nextProps[lastDefaultValue]), + ((propKey$203 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$198 !== propKey && - (null != propKey$198 || null != propKey)) + propKey$203 !== propKey && + (null != propKey$203 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$198 && - "function" !== typeof propKey$198 && - "symbol" !== typeof propKey$198; + propKey$203 && + "function" !== typeof propKey$203 && + "symbol" !== typeof propKey$203; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$198, + propKey$203, nextProps, propKey ); @@ -13147,24 +13218,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$219 in lastProps) - (propKey$198 = lastProps[propKey$219]), - lastProps.hasOwnProperty(propKey$219) && - null != propKey$198 && - !nextProps.hasOwnProperty(propKey$219) && - setProp(domElement, tag, propKey$219, null, nextProps, propKey$198); + for (var propKey$224 in lastProps) + (propKey$203 = lastProps[propKey$224]), + lastProps.hasOwnProperty(propKey$224) && + null != propKey$203 && + !nextProps.hasOwnProperty(propKey$224) && + setProp(domElement, tag, propKey$224, null, nextProps, propKey$203); for (checked in nextProps) if ( - ((propKey$198 = nextProps[checked]), + ((propKey$203 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$198 !== propKey && - (null != propKey$198 || null != propKey)) + propKey$203 !== propKey && + (null != propKey$203 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$198) + if (null != propKey$203) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -13172,7 +13243,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$198, + propKey$203, nextProps, propKey ); @@ -13180,49 +13251,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$224 in lastProps) - (propKey$198 = lastProps[propKey$224]), - lastProps.hasOwnProperty(propKey$224) && - void 0 !== propKey$198 && - !nextProps.hasOwnProperty(propKey$224) && + for (var propKey$229 in lastProps) + (propKey$203 = lastProps[propKey$229]), + lastProps.hasOwnProperty(propKey$229) && + void 0 !== propKey$203 && + !nextProps.hasOwnProperty(propKey$229) && setPropOnCustomElement( domElement, tag, - propKey$224, + propKey$229, void 0, nextProps, - propKey$198 + propKey$203 ); for (defaultChecked in nextProps) - (propKey$198 = nextProps[defaultChecked]), + (propKey$203 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$198 === propKey || - (void 0 === propKey$198 && void 0 === propKey) || + propKey$203 === propKey || + (void 0 === propKey$203 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$198, + propKey$203, nextProps, propKey ); return; } } - for (var propKey$229 in lastProps) - (propKey$198 = lastProps[propKey$229]), - lastProps.hasOwnProperty(propKey$229) && - null != propKey$198 && - !nextProps.hasOwnProperty(propKey$229) && - setProp(domElement, tag, propKey$229, null, nextProps, propKey$198); + for (var propKey$234 in lastProps) + (propKey$203 = lastProps[propKey$234]), + lastProps.hasOwnProperty(propKey$234) && + null != propKey$203 && + !nextProps.hasOwnProperty(propKey$234) && + setProp(domElement, tag, propKey$234, null, nextProps, propKey$203); for (lastProp in nextProps) - (propKey$198 = nextProps[lastProp]), + (propKey$203 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$198 === propKey || - (null == propKey$198 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$198, nextProps, propKey); + propKey$203 === propKey || + (null == propKey$203 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$203, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -13767,26 +13838,26 @@ function getResource(type, currentProps, pendingProps, currentResource) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$237 = getResourcesFromRoot( + var styles$242 = getResourcesFromRoot( JSCompiler_inline_result ).hoistableStyles, - resource$238 = styles$237.get(type); - resource$238 || + resource$243 = styles$242.get(type); + resource$243 || ((JSCompiler_inline_result = JSCompiler_inline_result.ownerDocument || JSCompiler_inline_result), - (resource$238 = { + (resource$243 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$237.set(type, resource$238), - (styles$237 = JSCompiler_inline_result.querySelector( + styles$242.set(type, resource$243), + (styles$242 = JSCompiler_inline_result.querySelector( getStylesheetSelectorFromKey(type) )) && - !styles$237._p && - ((resource$238.instance = styles$237), - (resource$238.state.loading = 5)), + !styles$242._p && + ((resource$243.instance = styles$242), + (resource$243.state.loading = 5)), preloadPropsMap.has(type) || ((pendingProps = { rel: "preload", @@ -13799,16 +13870,16 @@ function getResource(type, currentProps, pendingProps, currentResource) { referrerPolicy: pendingProps.referrerPolicy }), preloadPropsMap.set(type, pendingProps), - styles$237 || + styles$242 || preloadStylesheet( JSCompiler_inline_result, type, pendingProps, - resource$238.state + resource$243.state ))); if (currentProps && null === currentResource) throw Error(formatProdErrorMessage(528, "")); - return resource$238; + return resource$243; } if (currentProps && null !== currentResource) throw Error(formatProdErrorMessage(529, "")); @@ -13905,37 +13976,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$243 = hoistableRoot.querySelector( + var instance$248 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$243) + if (instance$248) return ( (resource.state.loading |= 4), - (resource.instance = instance$243), - markNodeAsHoistable(instance$243), - instance$243 + (resource.instance = instance$248), + markNodeAsHoistable(instance$248), + instance$248 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$243 = ( + instance$248 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$243); - var linkInstance = instance$243; + markNodeAsHoistable(instance$248); + var linkInstance = instance$248; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$243, "link", instance); + setInitialProperties(instance$248, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$243, props.precedence, hoistableRoot); - return (resource.instance = instance$243); + insertStylesheet(instance$248, props.precedence, hoistableRoot); + return (resource.instance = instance$248); case "script": - instance$243 = getScriptKey(props.src); + instance$248 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$243) + getScriptSelectorFromKey(instance$248) )) ) return ( @@ -13944,7 +14015,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$243))) + if ((styleProps = preloadPropsMap.get(instance$248))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -14968,16 +15039,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1677 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1686 = React.version; if ( - "19.0.0-rc-380f5d67-20241113" !== - isomorphicReactPackageVersion$jscomp$inline_1677 + "19.0.0-rc-b01722d5-20241114" !== + isomorphicReactPackageVersion$jscomp$inline_1686 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1677, - "19.0.0-rc-380f5d67-20241113" + isomorphicReactPackageVersion$jscomp$inline_1686, + "19.0.0-rc-b01722d5-20241114" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -14997,25 +15068,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2153 = { +var internals$jscomp$inline_2165 = { bundleType: 0, - version: "19.0.0-rc-380f5d67-20241113", + version: "19.0.0-rc-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-380f5d67-20241113" + reconcilerVersion: "19.0.0-rc-b01722d5-20241114" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2154 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2166 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2154.isDisabled && - hook$jscomp$inline_2154.supportsFiber + !hook$jscomp$inline_2166.isDisabled && + hook$jscomp$inline_2166.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2154.inject( - internals$jscomp$inline_2153 + (rendererID = hook$jscomp$inline_2166.inject( + internals$jscomp$inline_2165 )), - (injectedHook = hook$jscomp$inline_2154); + (injectedHook = hook$jscomp$inline_2166); } catch (err) {} } exports.createRoot = function (container, options) { @@ -15107,4 +15178,4 @@ exports.hydrateRoot = function (container, initialChildren, options) { listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-rc-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 440a2b1e39286..262ebcedb8cb4 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 @@ -1010,28 +1010,40 @@ var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -1116,7 +1128,9 @@ root, finishedLanes, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; @@ -1127,17 +1141,17 @@ root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index; - finishedLanes[index] = 0; + var index = 31 - clz32(remainingLanes), + lane = 1 << index; + entanglements[index] = 0; expirationTimes[index] = -1; var hiddenUpdatesForLane = hiddenUpdates[index]; if (null !== hiddenUpdatesForLane) @@ -1149,9 +1163,14 @@ var update = hiddenUpdatesForLane[index]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -8664,32 +8683,32 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2315; - var JSCompiler_object_inline_stack_2316 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2322; + var JSCompiler_object_inline_stack_2323 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2317 = !1; + var JSCompiler_object_inline_componentStack_2324 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2315 = didSuspend) || - (JSCompiler_object_inline_digest_2315 = + (JSCompiler_object_inline_digest_2322 = didSuspend) || + (JSCompiler_object_inline_digest_2322 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2315 && - ((JSCompiler_object_inline_componentStack_2317 = !0), + JSCompiler_object_inline_digest_2322 && + ((JSCompiler_object_inline_componentStack_2324 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2315 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2322 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2317 + JSCompiler_object_inline_componentStack_2324 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2314 = nextHydratableInstance; + var JSCompiler_object_inline_message_2321 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2314)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2321)) { c: { - var instance = JSCompiler_object_inline_message_2314; + var instance = JSCompiler_object_inline_message_2321; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8730,19 +8749,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2314 + JSCompiler_object_inline_message_2321 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2314 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2321 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2314 && - ((JSCompiler_object_inline_message_2314 = - JSCompiler_object_inline_message_2314.dehydrated), - null !== JSCompiler_object_inline_message_2314) + null !== JSCompiler_object_inline_message_2321 && + ((JSCompiler_object_inline_message_2321 = + JSCompiler_object_inline_message_2321.dehydrated), + null !== JSCompiler_object_inline_message_2321) ) return ( - JSCompiler_object_inline_message_2314.data === + JSCompiler_object_inline_message_2321.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -8750,58 +8769,58 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2314 = - JSCompiler_object_inline_stack_2316.children; - JSCompiler_object_inline_stack_2316 = - JSCompiler_object_inline_stack_2316.fallback; - if (JSCompiler_object_inline_componentStack_2317) + JSCompiler_object_inline_message_2321 = + JSCompiler_object_inline_stack_2323.children; + JSCompiler_object_inline_stack_2323 = + JSCompiler_object_inline_stack_2323.fallback; + if (JSCompiler_object_inline_componentStack_2324) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2317 = + (JSCompiler_object_inline_componentStack_2324 = workInProgress.mode), - (JSCompiler_object_inline_message_2314 = + (JSCompiler_object_inline_message_2321 = mountWorkInProgressOffscreenFiber( { mode: "hidden", - children: JSCompiler_object_inline_message_2314 + children: JSCompiler_object_inline_message_2321 }, - JSCompiler_object_inline_componentStack_2317 + JSCompiler_object_inline_componentStack_2324 )), - (JSCompiler_object_inline_stack_2316 = createFiberFromFragment( - JSCompiler_object_inline_stack_2316, - JSCompiler_object_inline_componentStack_2317, + (JSCompiler_object_inline_stack_2323 = createFiberFromFragment( + JSCompiler_object_inline_stack_2323, + JSCompiler_object_inline_componentStack_2324, renderLanes, null )), - (JSCompiler_object_inline_message_2314.return = workInProgress), - (JSCompiler_object_inline_stack_2316.return = workInProgress), - (JSCompiler_object_inline_message_2314.sibling = - JSCompiler_object_inline_stack_2316), - (workInProgress.child = JSCompiler_object_inline_message_2314), - (JSCompiler_object_inline_componentStack_2317 = + (JSCompiler_object_inline_message_2321.return = workInProgress), + (JSCompiler_object_inline_stack_2323.return = workInProgress), + (JSCompiler_object_inline_message_2321.sibling = + JSCompiler_object_inline_stack_2323), + (workInProgress.child = JSCompiler_object_inline_message_2321), + (JSCompiler_object_inline_componentStack_2324 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2317.memoizedState = + (JSCompiler_object_inline_componentStack_2324.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2317.childLanes = + (JSCompiler_object_inline_componentStack_2324.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2315, + JSCompiler_object_inline_digest_2322, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2323 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2314 + JSCompiler_object_inline_message_2321 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2314 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2314) + ((JSCompiler_object_inline_message_2321 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2321) ) { if (didSuspend) workInProgress.flags & 256 @@ -8818,95 +8837,95 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2317 = - JSCompiler_object_inline_stack_2316.fallback), - (JSCompiler_object_inline_message_2314 = workInProgress.mode), - (JSCompiler_object_inline_stack_2316 = + (JSCompiler_object_inline_componentStack_2324 = + JSCompiler_object_inline_stack_2323.fallback), + (JSCompiler_object_inline_message_2321 = workInProgress.mode), + (JSCompiler_object_inline_stack_2323 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2316.children + children: JSCompiler_object_inline_stack_2323.children }, - JSCompiler_object_inline_message_2314 + JSCompiler_object_inline_message_2321 )), - (JSCompiler_object_inline_componentStack_2317 = + (JSCompiler_object_inline_componentStack_2324 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2317, - JSCompiler_object_inline_message_2314, + JSCompiler_object_inline_componentStack_2324, + JSCompiler_object_inline_message_2321, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2317.flags |= 2), - (JSCompiler_object_inline_stack_2316.return = workInProgress), - (JSCompiler_object_inline_componentStack_2317.return = + (JSCompiler_object_inline_componentStack_2324.flags |= 2), + (JSCompiler_object_inline_stack_2323.return = workInProgress), + (JSCompiler_object_inline_componentStack_2324.return = workInProgress), - (JSCompiler_object_inline_stack_2316.sibling = - JSCompiler_object_inline_componentStack_2317), - (workInProgress.child = JSCompiler_object_inline_stack_2316), + (JSCompiler_object_inline_stack_2323.sibling = + JSCompiler_object_inline_componentStack_2324), + (workInProgress.child = JSCompiler_object_inline_stack_2323), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2316 = workInProgress.child), - (JSCompiler_object_inline_stack_2316.memoizedState = + (JSCompiler_object_inline_stack_2323 = workInProgress.child), + (JSCompiler_object_inline_stack_2323.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2316.childLanes = + (JSCompiler_object_inline_stack_2323.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2315, + JSCompiler_object_inline_digest_2322, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2317)); + JSCompiler_object_inline_componentStack_2324)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2314.data === + JSCompiler_object_inline_message_2321.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2315 = - JSCompiler_object_inline_message_2314.nextSibling && - JSCompiler_object_inline_message_2314.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2315) { - JSCompiler_temp = JSCompiler_object_inline_digest_2315.dgst; - var message = JSCompiler_object_inline_digest_2315.msg; - instance = JSCompiler_object_inline_digest_2315.stck; - var componentStack = JSCompiler_object_inline_digest_2315.cstck; + JSCompiler_object_inline_digest_2322 = + JSCompiler_object_inline_message_2321.nextSibling && + JSCompiler_object_inline_message_2321.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2322) { + JSCompiler_temp = JSCompiler_object_inline_digest_2322.dgst; + var message = JSCompiler_object_inline_digest_2322.msg; + instance = JSCompiler_object_inline_digest_2322.stck; + var componentStack = JSCompiler_object_inline_digest_2322.cstck; } - JSCompiler_object_inline_message_2314 = message; - JSCompiler_object_inline_digest_2315 = JSCompiler_temp; - JSCompiler_object_inline_stack_2316 = instance; - JSCompiler_temp = JSCompiler_object_inline_componentStack_2317 = + JSCompiler_object_inline_message_2321 = message; + JSCompiler_object_inline_digest_2322 = JSCompiler_temp; + JSCompiler_object_inline_stack_2323 = instance; + JSCompiler_temp = JSCompiler_object_inline_componentStack_2324 = componentStack; - JSCompiler_object_inline_componentStack_2317 = - JSCompiler_object_inline_message_2314 - ? Error(JSCompiler_object_inline_message_2314) + JSCompiler_object_inline_componentStack_2324 = + JSCompiler_object_inline_message_2321 + ? Error(JSCompiler_object_inline_message_2321) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_componentStack_2317.stack = - JSCompiler_object_inline_stack_2316 || ""; - JSCompiler_object_inline_componentStack_2317.digest = - JSCompiler_object_inline_digest_2315; - JSCompiler_object_inline_digest_2315 = + JSCompiler_object_inline_componentStack_2324.stack = + JSCompiler_object_inline_stack_2323 || ""; + JSCompiler_object_inline_componentStack_2324.digest = + JSCompiler_object_inline_digest_2322; + JSCompiler_object_inline_digest_2322 = void 0 === JSCompiler_temp ? null : JSCompiler_temp; - JSCompiler_object_inline_stack_2316 = { - value: JSCompiler_object_inline_componentStack_2317, + JSCompiler_object_inline_stack_2323 = { + value: JSCompiler_object_inline_componentStack_2324, source: null, - stack: JSCompiler_object_inline_digest_2315 + stack: JSCompiler_object_inline_digest_2322 }; - "string" === typeof JSCompiler_object_inline_digest_2315 && + "string" === typeof JSCompiler_object_inline_digest_2322 && CapturedStacks.set( - JSCompiler_object_inline_componentStack_2317, - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_componentStack_2324, + JSCompiler_object_inline_stack_2323 ); - queueHydrationError(JSCompiler_object_inline_stack_2316); + queueHydrationError(JSCompiler_object_inline_stack_2323); workInProgress = retrySuspenseComponentWithoutHydrating( current, workInProgress, @@ -8920,25 +8939,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_digest_2315 = + (JSCompiler_object_inline_digest_2322 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2315) + didReceiveUpdate || JSCompiler_object_inline_digest_2322) ) { - JSCompiler_object_inline_digest_2315 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2315) { - JSCompiler_object_inline_stack_2316 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2316 & 42)) - JSCompiler_object_inline_stack_2316 = 1; + JSCompiler_object_inline_digest_2322 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2322) { + JSCompiler_object_inline_stack_2323 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2323 & 42)) + JSCompiler_object_inline_stack_2323 = 1; else - switch (JSCompiler_object_inline_stack_2316) { + switch (JSCompiler_object_inline_stack_2323) { case 2: - JSCompiler_object_inline_stack_2316 = 1; + JSCompiler_object_inline_stack_2323 = 1; break; case 8: - JSCompiler_object_inline_stack_2316 = 4; + JSCompiler_object_inline_stack_2323 = 4; break; case 32: - JSCompiler_object_inline_stack_2316 = 16; + JSCompiler_object_inline_stack_2323 = 16; break; case 128: case 256: @@ -8959,40 +8978,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2316 = 64; + JSCompiler_object_inline_stack_2323 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2316 = 134217728; + JSCompiler_object_inline_stack_2323 = 134217728; break; default: - JSCompiler_object_inline_stack_2316 = 0; + JSCompiler_object_inline_stack_2323 = 0; } - JSCompiler_object_inline_stack_2316 = + JSCompiler_object_inline_stack_2323 = 0 !== - (JSCompiler_object_inline_stack_2316 & - (JSCompiler_object_inline_digest_2315.suspendedLanes | + (JSCompiler_object_inline_stack_2323 & + (JSCompiler_object_inline_digest_2322.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2316; + : JSCompiler_object_inline_stack_2323; if ( - 0 !== JSCompiler_object_inline_stack_2316 && - JSCompiler_object_inline_stack_2316 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2323 && + JSCompiler_object_inline_stack_2323 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2316), + ((prevState.retryLane = JSCompiler_object_inline_stack_2323), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2323 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2315, + JSCompiler_object_inline_digest_2322, current, - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2323 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2314.data === + JSCompiler_object_inline_message_2321.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9000,7 +9019,7 @@ renderLanes ); } else - JSCompiler_object_inline_message_2314.data === + JSCompiler_object_inline_message_2321.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9008,12 +9027,12 @@ null, current )), - (JSCompiler_object_inline_message_2314._reactRetry = + (JSCompiler_object_inline_message_2321._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2314.nextSibling + JSCompiler_object_inline_message_2321.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9031,57 +9050,57 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2316.children + JSCompiler_object_inline_stack_2323.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2317) + if (JSCompiler_object_inline_componentStack_2324) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2317 = - JSCompiler_object_inline_stack_2316.fallback), - (JSCompiler_object_inline_message_2314 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2324 = + JSCompiler_object_inline_stack_2323.fallback), + (JSCompiler_object_inline_message_2321 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2316 = createWorkInProgress( + (JSCompiler_object_inline_stack_2323 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2316.children + children: JSCompiler_object_inline_stack_2323.children } )), - (JSCompiler_object_inline_stack_2316.subtreeFlags = + (JSCompiler_object_inline_stack_2323.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_componentStack_2317 = + ? (JSCompiler_object_inline_componentStack_2324 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2317 + JSCompiler_object_inline_componentStack_2324 )) - : ((JSCompiler_object_inline_componentStack_2317 = + : ((JSCompiler_object_inline_componentStack_2324 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2317, - JSCompiler_object_inline_message_2314, + JSCompiler_object_inline_componentStack_2324, + JSCompiler_object_inline_message_2321, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2317.flags |= 2)), - (JSCompiler_object_inline_componentStack_2317.return = + (JSCompiler_object_inline_componentStack_2324.flags |= 2)), + (JSCompiler_object_inline_componentStack_2324.return = workInProgress), - (JSCompiler_object_inline_stack_2316.return = workInProgress), - (JSCompiler_object_inline_stack_2316.sibling = - JSCompiler_object_inline_componentStack_2317), - (workInProgress.child = JSCompiler_object_inline_stack_2316), - (JSCompiler_object_inline_stack_2316 = - JSCompiler_object_inline_componentStack_2317), - (JSCompiler_object_inline_componentStack_2317 = workInProgress.child), - (JSCompiler_object_inline_message_2314 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2314 - ? (JSCompiler_object_inline_message_2314 = + (JSCompiler_object_inline_stack_2323.return = workInProgress), + (JSCompiler_object_inline_stack_2323.sibling = + JSCompiler_object_inline_componentStack_2324), + (workInProgress.child = JSCompiler_object_inline_stack_2323), + (JSCompiler_object_inline_stack_2323 = + JSCompiler_object_inline_componentStack_2324), + (JSCompiler_object_inline_componentStack_2324 = workInProgress.child), + (JSCompiler_object_inline_message_2321 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2321 + ? (JSCompiler_object_inline_message_2321 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2314.cachePool), + JSCompiler_object_inline_message_2321.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9089,37 +9108,37 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2314 = { + (JSCompiler_object_inline_message_2321 = { baseLanes: - JSCompiler_object_inline_message_2314.baseLanes | renderLanes, + JSCompiler_object_inline_message_2321.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2317.memoizedState = - JSCompiler_object_inline_message_2314), - (JSCompiler_object_inline_componentStack_2317.childLanes = + (JSCompiler_object_inline_componentStack_2324.memoizedState = + JSCompiler_object_inline_message_2321), + (JSCompiler_object_inline_componentStack_2324.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2315, + JSCompiler_object_inline_digest_2322, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2323 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2316.children + children: JSCompiler_object_inline_stack_2323.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_digest_2315 = workInProgress.deletions), - null === JSCompiler_object_inline_digest_2315 + ((JSCompiler_object_inline_digest_2322 = workInProgress.deletions), + null === JSCompiler_object_inline_digest_2322 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_digest_2315.push(current)); + : JSCompiler_object_inline_digest_2322.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -13438,20 +13457,34 @@ (resource.state.loading & Inserted) !== NotLoaded ) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if ( + ((workInProgress.flags |= 16777216), !preloadResource(resource)) + ) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -14248,7 +14281,8 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if ( @@ -14290,25 +14324,36 @@ markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root, lanes, forceSync) { if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (exitStatus === RootInProgress) break; - else if (exitStatus === RootDidNotComplete) - markRootSuspended(root, lanes, 0); + if (exitStatus === RootInProgress) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root, lanes, 0, !1); + break; + } else if (exitStatus === RootDidNotComplete) + markRootSuspended( + root, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root.current.alternate; if ( @@ -14373,11 +14418,11 @@ } if (exitStatus === RootFatalErrored) { prepareFreshStack(root, 0); - markRootSuspended(root, lanes, 0); + markRootSuspended(root, lanes, 0, !0); break; } a: { - renderWasConcurrent = root; + shouldTimeSlice = root; switch (exitStatus) { case RootInProgress: case RootFatalErrored: @@ -14385,9 +14430,10 @@ case RootSuspendedWithDelay: if ((lanes & 4194176) === lanes) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -14401,11 +14447,11 @@ default: throw Error("Unknown root exit status."); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if (null !== ReactSharedInternals.actQueue) commitRoot( - renderWasConcurrent, + shouldTimeSlice, workInProgressRootRecoverableErrors, workInProgressTransitions, workInProgressRootDidIncludeRecursiveRenderUpdate, @@ -14426,15 +14472,16 @@ 10 < exitStatus) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14453,7 +14500,7 @@ break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -14497,11 +14544,8 @@ completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, @@ -14527,7 +14571,12 @@ completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended( + root, + lanes, + spawnedLane, + !didSkipSuspendedSiblings + ); return; } commitRoot( @@ -14577,19 +14626,22 @@ } return !0; } - function markRootSuspended(root, suspendedLanes, spawnedLane) { + function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree + ) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { var index = 31 - clz32(lanes), lane = 1 << index; - expirationTimes[index] = -1; + didAttemptEntireTree[index] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -14633,7 +14685,7 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = RootInProgress; workInProgressSuspendedRetryLanes = @@ -14671,12 +14723,7 @@ current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? SuspendedOnData - : SuspendedOnImmediate)) + (workInProgressSuspendedReason = SuspendedOnImmediate)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = SuspendedOnInstance)) @@ -14727,21 +14774,6 @@ ); } } - function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; - } function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -14754,16 +14786,22 @@ } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = RootSuspendedWithDelay; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } - function renderRootSync(root, lanes) { + function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= RenderContext; var prevDispatcher = pushDispatcher(), @@ -14806,6 +14844,13 @@ workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + memoizedUpdaters = RootInProgress; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -14855,7 +14900,11 @@ workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS; prepareFreshStack(root, lanes); - } else checkIfRootIsPrerendering(root, lanes); + } else + workInProgressRootIsPrerendering = checkIfRootIsPrerendering( + root, + lanes + ); markRenderStarted(lanes); a: do try { @@ -15067,7 +15116,12 @@ stopProfilerTimerIfRunningAndRecordDuration(unitOfWork); return current; } - function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason + ) { resetContextDependencies(); resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -15101,9 +15155,25 @@ workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || suspendedReason === SuspendedOnError) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + suspendedReason === SuspendedOnData || + suspendedReason === SuspendedOnImmediate || + suspendedReason === SuspendedOnDeprecatedThrowPromise) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -15214,7 +15284,9 @@ transitions, didIncludeRenderPhaseUpdate, renderPriorityLevel, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -15247,7 +15319,9 @@ root, didIncludeRenderPhaseUpdate, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), @@ -15264,35 +15338,39 @@ })); commitStartTime = now(); transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactSharedInternals.T; - ReactSharedInternals.T = null; - spawnedLane = ReactDOMSharedInternals.p; - ReactDOMSharedInternals.p = DiscreteEventPriority; - var prevExecutionContext = executionContext; - executionContext |= CommitContext; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffects(root, finishedWork, didIncludeRenderPhaseUpdate); - restoreSelection(selectionInformation, root.containerInfo); - _enabled = !!eventsEnabled; - selectionInformation = eventsEnabled = null; - root.current = finishedWork; - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted( + 0 !== (finishedWork.subtreeFlags & 15990) || transitions + ? ((transitions = ReactSharedInternals.T), + (ReactSharedInternals.T = null), + (spawnedLane = ReactDOMSharedInternals.p), + (ReactDOMSharedInternals.p = DiscreteEventPriority), + (updatedLanes = executionContext), + (executionContext |= CommitContext), + commitBeforeMutationEffects(root, finishedWork), + commitMutationEffects( + root, + finishedWork, didIncludeRenderPhaseUpdate - ); - commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate); - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markLayoutEffectsStopped && - injectedProfilingHooks.markLayoutEffectsStopped(); - requestPaint(); - executionContext = prevExecutionContext; - ReactDOMSharedInternals.p = spawnedLane; - ReactSharedInternals.T = transitions; - } else root.current = finishedWork; + ), + restoreSelection(selectionInformation, root.containerInfo), + (_enabled = !!eventsEnabled), + (selectionInformation = eventsEnabled = null), + (root.current = finishedWork), + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markLayoutEffectsStarted && + injectedProfilingHooks.markLayoutEffectsStarted( + didIncludeRenderPhaseUpdate + ), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markLayoutEffectsStopped && + injectedProfilingHooks.markLayoutEffectsStopped(), + requestPaint(), + (executionContext = updatedLanes), + (ReactDOMSharedInternals.p = spawnedLane), + (ReactSharedInternals.T = transitions)) + : (root.current = finishedWork); (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), @@ -15810,43 +15888,45 @@ (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) - return ( - null !== pingedLanes && cancelCallback(pingedLanes), - (root.callbackPriority = 2), - (root.callbackNode = null), - 2 - ); - currentTime = suspendedLanes & -suspendedLanes; if ( - currentTime !== root.callbackPriority || - (null !== ReactSharedInternals.actQueue && - pingedLanes !== fakeActCallbackNode) - ) - cancelCallback(pingedLanes); - else return currentTime; - switch (lanesToEventPriority(suspendedLanes)) { - case DiscreteEventPriority: - case ContinuousEventPriority: - suspendedLanes = UserBlockingPriority; - break; - case DefaultEventPriority: - suspendedLanes = NormalPriority$1; - break; - case IdleEventPriority: - suspendedLanes = IdlePriority; - break; - default: - suspendedLanes = NormalPriority$1; - } - pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); - null !== ReactSharedInternals.actQueue - ? (ReactSharedInternals.actQueue.push(pingedLanes), - (suspendedLanes = fakeActCallbackNode)) - : (suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes)); - root.callbackPriority = currentTime; - root.callbackNode = suspendedLanes; - return currentTime; + 0 === (suspendedLanes & 3) || + checkIfRootIsPrerendering(root, suspendedLanes) + ) { + currentTime = suspendedLanes & -suspendedLanes; + if ( + currentTime !== root.callbackPriority || + (null !== ReactSharedInternals.actQueue && + pingedLanes !== fakeActCallbackNode) + ) + cancelCallback(pingedLanes); + else return currentTime; + switch (lanesToEventPriority(suspendedLanes)) { + case DiscreteEventPriority: + case ContinuousEventPriority: + suspendedLanes = UserBlockingPriority; + break; + case DefaultEventPriority: + suspendedLanes = NormalPriority$1; + break; + case IdleEventPriority: + suspendedLanes = IdlePriority; + break; + default: + suspendedLanes = NormalPriority$1; + } + pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); + null !== ReactSharedInternals.actQueue + ? (ReactSharedInternals.actQueue.push(pingedLanes), + (suspendedLanes = fakeActCallbackNode)) + : (suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes)); + root.callbackPriority = currentTime; + root.callbackNode = suspendedLanes; + return currentTime; + } + null !== pingedLanes && cancelCallback(pingedLanes); + root.callbackPriority = 2; + root.callbackNode = null; + return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; @@ -23917,6 +23997,7 @@ workInProgressSuspendedReason = NotSuspended, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = RootInProgress, @@ -24495,11 +24576,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24536,11 +24617,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-380f5d67-20241113", + version: "19.0.0-rc-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-380f5d67-20241113" + reconcilerVersion: "19.0.0-rc-b01722d5-20241114" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25014,7 +25095,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; "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 8d7c6e8683596..eb52c05f5674f 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 @@ -666,28 +666,40 @@ function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, - suspendedLanes = root.suspendedLanes; - root = root.pingedLanes; + suspendedLanes = root.suspendedLanes, + pingedLanes = root.pingedLanes, + warmLanes = root.warmLanes; + root = 0 !== root.finishedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : ((root &= nonIdlePendingLanes), - 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) - : ((pendingLanes &= ~suspendedLanes), - 0 !== pendingLanes - ? (nextLanes = getHighestPriorityLanes(pendingLanes)) - : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); + : ((pingedLanes &= nonIdlePendingLanes), + 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = nonIdlePendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes))))) + : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), + 0 !== nonIdlePendingLanes + ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) + : 0 !== pingedLanes + ? (nextLanes = getHighestPriorityLanes(pingedLanes)) + : root || + ((warmLanes = pendingLanes & ~warmLanes), + 0 !== warmLanes && + (nextLanes = getHighestPriorityLanes(warmLanes)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), - (root = wipLanes & -wipLanes), - suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 4194176))) + (warmLanes = wipLanes & -wipLanes), + suspendedLanes >= warmLanes || + (32 === suspendedLanes && 0 !== (warmLanes & 4194176))) ? wipLanes : nextLanes; } @@ -761,7 +773,14 @@ function markRootUpdated$1(root, updateLane) { 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } -function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { +function markRootFinished( + root, + finishedLanes, + remainingLanes, + spawnedLane, + updatedLanes, + suspendedRetryLanes +) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -771,31 +790,36 @@ function markRootFinished(root, finishedLanes, remainingLanes, spawnedLane) { root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; - finishedLanes = root.entanglements; - var expirationTimes = root.expirationTimes, + var entanglements = root.entanglements, + expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { - var index$6 = 31 - clz32(remainingLanes); - previouslyPendingLanes = 1 << index$6; - finishedLanes[index$6] = 0; - expirationTimes[index$6] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$6]; + var index$7 = 31 - clz32(remainingLanes), + lane = 1 << index$7; + entanglements[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$6] = null, index$6 = 0; - index$6 < hiddenUpdatesForLane.length; - index$6++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$6]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } - remainingLanes &= ~previouslyPendingLanes; + remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + 0 !== suspendedRetryLanes && + 0 === updatedLanes && + 0 !== root.tag && + (root.suspendedLanes |= + suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; @@ -810,19 +834,19 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$7 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$7; - (lane & entangledLanes) | (root[index$7] & entangledLanes) && - (root[index$7] |= entangledLanes); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } function addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - root[index$9].add(fiber); + var index$10 = 31 - clz32(lanes), + lane = 1 << index$10; + root[index$10].add(fiber); lanes &= ~lane; } } @@ -834,16 +858,16 @@ function movePendingFibersToMemoized(root, lanes) { 0 < lanes; ) { - var index$10 = 31 - clz32(lanes); - root = 1 << index$10; - index$10 = pendingUpdatersLaneMap[index$10]; - 0 < index$10.size && - (index$10.forEach(function (fiber) { + var index$11 = 31 - clz32(lanes); + root = 1 << index$11; + index$11 = pendingUpdatersLaneMap[index$11]; + 0 < index$11.size && + (index$11.forEach(function (fiber) { var alternate = fiber.alternate; (null !== alternate && memoizedUpdaters.has(alternate)) || memoizedUpdaters.add(fiber); }), - index$10.clear()); + index$11.clear()); lanes &= ~root; } } @@ -993,8 +1017,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$11 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$11 && "aria-" !== prefix$11) { + var prefix$12 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$12 && "aria-" !== prefix$12) { node.removeAttribute(name); return; } @@ -1327,15 +1351,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$17 in styles) - (styleName = styles[styleName$17]), - styles.hasOwnProperty(styleName$17) && - prevStyles[styleName$17] !== styleName && - setValueForStyle(node, styleName$17, styleName); - } else for (var styleName$18 in styles) - styles.hasOwnProperty(styleName$18) && - setValueForStyle(node, styleName$18, styles[styleName$18]); + (styleName = styles[styleName$18]), + styles.hasOwnProperty(styleName$18) && + prevStyles[styleName$18] !== styleName && + setValueForStyle(node, styleName$18, styleName); + } else + for (var styleName$19 in styles) + styles.hasOwnProperty(styleName$19) && + setValueForStyle(node, styleName$19, styles[styleName$19]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -2064,19 +2088,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$294; + var JSCompiler_inline_result$jscomp$299; if (canUseDOM) { - var isSupported$jscomp$inline_430 = "oninput" in document; - if (!isSupported$jscomp$inline_430) { - var element$jscomp$inline_431 = document.createElement("div"); - element$jscomp$inline_431.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_430 = - "function" === typeof element$jscomp$inline_431.oninput; + var isSupported$jscomp$inline_435 = "oninput" in document; + if (!isSupported$jscomp$inline_435) { + var element$jscomp$inline_436 = document.createElement("div"); + element$jscomp$inline_436.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_435 = + "function" === typeof element$jscomp$inline_436.oninput; } - JSCompiler_inline_result$jscomp$294 = isSupported$jscomp$inline_430; - } else JSCompiler_inline_result$jscomp$294 = !1; + JSCompiler_inline_result$jscomp$299 = isSupported$jscomp$inline_435; + } else JSCompiler_inline_result$jscomp$299 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$294 && + JSCompiler_inline_result$jscomp$299 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -4036,7 +4060,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$55 = !1; + didReadFromEntangledAsyncAction$56 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -4057,11 +4081,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$55 = !0); + (didReadFromEntangledAsyncAction$56 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$55 = !0); + (didReadFromEntangledAsyncAction$56 = !0); continue; } else (updateLane = { @@ -4107,7 +4131,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$55 && + didReadFromEntangledAsyncAction$56 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4309,8 +4333,8 @@ function runActionStateAction(actionQueue, node) { try { (prevTransition = action(prevState, payload)), handleActionReturnValue(actionQueue, node, prevTransition); - } catch (error$61) { - onActionError(actionQueue, node, error$61); + } catch (error$62) { + onActionError(actionQueue, node, error$62); } } function handleActionReturnValue(actionQueue, node, returnValue) { @@ -4741,10 +4765,10 @@ function refreshCache(fiber) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$64 = enqueueUpdate(provider, fiber, lane); - null !== root$64 && - (scheduleUpdateOnFiber(root$64, provider, lane), - entangleTransitions(root$64, provider, lane)); + var root$65 = enqueueUpdate(provider, fiber, lane); + null !== root$65 && + (scheduleUpdateOnFiber(root$65, provider, lane), + entangleTransitions(root$65, provider, lane)); provider = { cache: createCache() }; fiber.payload = provider; return; @@ -5279,9 +5303,9 @@ function resolveClassComponentProps(Component, baseProps) { } if ((Component = Component.defaultProps)) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$68 in Component) - void 0 === newProps[propName$68] && - (newProps[propName$68] = Component[propName$68]); + for (var propName$69 in Component) + void 0 === newProps[propName$69] && + (newProps[propName$69] = Component[propName$69]); } return newProps; } @@ -5327,9 +5351,9 @@ function logUncaughtError(root, errorInfo) { try { var onUncaughtError = root.onUncaughtError; onUncaughtError(errorInfo.value, { componentStack: errorInfo.stack }); - } catch (e$69) { + } catch (e$70) { setTimeout(function () { - throw e$69; + throw e$70; }); } } @@ -5340,9 +5364,9 @@ function logCaughtError(root, boundary, errorInfo) { componentStack: errorInfo.stack, errorBoundary: 1 === boundary.tag ? boundary.stateNode : null }); - } catch (e$70) { + } catch (e$71) { setTimeout(function () { - throw e$70; + throw e$71; }); } } @@ -7825,8 +7849,8 @@ function safelyCallComponentWillUnmount( } else try { instance.componentWillUnmount(); - } catch (error$116) { - captureCommitPhaseError(current, nearestMountedAncestor, error$116); + } catch (error$117) { + captureCommitPhaseError(current, nearestMountedAncestor, error$117); } } function safelyAttachRef(current, nearestMountedAncestor) { @@ -7886,8 +7910,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordEffectDuration(current); } else ref(null); - } catch (error$117) { - captureCommitPhaseError(current, nearestMountedAncestor, error$117); + } catch (error$118) { + captureCommitPhaseError(current, nearestMountedAncestor, error$118); } else ref.current = null; } @@ -8056,7 +8080,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$21) { + } catch (e$22) { JSCompiler_temp = null; break a; } @@ -8212,11 +8236,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$113) { + } catch (error$114) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$113 + error$114 ); } else { @@ -8233,11 +8257,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$114) { + } catch (error$115) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$114 + error$115 ); } recordEffectDuration(); @@ -8248,11 +8272,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$115) { + } catch (error$116) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$115 + error$116 ); } } @@ -8419,7 +8443,7 @@ function commitDeletionEffectsOnFiber( safelyDetachRef(deletedFiber, nearestMountedAncestor); case 6: prevHostParentIsContainer = hostParent; - var prevHostParentIsContainer$125 = hostParentIsContainer; + var prevHostParentIsContainer$126 = hostParentIsContainer; hostParent = null; recursivelyTraverseDeletionEffects( finishedRoot, @@ -8427,7 +8451,7 @@ function commitDeletionEffectsOnFiber( deletedFiber ); hostParent = prevHostParentIsContainer; - hostParentIsContainer = prevHostParentIsContainer$125; + hostParentIsContainer = prevHostParentIsContainer$126; if (null !== hostParent) if (hostParentIsContainer) try { @@ -9075,21 +9099,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$118 = JSCompiler_inline_result.stateNode; + var parent$119 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$118, ""), + (setTextContent(parent$119, ""), (JSCompiler_inline_result.flags &= -33)); - var before$119 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$119, parent$118); + var before$120 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$120, parent$119); break; case 3: case 4: - var parent$120 = JSCompiler_inline_result.stateNode.containerInfo, - before$121 = getHostSibling(finishedWork); + var parent$121 = JSCompiler_inline_result.stateNode.containerInfo, + before$122 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$121, - parent$120 + before$122, + parent$121 ); break; default: @@ -10020,20 +10044,32 @@ function markUpdate(workInProgress) { function preloadResourceAndSuspendIfNeeded(workInProgress, resource) { if ("stylesheet" !== resource.type || 0 !== (resource.state.loading & 4)) workInProgress.flags &= -16777217; - else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) - if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192; - else + else if (((workInProgress.flags |= 16777216), !preloadResource(resource))) { + resource = suspenseHandlerStackCursor.current; + if ( + null !== resource && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + resource !== shellBoundary) + ) throw ( ((suspendedThenable = noopSuspenseyCommitThenable), SuspenseyCommitException) ); + workInProgress.flags |= 8192; + } } function scheduleRetryEffect(workInProgress, retryQueue) { null !== retryQueue && (workInProgress.flags |= 4); workInProgress.flags & 16384 && ((retryQueue = 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); + (workInProgress.lanes |= retryQueue), + (workInProgressSuspendedRetryLanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { if (!isHydrating) @@ -10050,14 +10086,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$140 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$140 = lastTailNode), + for (var lastTailNode$141 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$141 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$140 + null === lastTailNode$141 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$140.sibling = null); + : (lastTailNode$141.sibling = null); } } function bubbleProperties(completedWork) { @@ -10069,53 +10105,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$142 = completedWork.selfBaseDuration, - child$143 = completedWork.child; - null !== child$143; + var treeBaseDuration$143 = completedWork.selfBaseDuration, + child$144 = completedWork.child; + null !== child$144; ) - (newChildLanes |= child$143.lanes | child$143.childLanes), - (subtreeFlags |= child$143.subtreeFlags & 31457280), - (subtreeFlags |= child$143.flags & 31457280), - (treeBaseDuration$142 += child$143.treeBaseDuration), - (child$143 = child$143.sibling); - completedWork.treeBaseDuration = treeBaseDuration$142; + (newChildLanes |= child$144.lanes | child$144.childLanes), + (subtreeFlags |= child$144.subtreeFlags & 31457280), + (subtreeFlags |= child$144.flags & 31457280), + (treeBaseDuration$143 += child$144.treeBaseDuration), + (child$144 = child$144.sibling); + completedWork.treeBaseDuration = treeBaseDuration$143; } else for ( - treeBaseDuration$142 = completedWork.child; - null !== treeBaseDuration$142; + treeBaseDuration$143 = completedWork.child; + null !== treeBaseDuration$143; ) (newChildLanes |= - treeBaseDuration$142.lanes | treeBaseDuration$142.childLanes), - (subtreeFlags |= treeBaseDuration$142.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$142.flags & 31457280), - (treeBaseDuration$142.return = completedWork), - (treeBaseDuration$142 = treeBaseDuration$142.sibling); + treeBaseDuration$143.lanes | treeBaseDuration$143.childLanes), + (subtreeFlags |= treeBaseDuration$143.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$143.flags & 31457280), + (treeBaseDuration$143.return = completedWork), + (treeBaseDuration$143 = treeBaseDuration$143.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$142 = completedWork.actualDuration; - child$143 = completedWork.selfBaseDuration; + treeBaseDuration$143 = completedWork.actualDuration; + child$144 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$142 += child.actualDuration), - (child$143 += child.treeBaseDuration), + (treeBaseDuration$143 += child.actualDuration), + (child$144 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$142; - completedWork.treeBaseDuration = child$143; + completedWork.actualDuration = treeBaseDuration$143; + completedWork.treeBaseDuration = child$144; } else for ( - treeBaseDuration$142 = completedWork.child; - null !== treeBaseDuration$142; + treeBaseDuration$143 = completedWork.child; + null !== treeBaseDuration$143; ) (newChildLanes |= - treeBaseDuration$142.lanes | treeBaseDuration$142.childLanes), - (subtreeFlags |= treeBaseDuration$142.subtreeFlags), - (subtreeFlags |= treeBaseDuration$142.flags), - (treeBaseDuration$142.return = completedWork), - (treeBaseDuration$142 = treeBaseDuration$142.sibling); + treeBaseDuration$143.lanes | treeBaseDuration$143.childLanes), + (subtreeFlags |= treeBaseDuration$143.subtreeFlags), + (subtreeFlags |= treeBaseDuration$143.flags), + (treeBaseDuration$143.return = completedWork), + (treeBaseDuration$143 = treeBaseDuration$143.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -10408,11 +10444,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (type = newProps.alternate.memoizedState.cachePool.pool); - var cache$158 = null; + var cache$159 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$158 = newProps.memoizedState.cachePool.pool); - cache$158 !== type && (newProps.flags |= 2048); + (cache$159 = newProps.memoizedState.cachePool.pool); + cache$159 !== type && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -10442,8 +10478,8 @@ function completeWork(current, workInProgress, renderLanes) { type = workInProgress.memoizedState; if (null === type) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$158 = type.rendering; - if (null === cache$158) + cache$159 = type.rendering; + if (null === cache$159) if (newProps) cutOffTailIfNeeded(type, !1); else { if ( @@ -10451,11 +10487,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$158 = findFirstSuspended(current); - if (null !== cache$158) { + cache$159 = findFirstSuspended(current); + if (null !== cache$159) { workInProgress.flags |= 128; cutOffTailIfNeeded(type, !1); - current = cache$158.updateQueue; + current = cache$159.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -10480,7 +10516,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$158)), null !== current)) { + if (((current = findFirstSuspended(cache$159)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -10490,7 +10526,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !0), null === type.tail && "hidden" === type.tailMode && - !cache$158.alternate && + !cache$159.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -10503,13 +10539,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(type, !1), (workInProgress.lanes = 4194304)); type.isBackwards - ? ((cache$158.sibling = workInProgress.child), - (workInProgress.child = cache$158)) + ? ((cache$159.sibling = workInProgress.child), + (workInProgress.child = cache$159)) : ((current = type.last), null !== current - ? (current.sibling = cache$158) - : (workInProgress.child = cache$158), - (type.last = cache$158)); + ? (current.sibling = cache$159) + : (workInProgress.child = cache$159), + (type.last = cache$159)); } if (null !== type.tail) return ( @@ -10692,6 +10728,7 @@ var DefaultAsyncDispatcher = { workInProgressSuspendedReason = 0, workInProgressThrownValue = null, workInProgressRootDidSkipSuspendedSiblings = !1, + workInProgressRootIsPrerendering = !1, workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, @@ -10742,7 +10779,8 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) @@ -10754,23 +10792,35 @@ function scheduleUpdateOnFiber(root, fiber, lane) { markRootSuspended( root, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 )), ensureRootIsScheduled(root); } function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var exitStatus = (forceSync = + var shouldTimeSlice = (!forceSync && 0 === (lanes & 60) && 0 === (lanes & root$jscomp$0.expiredLanes)) || - !1) + checkIfRootIsPrerendering(root$jscomp$0, lanes), + exitStatus = shouldTimeSlice ? renderRootConcurrent(root$jscomp$0, lanes) : renderRootSync(root$jscomp$0, lanes, !0), - renderWasConcurrent = forceSync; + renderWasConcurrent = shouldTimeSlice; do { - if (0 === exitStatus) break; - else if (6 === exitStatus) markRootSuspended(root$jscomp$0, lanes, 0); + if (0 === exitStatus) { + workInProgressRootIsPrerendering && + !shouldTimeSlice && + markRootSuspended(root$jscomp$0, lanes, 0, !1); + break; + } else if (6 === exitStatus) + markRootSuspended( + root$jscomp$0, + lanes, + 0, + !workInProgressRootDidSkipSuspendedSiblings + ); else { forceSync = root$jscomp$0.current.alternate; if ( @@ -10830,11 +10880,11 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { } if (1 === exitStatus) { prepareFreshStack(root$jscomp$0, 0); - markRootSuspended(root$jscomp$0, lanes, 0); + markRootSuspended(root$jscomp$0, lanes, 0, !0); break; } a: { - renderWasConcurrent = root$jscomp$0; + shouldTimeSlice = root$jscomp$0; switch (exitStatus) { case 0: case 1: @@ -10842,9 +10892,10 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { case 4: if ((lanes & 4194176) === lanes) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); break a; } @@ -10858,23 +10909,24 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { default: throw Error(formatProdErrorMessage(329)); } - renderWasConcurrent.finishedWork = forceSync; - renderWasConcurrent.finishedLanes = lanes; + shouldTimeSlice.finishedWork = forceSync; + shouldTimeSlice.finishedLanes = lanes; if ( (lanes & 62914560) === lanes && - ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), - 10 < exitStatus) + ((renderWasConcurrent = globalMostRecentFallbackTime + 300 - now$1()), + 10 < renderWasConcurrent) ) { markRootSuspended( - renderWasConcurrent, + shouldTimeSlice, lanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !workInProgressRootDidSkipSuspendedSiblings ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( + if (0 !== getNextLanes(shouldTimeSlice, 0)) break a; + shouldTimeSlice.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( null, - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10888,12 +10940,12 @@ function performWorkOnRoot(root$jscomp$0, lanes, forceSync) { -0, 0 ), - exitStatus + renderWasConcurrent ); break a; } commitRootWhenReady( - renderWasConcurrent, + shouldTimeSlice, forceSync, workInProgressRootRecoverableErrors, workInProgressTransitions, @@ -10936,11 +10988,8 @@ function commitRootWhenReady( completedRenderStartTime, completedRenderEndTime ) { - didSkipSuspendedSiblings = finishedWork.subtreeFlags; - if ( - didSkipSuspendedSiblings & 8192 || - 16785408 === (didSkipSuspendedSiblings & 16785408) - ) + var subtreeFlags = finishedWork.subtreeFlags; + if (subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) if ( ((suspendedState = { stylesheets: null, count: 0, unsuspend: noop$1 }), accumulateSuspenseyCommitOnFiber(finishedWork), @@ -10962,7 +11011,7 @@ function commitRootWhenReady( completedRenderEndTime ) ); - markRootSuspended(root, lanes, spawnedLane); + markRootSuspended(root, lanes, spawnedLane, !didSkipSuspendedSiblings); return; } commitRoot( @@ -11012,19 +11061,22 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes, spawnedLane) { +function markRootSuspended( + root, + suspendedLanes, + spawnedLane, + didAttemptEntireTree +) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; + didAttemptEntireTree && (root.warmLanes |= suspendedLanes); + didAttemptEntireTree = root.expirationTimes; + for (var lanes = suspendedLanes; 0 < lanes; ) { + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + didAttemptEntireTree[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -11068,7 +11120,7 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidSkipSuspendedSiblings = !1; - checkIfRootIsPrerendering(root, lanes); + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); workInProgressRootDidAttachPingListener = !1; workInProgressSuspendedRetryLanes = workInProgressDeferredLane = @@ -11088,9 +11140,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$3 = 31 - clz32(allEntangledLanes), - lane = 1 << index$3; - lanes |= root[index$3]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -11102,12 +11154,7 @@ function handleThrow(root, thrownValue) { ReactSharedInternals.H = ContextOnlyDispatcher; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = - shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 2 - : 3)) + (workInProgressSuspendedReason = 3)) : thrownValue === SuspenseyCommitException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = 4)) @@ -11156,21 +11203,6 @@ function handleThrow(root, thrownValue) { ); } } -function shouldRemainOnPreviousScreen() { - var handler = suspenseHandlerStackCursor.current; - return null === handler - ? !0 - : (workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null === shellBoundary - ? !0 - : !1 - : (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 536870912) - ? handler === shellBoundary - : !1; -} function pushDispatcher() { var prevDispatcher = ReactSharedInternals.H; ReactSharedInternals.H = ContextOnlyDispatcher; @@ -11183,16 +11215,22 @@ function pushAsyncDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; + workInProgressRootDidSkipSuspendedSiblings || + ((workInProgressRootRenderLanes & 4194176) !== + workInProgressRootRenderLanes && + null !== suspenseHandlerStackCursor.current) || + (workInProgressRootIsPrerendering = !0); (0 === (workInProgressRootSkippedLanes & 134217727) && 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || null === workInProgressRoot || markRootSuspended( workInProgressRoot, workInProgressRootRenderLanes, - workInProgressDeferredLane + workInProgressDeferredLane, + !1 ); } -function renderRootSync(root, lanes) { +function renderRootSync(root, lanes, shouldYieldForPrerendering) { var prevExecutionContext = executionContext; executionContext |= 2; var prevDispatcher = pushDispatcher(), @@ -11229,6 +11267,13 @@ function renderRootSync(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; throwAndUnwindWorkLoop(root, unitOfWork, thrownValue, reason); + if ( + shouldYieldForPrerendering && + workInProgressRootIsPrerendering + ) { + memoizedUpdaters = 0; + break a; + } break; default: (reason = workInProgressSuspendedReason), @@ -11240,8 +11285,8 @@ function renderRootSync(root, lanes) { workLoopSync(); memoizedUpdaters = workInProgressRootExitStatus; break; - } catch (thrownValue$174) { - handleThrow(root, thrownValue$174); + } catch (thrownValue$179) { + handleThrow(root, thrownValue$179); } while (1); lanes && root.shellSuspendCounter++; @@ -11275,7 +11320,8 @@ function renderRootConcurrent(root, lanes) { workInProgressTransitions = null; workInProgressRootRenderTargetTime = now$1() + 500; prepareFreshStack(root, lanes); - } else checkIfRootIsPrerendering(root, lanes); + } else + workInProgressRootIsPrerendering = checkIfRootIsPrerendering(root, lanes); markRenderStarted(lanes); a: do try { @@ -11361,8 +11407,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$176) { - handleThrow(root, thrownValue$176); + } catch (thrownValue$181) { + handleThrow(root, thrownValue$181); } while (1); lastContextDependency = currentlyRenderingFiber = null; @@ -11438,7 +11484,12 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop( + root, + unitOfWork, + thrownValue, + suspendedReason +) { lastContextDependency = currentlyRenderingFiber = null; resetHooksOnUnwind(unitOfWork); thenableState$1 = null; @@ -11472,9 +11523,23 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { workInProgress = null; return; } - unitOfWork.flags & 32768 - ? unwindUnitOfWork(unitOfWork, !0) - : completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & 32768) { + if (isHydrating || 1 === suspendedReason) root = !0; + else if ( + workInProgressRootIsPrerendering || + 0 !== (workInProgressRootRenderLanes & 536870912) + ) + root = !1; + else if ( + ((workInProgressRootDidSkipSuspendedSiblings = root = !0), + 2 === suspendedReason || 3 === suspendedReason || 6 === suspendedReason) + ) + (suspendedReason = suspenseHandlerStackCursor.current), + null !== suspendedReason && + 13 === suspendedReason.tag && + (suspendedReason.flags |= 16384); + unwindUnitOfWork(unitOfWork, root); + } else completeUnitOfWork(unitOfWork); } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; @@ -11576,7 +11641,9 @@ function commitRootImpl( transitions, didIncludeRenderPhaseUpdate, renderPriorityLevel, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -11599,7 +11666,9 @@ function commitRootImpl( root, didIncludeRenderPhaseUpdate, remainingLanes, - spawnedLane + spawnedLane, + updatedLanes, + suspendedRetryLanes ); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), @@ -11616,33 +11685,33 @@ function commitRootImpl( })); commitStartTime = now(); transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactSharedInternals.T; - ReactSharedInternals.T = null; - spawnedLane = ReactDOMSharedInternals.p; - ReactDOMSharedInternals.p = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffects(root, finishedWork, didIncludeRenderPhaseUpdate); - restoreSelection(selectionInformation, root.containerInfo); - _enabled = !!eventsEnabled; - selectionInformation = eventsEnabled = null; - root.current = finishedWork; - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted( - didIncludeRenderPhaseUpdate - ); - commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate); - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && - injectedProfilingHooks.markLayoutEffectsStopped(); - requestPaint(); - executionContext = prevExecutionContext; - ReactDOMSharedInternals.p = spawnedLane; - ReactSharedInternals.T = transitions; - } else root.current = finishedWork; + 0 !== (finishedWork.subtreeFlags & 15990) || transitions + ? ((transitions = ReactSharedInternals.T), + (ReactSharedInternals.T = null), + (spawnedLane = ReactDOMSharedInternals.p), + (ReactDOMSharedInternals.p = 2), + (updatedLanes = executionContext), + (executionContext |= 4), + commitBeforeMutationEffects(root, finishedWork), + commitMutationEffects(root, finishedWork, didIncludeRenderPhaseUpdate), + restoreSelection(selectionInformation, root.containerInfo), + (_enabled = !!eventsEnabled), + (selectionInformation = eventsEnabled = null), + (root.current = finishedWork), + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && + injectedProfilingHooks.markLayoutEffectsStarted( + didIncludeRenderPhaseUpdate + ), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && + injectedProfilingHooks.markLayoutEffectsStopped(), + requestPaint(), + (executionContext = updatedLanes), + (ReactDOMSharedInternals.p = spawnedLane), + (ReactSharedInternals.T = transitions)) + : (root.current = finishedWork); rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), @@ -11683,7 +11752,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$180 = rootWithPendingPassiveEffects, + var root$185 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11733,7 +11802,7 @@ function flushPassiveEffects() { } finally { (ReactDOMSharedInternals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$180, remainingLanes); + releaseRootPooledCache(root$185, remainingLanes); } } return !1; @@ -11883,14 +11952,14 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$182 = firstScheduledRoot; null !== root$182; ) { + for (var root$187 = firstScheduledRoot; null !== root$187; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { - var pendingLanes = root$182.pendingLanes; + var pendingLanes = root$187.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { - var suspendedLanes = root$182.suspendedLanes, - pingedLanes = root$182.pingedLanes; + var suspendedLanes = root$187.suspendedLanes, + pingedLanes = root$187.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= @@ -11904,18 +11973,18 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$182, JSCompiler_inline_result)); + performSyncWorkOnRoot(root$187, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( - root$182, - root$182 === workInProgressRoot ? JSCompiler_inline_result : 0 + root$187, + root$187 === workInProgressRoot ? JSCompiler_inline_result : 0 )), 0 === (JSCompiler_inline_result & 3) || - checkIfRootIsPrerendering(root$182, JSCompiler_inline_result) || + checkIfRootIsPrerendering(root$187, JSCompiler_inline_result) || ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$182, JSCompiler_inline_result)); - root$182 = root$182.next; + performSyncWorkOnRoot(root$187, JSCompiler_inline_result)); + root$187 = root$187.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -11956,12 +12025,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4, - expirationTime = expirationTimes[index$4]; + var index$5 = 31 - clz32(lanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$4] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -11984,37 +12053,37 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { (root.callbackNode = null), (root.callbackPriority = 0) ); - if (0 !== (suspendedLanes & 3)) - return ( - null !== pingedLanes && - null !== pingedLanes && - cancelCallback$1(pingedLanes), - (root.callbackPriority = 2), - (root.callbackNode = null), - 2 - ); - currentTime = suspendedLanes & -suspendedLanes; - if (currentTime === root.callbackPriority) return currentTime; - null !== pingedLanes && cancelCallback$1(pingedLanes); - switch (lanesToEventPriority(suspendedLanes)) { - case 2: - case 8: - suspendedLanes = UserBlockingPriority; - break; - case 32: - suspendedLanes = NormalPriority$1; - break; - case 268435456: - suspendedLanes = IdlePriority; - break; - default: - suspendedLanes = NormalPriority$1; - } - pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); - suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); - root.callbackPriority = currentTime; - root.callbackNode = suspendedLanes; - return currentTime; + if ( + 0 === (suspendedLanes & 3) || + checkIfRootIsPrerendering(root, suspendedLanes) + ) { + currentTime = suspendedLanes & -suspendedLanes; + if (currentTime === root.callbackPriority) return currentTime; + null !== pingedLanes && cancelCallback$1(pingedLanes); + switch (lanesToEventPriority(suspendedLanes)) { + case 2: + case 8: + suspendedLanes = UserBlockingPriority; + break; + case 32: + suspendedLanes = NormalPriority$1; + break; + case 268435456: + suspendedLanes = IdlePriority; + break; + default: + suspendedLanes = NormalPriority$1; + } + pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); + suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); + root.callbackPriority = currentTime; + root.callbackNode = suspendedLanes; + return currentTime; + } + null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes); + root.callbackPriority = 2; + root.callbackNode = null; + return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { nestedUpdateScheduled = currentUpdateIsNested = !1; @@ -12146,20 +12215,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1519 = 0; - i$jscomp$inline_1519 < simpleEventPluginEvents.length; - i$jscomp$inline_1519++ + var i$jscomp$inline_1528 = 0; + i$jscomp$inline_1528 < simpleEventPluginEvents.length; + i$jscomp$inline_1528++ ) { - var eventName$jscomp$inline_1520 = - simpleEventPluginEvents[i$jscomp$inline_1519], - domEventName$jscomp$inline_1521 = - eventName$jscomp$inline_1520.toLowerCase(), - capitalizedEvent$jscomp$inline_1522 = - eventName$jscomp$inline_1520[0].toUpperCase() + - eventName$jscomp$inline_1520.slice(1); + var eventName$jscomp$inline_1529 = + simpleEventPluginEvents[i$jscomp$inline_1528], + domEventName$jscomp$inline_1530 = + eventName$jscomp$inline_1529.toLowerCase(), + capitalizedEvent$jscomp$inline_1531 = + eventName$jscomp$inline_1529[0].toUpperCase() + + eventName$jscomp$inline_1529.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1521, - "on" + capitalizedEvent$jscomp$inline_1522 + domEventName$jscomp$inline_1530, + "on" + capitalizedEvent$jscomp$inline_1531 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -13342,34 +13411,34 @@ function setInitialProperties(domElement, tag, props) { defaultChecked = null; for (hasSrc in props) if (props.hasOwnProperty(hasSrc)) { - var propValue$196 = props[hasSrc]; - if (null != propValue$196) + var propValue$201 = props[hasSrc]; + if (null != propValue$201) switch (hasSrc) { case "name": - hasSrcSet = propValue$196; + hasSrcSet = propValue$201; break; case "type": - propValue = propValue$196; + propValue = propValue$201; break; case "checked": - checked = propValue$196; + checked = propValue$201; break; case "defaultChecked": - defaultChecked = propValue$196; + defaultChecked = propValue$201; break; case "value": - propKey = propValue$196; + propKey = propValue$201; break; case "defaultValue": - defaultValue = propValue$196; + defaultValue = propValue$201; break; case "children": case "dangerouslySetInnerHTML": - if (null != propValue$196) + if (null != propValue$201) throw Error(formatProdErrorMessage(137, tag)); break; default: - setProp(domElement, tag, hasSrc, propValue$196, props, null); + setProp(domElement, tag, hasSrc, propValue$201, props, null); } } initInput( @@ -13506,14 +13575,14 @@ function setInitialProperties(domElement, tag, props) { return; default: if (isCustomElement(tag)) { - for (propValue$196 in props) - props.hasOwnProperty(propValue$196) && - ((hasSrc = props[propValue$196]), + for (propValue$201 in props) + props.hasOwnProperty(propValue$201) && + ((hasSrc = props[propValue$201]), void 0 !== hasSrc && setPropOnCustomElement( domElement, tag, - propValue$196, + propValue$201, hasSrc, props, void 0 @@ -13561,14 +13630,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$213 in nextProps) { - var propKey = nextProps[propKey$213]; - lastProp = lastProps[propKey$213]; + for (var propKey$218 in nextProps) { + var propKey = nextProps[propKey$218]; + lastProp = lastProps[propKey$218]; if ( - nextProps.hasOwnProperty(propKey$213) && + nextProps.hasOwnProperty(propKey$218) && (null != propKey || null != lastProp) ) - switch (propKey$213) { + switch (propKey$218) { case "type": type = propKey; break; @@ -13597,7 +13666,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$213, + propKey$218, propKey, nextProps, lastProp @@ -13616,7 +13685,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$213 = null; + propKey = value = defaultValue = propKey$218 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -13647,7 +13716,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$213 = type; + propKey$218 = type; break; case "defaultValue": defaultValue = type; @@ -13668,15 +13737,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$213 - ? updateOptions(domElement, !!lastProps, propKey$213, !1) + null != propKey$218 + ? updateOptions(domElement, !!lastProps, propKey$218, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$213 = null; + propKey = propKey$218 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -13700,7 +13769,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$213 = name; + propKey$218 = name; break; case "defaultValue": propKey = name; @@ -13714,17 +13783,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$213, propKey); + updateTextarea(domElement, propKey$218, propKey); return; case "option": - for (var propKey$229 in lastProps) + for (var propKey$234 in lastProps) if ( - ((propKey$213 = lastProps[propKey$229]), - lastProps.hasOwnProperty(propKey$229) && - null != propKey$213 && - !nextProps.hasOwnProperty(propKey$229)) + ((propKey$218 = lastProps[propKey$234]), + lastProps.hasOwnProperty(propKey$234) && + null != propKey$218 && + !nextProps.hasOwnProperty(propKey$234)) ) - switch (propKey$229) { + switch (propKey$234) { case "selected": domElement.selected = !1; break; @@ -13732,33 +13801,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$229, + propKey$234, null, nextProps, - propKey$213 + propKey$218 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$213 = nextProps[lastDefaultValue]), + ((propKey$218 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$213 !== propKey && - (null != propKey$213 || null != propKey)) + propKey$218 !== propKey && + (null != propKey$218 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$213 && - "function" !== typeof propKey$213 && - "symbol" !== typeof propKey$213; + propKey$218 && + "function" !== typeof propKey$218 && + "symbol" !== typeof propKey$218; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$213, + propKey$218, nextProps, propKey ); @@ -13779,24 +13848,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$234 in lastProps) - (propKey$213 = lastProps[propKey$234]), - lastProps.hasOwnProperty(propKey$234) && - null != propKey$213 && - !nextProps.hasOwnProperty(propKey$234) && - setProp(domElement, tag, propKey$234, null, nextProps, propKey$213); + for (var propKey$239 in lastProps) + (propKey$218 = lastProps[propKey$239]), + lastProps.hasOwnProperty(propKey$239) && + null != propKey$218 && + !nextProps.hasOwnProperty(propKey$239) && + setProp(domElement, tag, propKey$239, null, nextProps, propKey$218); for (checked in nextProps) if ( - ((propKey$213 = nextProps[checked]), + ((propKey$218 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$213 !== propKey && - (null != propKey$213 || null != propKey)) + propKey$218 !== propKey && + (null != propKey$218 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$213) + if (null != propKey$218) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -13804,7 +13873,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$213, + propKey$218, nextProps, propKey ); @@ -13812,49 +13881,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$239 in lastProps) - (propKey$213 = lastProps[propKey$239]), - lastProps.hasOwnProperty(propKey$239) && - void 0 !== propKey$213 && - !nextProps.hasOwnProperty(propKey$239) && + for (var propKey$244 in lastProps) + (propKey$218 = lastProps[propKey$244]), + lastProps.hasOwnProperty(propKey$244) && + void 0 !== propKey$218 && + !nextProps.hasOwnProperty(propKey$244) && setPropOnCustomElement( domElement, tag, - propKey$239, + propKey$244, void 0, nextProps, - propKey$213 + propKey$218 ); for (defaultChecked in nextProps) - (propKey$213 = nextProps[defaultChecked]), + (propKey$218 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$213 === propKey || - (void 0 === propKey$213 && void 0 === propKey) || + propKey$218 === propKey || + (void 0 === propKey$218 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$213, + propKey$218, nextProps, propKey ); return; } } - for (var propKey$244 in lastProps) - (propKey$213 = lastProps[propKey$244]), - lastProps.hasOwnProperty(propKey$244) && - null != propKey$213 && - !nextProps.hasOwnProperty(propKey$244) && - setProp(domElement, tag, propKey$244, null, nextProps, propKey$213); + for (var propKey$249 in lastProps) + (propKey$218 = lastProps[propKey$249]), + lastProps.hasOwnProperty(propKey$249) && + null != propKey$218 && + !nextProps.hasOwnProperty(propKey$249) && + setProp(domElement, tag, propKey$249, null, nextProps, propKey$218); for (lastProp in nextProps) - (propKey$213 = nextProps[lastProp]), + (propKey$218 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$213 === propKey || - (null == propKey$213 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$213, nextProps, propKey); + propKey$218 === propKey || + (null == propKey$218 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$218, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -14399,26 +14468,26 @@ function getResource(type, currentProps, pendingProps, currentResource) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$252 = getResourcesFromRoot( + var styles$257 = getResourcesFromRoot( JSCompiler_inline_result ).hoistableStyles, - resource$253 = styles$252.get(type); - resource$253 || + resource$258 = styles$257.get(type); + resource$258 || ((JSCompiler_inline_result = JSCompiler_inline_result.ownerDocument || JSCompiler_inline_result), - (resource$253 = { + (resource$258 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$252.set(type, resource$253), - (styles$252 = JSCompiler_inline_result.querySelector( + styles$257.set(type, resource$258), + (styles$257 = JSCompiler_inline_result.querySelector( getStylesheetSelectorFromKey(type) )) && - !styles$252._p && - ((resource$253.instance = styles$252), - (resource$253.state.loading = 5)), + !styles$257._p && + ((resource$258.instance = styles$257), + (resource$258.state.loading = 5)), preloadPropsMap.has(type) || ((pendingProps = { rel: "preload", @@ -14431,16 +14500,16 @@ function getResource(type, currentProps, pendingProps, currentResource) { referrerPolicy: pendingProps.referrerPolicy }), preloadPropsMap.set(type, pendingProps), - styles$252 || + styles$257 || preloadStylesheet( JSCompiler_inline_result, type, pendingProps, - resource$253.state + resource$258.state ))); if (currentProps && null === currentResource) throw Error(formatProdErrorMessage(528, "")); - return resource$253; + return resource$258; } if (currentProps && null !== currentResource) throw Error(formatProdErrorMessage(529, "")); @@ -14537,37 +14606,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$258 = hoistableRoot.querySelector( + var instance$263 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$258) + if (instance$263) return ( (resource.state.loading |= 4), - (resource.instance = instance$258), - markNodeAsHoistable(instance$258), - instance$258 + (resource.instance = instance$263), + markNodeAsHoistable(instance$263), + instance$263 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$258 = ( + instance$263 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$258); - var linkInstance = instance$258; + markNodeAsHoistable(instance$263); + var linkInstance = instance$263; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$258, "link", instance); + setInitialProperties(instance$263, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$258, props.precedence, hoistableRoot); - return (resource.instance = instance$258); + insertStylesheet(instance$263, props.precedence, hoistableRoot); + return (resource.instance = instance$263); case "script": - instance$258 = getScriptKey(props.src); + instance$263 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$258) + getScriptSelectorFromKey(instance$263) )) ) return ( @@ -14576,7 +14645,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$258))) + if ((styleProps = preloadPropsMap.get(instance$263))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -15619,16 +15688,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1768 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1777 = React.version; if ( - "19.0.0-rc-380f5d67-20241113" !== - isomorphicReactPackageVersion$jscomp$inline_1768 + "19.0.0-rc-b01722d5-20241114" !== + isomorphicReactPackageVersion$jscomp$inline_1777 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1768, - "19.0.0-rc-380f5d67-20241113" + isomorphicReactPackageVersion$jscomp$inline_1777, + "19.0.0-rc-b01722d5-20241114" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15648,18 +15717,18 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_1775 = { +var internals$jscomp$inline_1784 = { bundleType: 0, - version: "19.0.0-rc-380f5d67-20241113", + version: "19.0.0-rc-b01722d5-20241114", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-380f5d67-20241113", + reconcilerVersion: "19.0.0-rc-b01722d5-20241114", getLaneLabelMap: function () { for ( - var map = new Map(), lane = 1, index$275 = 0; - 31 > index$275; - index$275++ + var map = new Map(), lane = 1, index$280 = 0; + 31 > index$280; + index$280++ ) { var label = getLabelForLane(lane); map.set(lane, label); @@ -15672,16 +15741,16 @@ var internals$jscomp$inline_1775 = { } }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2209 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2221 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2209.isDisabled && - hook$jscomp$inline_2209.supportsFiber + !hook$jscomp$inline_2221.isDisabled && + hook$jscomp$inline_2221.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2209.inject( - internals$jscomp$inline_1775 + (rendererID = hook$jscomp$inline_2221.inject( + internals$jscomp$inline_1784 )), - (injectedHook = hook$jscomp$inline_2209); + (injectedHook = hook$jscomp$inline_2221); } catch (err) {} } function noop() {} @@ -15934,7 +16003,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; "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 bade56f92210d..ab7c62ef63ce6 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-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; })(); 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 35c1e3bdd5f57..6386ecce63aa2 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-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 e62d0120385d2..11f7f8795905b 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-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; })(); 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 a717426ee8006..a7821670b1a0a 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-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 dafb139fcba59..452389a31dba6 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\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-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; })(); 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 20b8588abc6c0..12cb4daddd3fb 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-rc-380f5d67-20241113" + "19.0.0-rc-b01722d5-20241114" ) ); } @@ -6108,4 +6108,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 462122e717097..ba013c0a7de63 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-380f5d67-20241113" !== + "19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\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-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 e28ef05350c91..9fe2bca984f4b 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\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-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; })(); 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 e1f6d78595068..937b59f081109 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\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-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 441277c9351f2..7d3319ee45772 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -8845,5 +8845,5 @@ } }; }; - exports.version = "19.0.0-rc-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; })(); 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 4459735027314..f789c5b47f65f 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-380f5d67-20241113" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-b01722d5-20241114" !== 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-380f5d67-20241113\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-b01722d5-20241114\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6094,4 +6094,4 @@ exports.renderToPipeableStream = function (children, options) { } }; }; -exports.version = "19.0.0-rc-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 34a91ba81b0c9..d9ef5173a553c 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-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; "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 4b22a046b17da..bfc2ba1fef9fe 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-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 118f9b4c090c6..d3f3a46b47def 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-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; })(); 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 57aadd8f62f9f..ef1a0319cef6a 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-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; diff --git a/packages/next/src/compiled/react-dom/package.json b/packages/next/src/compiled/react-dom/package.json index 5a524951ba7d9..bffce0faa00c3 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-380f5d67-20241113" + "scheduler": "0.25.0-rc-b01722d5-20241114" }, "peerDependencies": { - "react": "19.0.0-rc-380f5d67-20241113" + "react": "19.0.0-rc-b01722d5-20241114" }, "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 6155e19274b05..f589246a4d09b 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.development.js @@ -1243,7 +1243,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-experimental-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; "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 892b8c849b206..7212572c88b7c 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.production.js @@ -566,4 +566,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-experimental-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; 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 56fd237d99f00..24663bf149d1e 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-380f5d67-20241113"; + exports.version = "19.0.0-experimental-b01722d5-20241114"; })(); 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 517187828a5be..fc7a88fb94d0a 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-380f5d67-20241113"; +exports.version = "19.0.0-experimental-b01722d5-20241114"; diff --git a/packages/next/src/compiled/react-is/package.json b/packages/next/src/compiled/react-is/package.json index c422774ef8075..272cef9a5d40e 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-380f5d67-20241113", + "version": "19.0.0-rc-b01722d5-20241114", "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 cf5a79786e421..a1dc4a9a0ccd8 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 @@ -2654,10 +2654,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113", + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 89e351500b8f9..d9cb247e4c7ea 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-380f5d67-20241113", - "react-dom": "0.0.0-experimental-380f5d67-20241113" + "react": "0.0.0-experimental-b01722d5-20241114", + "react-dom": "0.0.0-experimental-b01722d5-20241114" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js index e91b041ccd753..b8b2f79b29628 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 @@ -2450,10 +2450,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-380f5d67-20241113", + version: "19.0.0-rc-b01722d5-20241114", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-380f5d67-20241113", + reconcilerVersion: "19.0.0-rc-b01722d5-20241114", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 7afcb9239482c..74f81313c9fdf 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-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113" + "react": "19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js index 4a94cff9260bb..e9512e7a09ec1 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 @@ -2669,10 +2669,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-380f5d67-20241113", + version: "19.0.0-experimental-b01722d5-20241114", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-380f5d67-20241113", + reconcilerVersion: "19.0.0-experimental-b01722d5-20241114", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 81e3edc09eef2..f4a1e73848f92 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-380f5d67-20241113", - "react-dom": "0.0.0-experimental-380f5d67-20241113", + "react": "0.0.0-experimental-b01722d5-20241114", + "react-dom": "0.0.0-experimental-b01722d5-20241114", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js index 32e878c24c2e5..514ff8a2787cc 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 @@ -2465,10 +2465,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-380f5d67-20241113", + version: "19.0.0-rc-b01722d5-20241114", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-380f5d67-20241113", + reconcilerVersion: "19.0.0-rc-b01722d5-20241114", getCurrentComponentInfo: function () { return currentOwnerInDEV; } 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 ae35479a8a559..9db7789a98a3b 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-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113", + "react": "19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react/cjs/react.development.js b/packages/next/src/compiled/react/cjs/react.development.js index fea53e07d4f3e..5116ad57bd7e5 100644 --- a/packages/next/src/compiled/react/cjs/react.development.js +++ b/packages/next/src/compiled/react/cjs/react.development.js @@ -1070,6 +1070,11 @@ exports.Suspense = REACT_SUSPENSE_TYPE; exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals; + exports.__COMPILER_RUNTIME = { + c: function (size) { + return resolveDispatcher().useMemoCache(size); + } + }; exports.act = function (callback) { var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth; @@ -1513,7 +1518,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-rc-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; "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 6801286e2141a..eb8de31fcfd2a 100644 --- a/packages/next/src/compiled/react/cjs/react.production.js +++ b/packages/next/src/compiled/react/cjs/react.production.js @@ -357,6 +357,11 @@ exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE; exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals; +exports.__COMPILER_RUNTIME = { + c: function (size) { + return ReactSharedInternals.H.useMemoCache(size); + } +}; exports.act = function () { throw Error("act(...) is not supported in production builds of React."); }; @@ -535,4 +540,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-rc-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; 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 0196ff79bff46..b6df91692abe4 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-380f5d67-20241113"; + exports.version = "19.0.0-rc-b01722d5-20241114"; })(); 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 37bb4115425be..d8623333394a0 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-380f5d67-20241113"; +exports.version = "19.0.0-rc-b01722d5-20241114"; diff --git a/packages/next/src/compiled/unistore/unistore.js b/packages/next/src/compiled/unistore/unistore.js index f892d0c777eb0..d30a3c439531b 100644 --- a/packages/next/src/compiled/unistore/unistore.js +++ b/packages/next/src/compiled/unistore/unistore.js @@ -1 +1 @@ -(()=>{var t={166: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={392: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=18'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true @@ -10690,7 +10690,7 @@ packages: lucide-react@0.383.0: resolution: {integrity: sha512-13xlG0CQCJtzjSQYwwJ3WRqMHtRj3EXmLlorrARt7y+IHnxUCp3XyFNL1DfaGySWxHObDvnu1u1dV+0VMKHUSg==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} @@ -12904,28 +12904,28 @@ packages: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true - react-dom@0.0.0-experimental-380f5d67-20241113: - resolution: {integrity: sha512-1ok9k5rAF7YuTveNefkPOvZHHuh5RLnCc5DU7sT7IL3i2K+LZmlsbSdlylMevjt9OzovxWQdsk04Fd4GKVCBWg==} + react-dom@0.0.0-experimental-b01722d5-20241114: + resolution: {integrity: sha512-UdD47xg3Eg0yj5hvNeR+VLLLOa53VJJ1vBPXD9rXYBh1oEgLss4TIWIg6jYxC7o9WshgLG+VUABbpCRUPL317w==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 react-dom@17.0.2: resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 - react-dom@19.0.0-rc-380f5d67-20241113: - resolution: {integrity: sha512-jd/2ktaIZieYI76xBPAfEXFfg9XQE/GM++rbItliRJJ6pN205aS3JxGc7WAdm3SkaeIHLwK+V6d+FziVg7g5Eg==} + react-dom@19.0.0-rc-b01722d5-20241114: + resolution: {integrity: sha512-g72oEq/SDdCiaT8fN1lMptSD5bszHSwuQFYtYT39sVzD5CkzYeBJcjv3ParjNZfvWPhjfOL7f1Fe+OIJFupsxQ==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 react-dom@19.0.0-rc-f90a6bcc-20240827: resolution: {integrity: sha512-oUa/reDvGtjRcxi8u+GYHaDHanudaO28+G+Wvxm50CItW1xwIFN2Nn7foJxxDS9lFLGdRWZvjxldZEPAUSuXbg==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 - react-is@19.0.0-rc-380f5d67-20241113: - resolution: {integrity: sha512-DHJS/U7/NVJyV0OjPmiD8OJ/mAd6Xh7mwBLW7u/PRbEIPV1kV7vewaPR71LyhpvXGpUxDaYnWZsY3ZM6oPIXgw==} + react-is@19.0.0-rc-b01722d5-20241114: + resolution: {integrity: sha512-nR4blVGWugab7X2wN/FXLNKw1HWVK8lO9+rv0ip2xN5j6RNvXOV1PKtWOm2TuDzq52Nc6ASyno8FFy088ejsfA==} react-is@19.0.0-rc-f90a6bcc-20240827: resolution: {integrity: sha512-1tXoLFzVbqHAQeY3CwpyF5IYbkwgSoNHhrhS8qOrfiZIh2461h/C1BP/JVIxwyL51wHhUgLsAc/M8g0OcEhV1A==} @@ -12936,8 +12936,8 @@ packages: react-number-format@5.4.0: resolution: {integrity: sha512-NWdICrqLhI7rAS8yUeLVd6Wr4cN7UjJ9IBTS0f/a9i7UB4x4Ti70kGnksBtZ7o4Z7YRbvCMMR/jQmkoOBa/4fg==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 react-refresh@0.12.0: resolution: {integrity: sha512-suLIhrU2IHKL5JEKR/fAwJv7bbeq4kJ+pJopf77jHwuR+HmJS/HbrPIGsTBUVfw7tXPOmYv7UJ7PCaN49e8x4A==} @@ -12948,7 +12948,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true @@ -12958,58 +12958,58 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true - react-server-dom-turbopack@0.0.0-experimental-380f5d67-20241113: - resolution: {integrity: sha512-fZY113N949g2xiFUl2aNU2fiJ5QL5ruNjCIMobT/LLZyoj4KvMOpg5DhUXUEyXPlDQff09ebkbKlW65kOgw66Q==} + react-server-dom-turbopack@0.0.0-experimental-b01722d5-20241114: + resolution: {integrity: sha512-Gsbq454tZFROwqNKbWZg7oiyxrsnuW9m6dp98i3/U+opb5QPO01ts3keV99L93OQiTS6+drlpVJ2z+HhjfOQog==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 - react-server-dom-turbopack@19.0.0-rc-380f5d67-20241113: - resolution: {integrity: sha512-GJYcQ06/u48viEqxYMHNdiAFC/5UpSQATqx1OmmDXXMHQXy9jRYBazUtoyQV615G0c2uHyFTpnop+gNdK6Iq6A==} + react-server-dom-turbopack@19.0.0-rc-b01722d5-20241114: + resolution: {integrity: sha512-DAD0Ra9BN8j4lAJgXfQIz/Rx3WDEA/6zSqLt1bpJd5DplaGroq1CTFNG3neG23A8KCKM0lk0bp1p7pvSM6OSPQ==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 - react-server-dom-webpack@0.0.0-experimental-380f5d67-20241113: - resolution: {integrity: sha512-hUluisy+9Srvrju5yS+qBOIAX82E+MRYOmoTNbV0kUsTi964ZZFLBzuruASAyUbbP1OhtFl0DwBxYN+UT0yUFQ==} + react-server-dom-webpack@0.0.0-experimental-b01722d5-20241114: + resolution: {integrity: sha512-ZxCBnuLtKAbkpccnQW2mdZ/OAbMrSYBIKv1evoSELmLdn0IaCLnAcr3c1YHQMdoxvsO476RIFr8JpyF9Nd7YcA==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 webpack: 5.96.1 - react-server-dom-webpack@19.0.0-rc-380f5d67-20241113: - resolution: {integrity: sha512-sP9PM/DvFfv7ZBo50cd44WMvUCSEcag1eU1kZcAtfSs+pyTWO4HFzn/N1vPQTQ7HfG4Q4i0Nj298YTQFBls9PA==} + react-server-dom-webpack@19.0.0-rc-b01722d5-20241114: + resolution: {integrity: sha512-fxSd9DVwpSqSM/uqP0QlNWklYnHpMrSbeludGCbR7v9r2hfnpkJH2K1UqUNgBsbAsHvY33e5dbMN68HcBfQGHg==} engines: {node: '>=0.10.0'} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 webpack: 5.96.1 react-shallow-renderer@16.15.0: resolution: {integrity: sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 react-ssr-prepass@1.0.8: resolution: {integrity: sha512-O0gfRA1SaK+9ITKxqfnXsej2jF+OHGP/+GxD4unROQaM/0/UczGF9fuF+wTboxaQoKdIf4FvS3h/OigWh704VA==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-is: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-is: 19.0.0-rc-b01722d5-20241114 react-style-singleton@2.2.1: resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==} engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true @@ -13017,30 +13017,30 @@ packages: react-test-renderer@18.2.0: resolution: {integrity: sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 react-textarea-autosize@8.5.3: resolution: {integrity: sha512-XT1024o2pqCuZSuBt9FwHlaDeNtVrtCXu0Rnz88t1jUGheCLa3PhjE1GH8Ctm2axEtvdCl5SUHYschyQ0L5QHQ==} engines: {node: '>=10'} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 react-virtualized@9.22.3: resolution: {integrity: sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 - react@0.0.0-experimental-380f5d67-20241113: - resolution: {integrity: sha512-QquU1j1TmZR+KgGSFvWTlOuwLvGrA8ldUJean+gT0nYIhSJ1ZkdXJQFnFRWqxoc74C7SY1o4NMz0yJxpUBoQ2w==} + react@0.0.0-experimental-b01722d5-20241114: + resolution: {integrity: sha512-QrufoF9PdRu/I/8ciQJy8zaYUj2LsT4Mud3FR5zqQlyawzY0Vw1zXDSNQiA9N9rUWl8rq+CG8IyqqA1vIphdNA==} engines: {node: '>=0.10.0'} react@17.0.2: resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==} engines: {node: '>=0.10.0'} - react@19.0.0-rc-380f5d67-20241113: - resolution: {integrity: sha512-wtdbqto84bAgLqzfJpIpV6m9L5hUPVDb9vM/sGJ4K2z2PVf7t/OOG8xQFUSI6cEfQ1yN0X7qYfUchoVmbebW4g==} + react@19.0.0-rc-b01722d5-20241114: + resolution: {integrity: sha512-VT5vig/1unX2lH2RiEuQoKJkn/wnuQw7xwNndsVeVx7TQPQu+6GUjhBomhyZIW3M1bDgPGG5wEBgjNoIXYkeEQ==} engines: {node: '>=0.10.0'} react@19.0.0-rc-f90a6bcc-20240827: @@ -13564,11 +13564,11 @@ packages: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} - scheduler@0.0.0-experimental-380f5d67-20241113: - resolution: {integrity: sha512-UtSmlBSHar7hQvCXiozfIryfUFCL58+mqjrZONnLD06xdTlfgLrTcI5gS3Xo/RnNhUziLPV0DsinpI3a+q7Yzg==} + scheduler@0.0.0-experimental-b01722d5-20241114: + resolution: {integrity: sha512-tyiYxLy5j5cKbJO4E5s7CF7MCfOF0iHeAZw895JLeigcSUOOZDh0omf8AlvJrcICclobRxu1UIWnJCkjc93jWg==} - scheduler@0.25.0-rc-380f5d67-20241113: - resolution: {integrity: sha512-F0DjPvSUAj8+PgdujbWDg5qPu9d1+IiOLJKhvknnbk6H+53aqb+CwwAXgHqkjdPfVk81zFbPHaFjQEQReDzH8w==} + scheduler@0.25.0-rc-b01722d5-20241114: + resolution: {integrity: sha512-8QtAZX1GlxgaI7V9v4vevfGd/+WE8BmBxcizKr7VPZSRyAwd+9uFYj7TKtOBbc9/W0oyuNyOv6Tw8n44P1MjAA==} schema-utils@2.7.1: resolution: {integrity: sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==} @@ -14113,8 +14113,8 @@ packages: engines: {node: '>= 16'} peerDependencies: babel-plugin-styled-components: '>= 2' - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: babel-plugin-styled-components: optional: true @@ -14128,7 +14128,7 @@ packages: peerDependencies: '@babel/core': '*' babel-plugin-macros: '*' - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@babel/core': optional: true @@ -14205,7 +14205,7 @@ packages: swr@2.2.4: resolution: {integrity: sha512-njiZ/4RiIhoOlAaLYDqwz5qH/KZXVilRLvomrx83HjzCWTfa+InyfAjv05PSFxnmLzZkNO9ZfvgoqzAaEI4sGQ==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 symbol-observable@1.0.1: resolution: {integrity: sha512-Kb3PrPYz4HanVF1LVGuAdW6LoVgIwjUYJGzFe7NDrBLCN4lsV/5J0MFurV+ygS4bRVwrCEt2c7MQ1R2a72oJDw==} @@ -14923,7 +14923,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true @@ -14931,13 +14931,13 @@ packages: use-composed-ref@1.3.0: resolution: {integrity: sha512-GLMG0Jc/jiKov/3Ulid1wbv3r54K9HlMW29IWcDFPEqFkSO2nS0MuefWgMJpeHQ9YJeXDL3ZUF+P3jdXlZX/cQ==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 use-isomorphic-layout-effect@1.1.2: resolution: {integrity: sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true @@ -14946,7 +14946,7 @@ packages: resolution: {integrity: sha512-xA+AVm/Wlg3e2P/JiItTziwS7FK92LWrDB0p+hgXloIMuVCeJJ8v6f0eeHyPZaJrM+usM1FkFfbNCrJGs8A/zw==} peerDependencies: '@types/react': '*' - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true @@ -14956,7 +14956,7 @@ packages: engines: {node: '>=10'} peerDependencies: '@types/react': npm:types-react@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 peerDependenciesMeta: '@types/react': optional: true @@ -14964,7 +14964,7 @@ packages: use-sync-external-store@1.2.0: resolution: {integrity: sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==} peerDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -17610,17 +17610,17 @@ snapshots: '@emotion/memoize@0.8.1': {} - '@emotion/react@11.11.1(react@19.0.0-rc-380f5d67-20241113)(types-react@19.0.0-rc.0)': + '@emotion/react@11.11.1(react@19.0.0-rc-b01722d5-20241114)(types-react@19.0.0-rc.0)': dependencies: '@babel/runtime': 7.22.5 '@emotion/babel-plugin': 11.11.0 '@emotion/cache': 11.11.0 '@emotion/serialize': 1.1.2 - '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-380f5d67-20241113) + '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@19.0.0-rc-b01722d5-20241114) '@emotion/utils': 1.2.1 '@emotion/weak-memoize': 0.3.1 hoist-non-react-statics: 3.3.2 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 optionalDependencies: '@types/react': types-react@19.0.0-rc.0 transitivePeerDependencies: @@ -17638,9 +17638,9 @@ snapshots: '@emotion/unitless@0.8.1': {} - '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-380f5d67-20241113)': + '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@19.0.0-rc-b01722d5-20241114)': dependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 '@emotion/utils@1.2.1': {} @@ -19100,11 +19100,11 @@ snapshots: transitivePeerDependencies: - supports-color - '@mdx-js/react@2.2.1(react@19.0.0-rc-380f5d67-20241113)': + '@mdx-js/react@2.2.1(react@19.0.0-rc-b01722d5-20241114)': dependencies: '@types/mdx': 2.0.3 '@types/react': types-react@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 '@mdx-js/react@2.2.1(react@19.0.0-rc-f90a6bcc-20240827)': dependencies: @@ -19924,13 +19924,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(react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113))(react@19.0.0-rc-380f5d67-20241113)(types-react@19.0.0-rc.0)': + '@testing-library/react@15.0.7(react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114))(react@19.0.0-rc-b01722d5-20241114)(types-react@19.0.0-rc.0)': dependencies: '@babel/runtime': 7.22.5 '@testing-library/dom': 10.1.0 '@types/react-dom': types-react-dom@19.0.0-rc.0 - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114) optionalDependencies: '@types/react': types-react@19.0.0-rc.0 @@ -25048,7 +25048,7 @@ snapshots: hoist-non-react-statics@3.3.2: dependencies: - react-is: 19.0.0-rc-380f5d67-20241113 + react-is: 19.0.0-rc-b01722d5-20241114 homedir-polyfill@1.0.3: dependencies: @@ -29348,25 +29348,25 @@ snapshots: '@jest/types': 24.9.0 ansi-regex: 4.1.0 ansi-styles: 3.2.1 - react-is: 19.0.0-rc-380f5d67-20241113 + react-is: 19.0.0-rc-b01722d5-20241114 pretty-format@27.5.1: dependencies: ansi-regex: 5.0.1 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-380f5d67-20241113 + react-is: 19.0.0-rc-b01722d5-20241114 pretty-format@29.5.0: dependencies: '@jest/schemas': 29.4.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-380f5d67-20241113 + react-is: 19.0.0-rc-b01722d5-20241114 pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 - react-is: 19.0.0-rc-380f5d67-20241113 + react-is: 19.0.0-rc-b01722d5-20241114 pretty-ms@7.0.0: dependencies: @@ -29423,7 +29423,7 @@ snapshots: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react-is: 19.0.0-rc-380f5d67-20241113 + react-is: 19.0.0-rc-b01722d5-20241114 property-information@5.6.0: dependencies: @@ -29597,29 +29597,29 @@ snapshots: minimist: 1.2.8 strip-json-comments: 2.0.1 - react-dom@0.0.0-experimental-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113): + react-dom@0.0.0-experimental-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114): dependencies: - react: 19.0.0-rc-380f5d67-20241113 - scheduler: 0.25.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + scheduler: 0.25.0-rc-b01722d5-20241114 - react-dom@17.0.2(react@19.0.0-rc-380f5d67-20241113): + react-dom@17.0.2(react@19.0.0-rc-b01722d5-20241114): dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react: 19.0.0-rc-380f5d67-20241113 - scheduler: 0.25.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + scheduler: 0.25.0-rc-b01722d5-20241114 - react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113): + react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114): dependencies: - react: 19.0.0-rc-380f5d67-20241113 - scheduler: 0.25.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + scheduler: 0.25.0-rc-b01722d5-20241114 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-380f5d67-20241113 + scheduler: 0.25.0-rc-b01722d5-20241114 - react-is@19.0.0-rc-380f5d67-20241113: {} + react-is@19.0.0-rc-b01722d5-20241114: {} react-is@19.0.0-rc-f90a6bcc-20240827: {} @@ -29652,48 +29652,48 @@ snapshots: optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - react-server-dom-turbopack@0.0.0-experimental-380f5d67-20241113(react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113))(react@19.0.0-rc-380f5d67-20241113): + react-server-dom-turbopack@0.0.0-experimental-b01722d5-20241114(react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114))(react@19.0.0-rc-b01722d5-20241114): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114) - react-server-dom-turbopack@19.0.0-rc-380f5d67-20241113(react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113))(react@19.0.0-rc-380f5d67-20241113): + react-server-dom-turbopack@19.0.0-rc-b01722d5-20241114(react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114))(react@19.0.0-rc-b01722d5-20241114): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114) - react-server-dom-webpack@0.0.0-experimental-380f5d67-20241113(react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113))(react@19.0.0-rc-380f5d67-20241113)(webpack@5.96.1(@swc/core@1.6.13(@swc/helpers@0.5.13))): + react-server-dom-webpack@0.0.0-experimental-b01722d5-20241114(react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114))(react@19.0.0-rc-b01722d5-20241114)(webpack@5.96.1(@swc/core@1.6.13(@swc/helpers@0.5.13))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114) webpack: 5.96.1(@swc/core@1.6.13(@swc/helpers@0.5.13)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-server-dom-webpack@19.0.0-rc-380f5d67-20241113(react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113))(react@19.0.0-rc-380f5d67-20241113)(webpack@5.96.1(@swc/core@1.6.13(@swc/helpers@0.5.13))): + react-server-dom-webpack@19.0.0-rc-b01722d5-20241114(react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114))(react@19.0.0-rc-b01722d5-20241114)(webpack@5.96.1(@swc/core@1.6.13(@swc/helpers@0.5.13))): dependencies: acorn-loose: 8.3.0 neo-async: 2.6.1 - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114) webpack: 5.96.1(@swc/core@1.6.13(@swc/helpers@0.5.13)) webpack-sources: 3.2.3(patch_hash=jbynf5dc46ambamq3wuyho6hkq) - react-shallow-renderer@16.15.0(react@19.0.0-rc-380f5d67-20241113): + react-shallow-renderer@16.15.0(react@19.0.0-rc-b01722d5-20241114): dependencies: object-assign: 4.1.1 - react: 19.0.0-rc-380f5d67-20241113 - react-is: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-is: 19.0.0-rc-b01722d5-20241114 - react-ssr-prepass@1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-380f5d67-20241113): + react-ssr-prepass@1.0.8(react-is@19.0.0-rc-f90a6bcc-20240827)(react@19.0.0-rc-b01722d5-20241114): dependencies: object-is: 1.0.2 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 react-is: 19.0.0-rc-f90a6bcc-20240827 react-style-singleton@2.2.1(react@19.0.0-rc-f90a6bcc-20240827)(types-react@19.0.0-rc.0): @@ -29705,12 +29705,12 @@ snapshots: optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - react-test-renderer@18.2.0(react@19.0.0-rc-380f5d67-20241113): + react-test-renderer@18.2.0(react@19.0.0-rc-b01722d5-20241114): dependencies: - react: 19.0.0-rc-380f5d67-20241113 - react-is: 19.0.0-rc-380f5d67-20241113 - react-shallow-renderer: 16.15.0(react@19.0.0-rc-380f5d67-20241113) - scheduler: 0.25.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 + react-is: 19.0.0-rc-b01722d5-20241114 + react-shallow-renderer: 16.15.0(react@19.0.0-rc-b01722d5-20241114) + scheduler: 0.25.0-rc-b01722d5-20241114 react-textarea-autosize@8.5.3(react@19.0.0-rc-f90a6bcc-20240827)(types-react@19.0.0-rc.0): dependencies: @@ -29721,25 +29721,25 @@ snapshots: transitivePeerDependencies: - '@types/react' - react-virtualized@9.22.3(react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113))(react@19.0.0-rc-380f5d67-20241113): + react-virtualized@9.22.3(react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114))(react@19.0.0-rc-b01722d5-20241114): 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-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114) react-lifecycles-compat: 3.0.4 - react@0.0.0-experimental-380f5d67-20241113: {} + react@0.0.0-experimental-b01722d5-20241114: {} react@17.0.2: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - react@19.0.0-rc-380f5d67-20241113: {} + react@19.0.0-rc-b01722d5-20241114: {} react@19.0.0-rc-f90a6bcc-20240827: {} @@ -30444,9 +30444,9 @@ snapshots: dependencies: xmlchars: 2.2.0 - scheduler@0.0.0-experimental-380f5d67-20241113: {} + scheduler@0.0.0-experimental-b01722d5-20241114: {} - scheduler@0.25.0-rc-380f5d67-20241113: {} + scheduler@0.25.0-rc-b01722d5-20241114: {} schema-utils@2.7.1: dependencies: @@ -31053,7 +31053,7 @@ snapshots: dependencies: inline-style-parser: 0.1.1 - styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113))(react@19.0.0-rc-380f5d67-20241113): + styled-components@6.0.0-rc.3(react-dom@19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114))(react@19.0.0-rc-b01722d5-20241114): dependencies: '@babel/cli': 7.21.5(@babel/core@7.22.5) '@babel/core': 7.22.5 @@ -31068,8 +31068,8 @@ snapshots: '@emotion/unitless': 0.8.1 css-to-react-native: 3.2.0 postcss: 8.4.31 - react: 19.0.0-rc-380f5d67-20241113 - react-dom: 19.0.0-rc-380f5d67-20241113(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + react-dom: 19.0.0-rc-b01722d5-20241114(react@19.0.0-rc-b01722d5-20241114) shallowequal: 1.1.0 stylis: 4.2.0 tslib: 2.5.3 @@ -31081,10 +31081,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-380f5d67-20241113): + styled-jsx@5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-b01722d5-20241114): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 optionalDependencies: '@babel/core': 7.22.5 babel-plugin-macros: 3.1.0 @@ -31174,11 +31174,11 @@ snapshots: csso: 5.0.5 picocolors: 1.0.1 - swr@2.2.4(react@19.0.0-rc-380f5d67-20241113): + swr@2.2.4(react@19.0.0-rc-b01722d5-20241114): dependencies: client-only: 0.0.1 - react: 19.0.0-rc-380f5d67-20241113 - use-sync-external-store: 1.2.0(react@19.0.0-rc-380f5d67-20241113) + react: 19.0.0-rc-b01722d5-20241114 + use-sync-external-store: 1.2.0(react@19.0.0-rc-b01722d5-20241114) symbol-observable@1.0.1: {} @@ -31841,9 +31841,9 @@ snapshots: unist-util-is: 5.2.0 unist-util-visit-parents: 5.1.3 - unistore@3.4.1(react@19.0.0-rc-380f5d67-20241113): + unistore@3.4.1(react@19.0.0-rc-b01722d5-20241114): optionalDependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 universal-github-app-jwt@1.1.1: dependencies: @@ -31961,9 +31961,9 @@ snapshots: optionalDependencies: '@types/react': types-react@19.0.0-rc.0 - use-sync-external-store@1.2.0(react@19.0.0-rc-380f5d67-20241113): + use-sync-external-store@1.2.0(react@19.0.0-rc-b01722d5-20241114): dependencies: - react: 19.0.0-rc-380f5d67-20241113 + react: 19.0.0-rc-b01722d5-20241114 util-deprecate@1.0.2: {} diff --git a/run-tests.js b/run-tests.js index b755ab0d2d0e3..a65acf45d40db 100644 --- a/run-tests.js +++ b/run-tests.js @@ -20,7 +20,7 @@ const { getTestFilter } = require('./test/get-test-filter') // Do not rename or format. sync-react script relies on this line. // prettier-ignore -const nextjsReactPeerVersion = "19.0.0-rc-380f5d67-20241113"; +const nextjsReactPeerVersion = "19.0.0-rc-b01722d5-20241114"; let argv = require('yargs/yargs')(process.argv.slice(2)) .string('type') diff --git a/test/.stats-app/package.json b/test/.stats-app/package.json index a3f849e8bfc07..d3cf4021cd792 100644 --- a/test/.stats-app/package.json +++ b/test/.stats-app/package.json @@ -4,8 +4,8 @@ "license": "MIT", "dependencies": { "next": "latest", - "react": "19.0.0-rc-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113" + "react": "19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114" }, "engines": { "node": ">=18.18.0" diff --git a/test/e2e/app-dir/navigation/navigation.test.ts b/test/e2e/app-dir/navigation/navigation.test.ts index a38a12a931d0a..6964967a88d1a 100644 --- a/test/e2e/app-dir/navigation/navigation.test.ts +++ b/test/e2e/app-dir/navigation/navigation.test.ts @@ -891,23 +891,10 @@ describe('app dir - navigation', () => { .elementByCss("[href='/metadata-await-promise/nested']") .click() - if (!isNextDev) { - // next-dev has no prefetch - expect( - await browser - .waitForElementByCss( - '#loading', - // Wait a bit longer than the prefetch duration since the click takes a while to register and the fallback render also takes time. - resolveMetadataDuration + 500 - ) - .text() - ).toEqual('Loading') - expect(await browser.elementByCss('title').text()).toBe('Async Title') - } - await waitFor(resolveMetadataDuration) expect(await browser.elementById('page-content').text()).toBe('Content') + expect(await browser.elementByCss('title').text()).toBe('Async Title') }) it('shows a fallback when prefetch completed', async () => { diff --git a/test/e2e/next-test/first-time-setup-js/package.json b/test/e2e/next-test/first-time-setup-js/package.json index 2586f30ad1d49..a85698e169046 100644 --- a/test/e2e/next-test/first-time-setup-js/package.json +++ b/test/e2e/next-test/first-time-setup-js/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "next": "canary", - "react": "19.0.0-rc-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113" + "react": "19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114" } } diff --git a/test/e2e/next-test/first-time-setup-ts/package.json b/test/e2e/next-test/first-time-setup-ts/package.json index 82637d65878ec..383a5f278edca 100644 --- a/test/e2e/next-test/first-time-setup-ts/package.json +++ b/test/e2e/next-test/first-time-setup-ts/package.json @@ -8,8 +8,8 @@ }, "dependencies": { "next": "canary", - "react": "19.0.0-rc-380f5d67-20241113", - "react-dom": "19.0.0-rc-380f5d67-20241113" + "react": "19.0.0-rc-b01722d5-20241114", + "react-dom": "19.0.0-rc-b01722d5-20241114" }, "devDependencies": { "@types/react": "^18", diff --git a/test/lib/next-modes/base.ts b/test/lib/next-modes/base.ts index 8636a2d8d5f7d..9d35f86dd4c18 100644 --- a/test/lib/next-modes/base.ts +++ b/test/lib/next-modes/base.ts @@ -52,7 +52,7 @@ type OmitFirstArgument = F extends ( // Do not rename or format. sync-react script relies on this line. // prettier-ignore -const nextjsReactPeerVersion = "19.0.0-rc-380f5d67-20241113"; +const nextjsReactPeerVersion = "19.0.0-rc-b01722d5-20241114"; export class NextInstance { protected files: FileRef | { [filename: string]: string | FileRef } From f3b06b93ae7e5c6839daf12d5380736edb69fcd3 Mon Sep 17 00:00:00 2001 From: Boaris <31354262+boar-is@users.noreply.github.com> Date: Sun, 24 Nov 2024 20:14:47 +0200 Subject: [PATCH 11/82] Implement metadata types support for `exactOptionalPropertyTypes` (#72936) --- .../metadata/types/alternative-urls-types.ts | 26 +- .../src/lib/metadata/types/extra-types.ts | 104 ++-- .../src/lib/metadata/types/manifest-types.ts | 183 ++++--- .../lib/metadata/types/metadata-interface.ts | 119 ++-- .../src/lib/metadata/types/metadata-types.ts | 136 ++--- .../src/lib/metadata/types/opengraph-types.ts | 262 +++++---- .../src/lib/metadata/types/twitter-types.ts | 56 +- .../typechecking/metadata/manifest.ts | 76 +++ .../typechecking/metadata/metadata.ts | 507 ++++++++++++++++++ .../typechecking/metadata/robots.ts | 14 + .../typechecking/metadata/sitemap.ts | 59 ++ .../typechecking/metadata/viewport.ts | 22 + 12 files changed, 1163 insertions(+), 401 deletions(-) create mode 100644 test/production/typescript-basic/typechecking/metadata/manifest.ts create mode 100644 test/production/typescript-basic/typechecking/metadata/metadata.ts create mode 100644 test/production/typescript-basic/typechecking/metadata/robots.ts create mode 100644 test/production/typescript-basic/typechecking/metadata/sitemap.ts create mode 100644 test/production/typescript-basic/typechecking/metadata/viewport.ts diff --git a/packages/next/src/lib/metadata/types/alternative-urls-types.ts b/packages/next/src/lib/metadata/types/alternative-urls-types.ts index 2155e3cac11e9..a3d0f329e8d8a 100644 --- a/packages/next/src/lib/metadata/types/alternative-urls-types.ts +++ b/packages/next/src/lib/metadata/types/alternative-urls-types.ts @@ -427,23 +427,29 @@ type UnmatchedLang = 'x-default' type HrefLang = LangCode | UnmatchedLang export type Languages = { - [s in HrefLang]?: T + [s in HrefLang]?: T | undefined } export type AlternateLinkDescriptor = { - title?: string + title?: string | undefined url: string | URL } export type AlternateURLs = { - canonical?: null | string | URL | AlternateLinkDescriptor - languages?: Languages - media?: { - [media: string]: null | string | URL | AlternateLinkDescriptor[] - } - types?: { - [types: string]: null | string | URL | AlternateLinkDescriptor[] - } + canonical?: null | string | URL | AlternateLinkDescriptor | undefined + languages?: + | Languages + | undefined + media?: + | { + [media: string]: null | string | URL | AlternateLinkDescriptor[] + } + | undefined + types?: + | { + [types: string]: null | string | URL | AlternateLinkDescriptor[] + } + | undefined } export type ResolvedAlternateURLs = { diff --git a/packages/next/src/lib/metadata/types/extra-types.ts b/packages/next/src/lib/metadata/types/extra-types.ts index 0afd54a3bfaa6..c987e1512eecb 100644 --- a/packages/next/src/lib/metadata/types/extra-types.ts +++ b/packages/next/src/lib/metadata/types/extra-types.ts @@ -3,65 +3,69 @@ // ref: https://developers.facebook.com/docs/applinks/metadata-reference export type AppLinks = { - ios?: AppLinksApple | Array - iphone?: AppLinksApple | Array - ipad?: AppLinksApple | Array - android?: AppLinksAndroid | Array - windows_phone?: AppLinksWindows | Array - windows?: AppLinksWindows | Array - windows_universal?: AppLinksWindows | Array - web?: AppLinksWeb | Array + ios?: AppLinksApple | Array | undefined + iphone?: AppLinksApple | Array | undefined + ipad?: AppLinksApple | Array | undefined + android?: AppLinksAndroid | Array | undefined + windows_phone?: AppLinksWindows | Array | undefined + windows?: AppLinksWindows | Array | undefined + windows_universal?: AppLinksWindows | Array | undefined + web?: AppLinksWeb | Array | undefined } export type ResolvedAppLinks = { - ios?: Array - iphone?: Array - ipad?: Array - android?: Array - windows_phone?: Array - windows?: Array - windows_universal?: Array - web?: Array + ios?: Array | undefined + iphone?: Array | undefined + ipad?: Array | undefined + android?: Array | undefined + windows_phone?: Array | undefined + windows?: Array | undefined + windows_universal?: Array | undefined + web?: Array | undefined } export type AppLinksApple = { url: string | URL - app_store_id?: string | number - app_name?: string + app_store_id?: string | number | undefined + app_name?: string | undefined } export type AppLinksAndroid = { package: string - url?: string | URL - class?: string - app_name?: string + url?: string | URL | undefined + class?: string | undefined + app_name?: string | undefined } export type AppLinksWindows = { url: string | URL - app_id?: string - app_name?: string + app_id?: string | undefined + app_name?: string | undefined } export type AppLinksWeb = { url: string | URL - should_fallback?: boolean + should_fallback?: boolean | undefined } // Apple Itunes APp // https://developer.apple.com/documentation/webkit/promoting_apps_with_smart_app_banners export type ItunesApp = { appId: string - appArgument?: string + appArgument?: string | undefined } // Viewport meta structure // https://developer.mozilla.org/docs/Web/HTML/Viewport_meta_tag // intentionally leaving out user-scalable, use a string if you want that behavior export type ViewportLayout = { - width?: string | number - height?: string | number - initialScale?: number - minimumScale?: number - maximumScale?: number - userScalable?: boolean - viewportFit?: 'auto' | 'cover' | 'contain' - interactiveWidget?: 'resizes-visual' | 'resizes-content' | 'overlays-content' + width?: string | number | undefined + height?: string | number | undefined + initialScale?: number | undefined + minimumScale?: number | undefined + maximumScale?: number | undefined + userScalable?: boolean | undefined + viewportFit?: 'auto' | 'cover' | 'contain' | undefined + interactiveWidget?: + | 'resizes-visual' + | 'resizes-content' + | 'overlays-content' + | undefined } // Apple Web App @@ -69,37 +73,37 @@ export type ViewportLayout = { // https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html export type AppleWebApp = { // default true - capable?: boolean - title?: string - startupImage?: AppleImage | Array + capable?: boolean | undefined + title?: string | undefined + startupImage?: AppleImage | Array | undefined // default "default" - statusBarStyle?: 'default' | 'black' | 'black-translucent' + statusBarStyle?: 'default' | 'black' | 'black-translucent' | undefined } export type AppleImage = string | AppleImageDescriptor export type AppleImageDescriptor = { url: string - media?: string + media?: string | undefined } export type ResolvedAppleWebApp = { capable: boolean - title?: string | null - startupImage?: AppleImageDescriptor[] | null - statusBarStyle?: 'default' | 'black' | 'black-translucent' + title?: string | null | undefined + startupImage?: AppleImageDescriptor[] | null | undefined + statusBarStyle?: 'default' | 'black' | 'black-translucent' | undefined } export type Facebook = FacebookAppId | FacebookAdmins export type FacebookAppId = { appId: string - admins?: never + admins?: never | undefined } export type FacebookAdmins = { - appId?: never + appId?: never | undefined admins: string | string[] } export type ResolvedFacebook = { - appId?: string - admins?: string[] + appId?: string | undefined + admins?: string[] | undefined } // Format Detection @@ -110,9 +114,9 @@ export type ResolvedFacebook = { // that can initiate a phone call // https://www.goodemailcode.com/email-code/template.html export type FormatDetection = { - telephone?: boolean - date?: boolean - address?: boolean - email?: boolean - url?: boolean + telephone?: boolean | undefined + date?: boolean | undefined + address?: boolean | undefined + email?: boolean | undefined + url?: boolean | undefined } diff --git a/packages/next/src/lib/metadata/types/manifest-types.ts b/packages/next/src/lib/metadata/types/manifest-types.ts index 719b9d8775caf..de96e602b0dc1 100644 --- a/packages/next/src/lib/metadata/types/manifest-types.ts +++ b/packages/next/src/lib/metadata/types/manifest-types.ts @@ -11,37 +11,43 @@ type File = { type Icon = { src: string - type?: string - sizes?: string - purpose?: 'any' | 'maskable' | 'monochrome' + type?: string | undefined + sizes?: string | undefined + purpose?: 'any' | 'maskable' | 'monochrome' | undefined } export type Manifest = { - background_color?: string - categories?: string[] - description?: string - dir?: 'ltr' | 'rtl' | 'auto' - display?: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser' - display_override?: ( - | 'fullscreen' - | 'standalone' - | 'minimal-ui' - | 'browser' - | 'window-controls-overlay' - )[] - file_handlers?: { - action: string - accept: { - [mimeType: string]: string[] - } - }[] - icons?: Icon[] - id?: string - lang?: string - launch_handler?: { - client_mode: ClientModeEnum | ClientModeEnum[] - } - name?: string + background_color?: string | undefined + categories?: string[] | undefined + description?: string | undefined + dir?: 'ltr' | 'rtl' | 'auto' | undefined + display?: 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser' | undefined + display_override?: + | ( + | 'fullscreen' + | 'standalone' + | 'minimal-ui' + | 'browser' + | 'window-controls-overlay' + )[] + | undefined + file_handlers?: + | { + action: string + accept: { + [mimeType: string]: string[] + } + }[] + | undefined + icons?: Icon[] | undefined + id?: string | undefined + lang?: string | undefined + launch_handler?: + | { + client_mode: ClientModeEnum | ClientModeEnum[] + } + | undefined + name?: string | undefined orientation?: | 'any' | 'natural' @@ -51,57 +57,72 @@ export type Manifest = { | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary' - prefer_related_applications?: boolean - protocol_handlers?: { - protocol: string - url: string - }[] - related_applications?: { - platform: string - url: string - id?: string - }[] - scope?: string - screenshots?: { - form_factor?: 'narrow' | 'wide' - label?: string - platform?: - | 'android' - | 'chromeos' - | 'ipados' - | 'ios' - | 'kaios' - | 'macos' - | 'windows' - | 'xbox' - | 'chrome_web_store' - | 'itunes' - | 'microsoft-inbox' - | 'microsoft-store' - | 'play' - src: string - type?: string - sizes?: string - }[] - share_target?: { - action: string - method?: 'get' | 'post' | 'GET' | 'POST' - enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' - params: { - title?: string - text?: string - url?: string - files?: File | File[] - } - } - short_name?: string - shortcuts?: { - name: string - short_name?: string - description?: string - url: string - icons?: Icon[] - }[] - start_url?: string - theme_color?: string + | undefined + prefer_related_applications?: boolean | undefined + protocol_handlers?: + | { + protocol: string + url: string + }[] + | undefined + related_applications?: + | { + platform: string + url: string + id?: string | undefined + }[] + | undefined + scope?: string | undefined + screenshots?: + | { + form_factor?: 'narrow' | 'wide' | undefined + label?: string | undefined + platform?: + | 'android' + | 'chromeos' + | 'ipados' + | 'ios' + | 'kaios' + | 'macos' + | 'windows' + | 'xbox' + | 'chrome_web_store' + | 'itunes' + | 'microsoft-inbox' + | 'microsoft-store' + | 'play' + | undefined + src: string + type?: string | undefined + sizes?: string | undefined + }[] + | undefined + share_target?: + | { + action: string + method?: 'get' | 'post' | 'GET' | 'POST' | undefined + enctype?: + | 'application/x-www-form-urlencoded' + | 'multipart/form-data' + | undefined + params: { + title?: string | undefined + text?: string | undefined + url?: string | undefined + files?: File | File[] | undefined + } + } + | undefined + short_name?: string | undefined + shortcuts?: + | { + name: string + short_name?: string | undefined + description?: string | undefined + url: string + icons?: Icon[] | undefined + }[] + | undefined + start_url?: string | undefined + theme_color?: string | undefined } diff --git a/packages/next/src/lib/metadata/types/metadata-interface.ts b/packages/next/src/lib/metadata/types/metadata-interface.ts index f81acdb8582bc..cf4a408f2ee39 100644 --- a/packages/next/src/lib/metadata/types/metadata-interface.ts +++ b/packages/next/src/lib/metadata/types/metadata-interface.ts @@ -44,7 +44,7 @@ interface Metadata extends DeprecatedMetadataFields { /** * The base path and origin for absolute urls for various metadata links such as OpenGraph images. */ - metadataBase?: null | URL + metadataBase?: null | URL | undefined /** * The document title. @@ -60,7 +60,7 @@ interface Metadata extends DeprecatedMetadataFields { * My Blog * ``` */ - title?: null | string | TemplateString + title?: null | string | TemplateString | undefined /** * The document description, and optionally the OpenGraph and twitter descriptions. @@ -70,7 +70,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - description?: null | string + description?: null | string | undefined // Standard metadata names // https://developer.mozilla.org/docs/Web/HTML/Element/meta/name @@ -83,7 +83,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - applicationName?: null | string + applicationName?: null | string | undefined /** * The authors of the document. @@ -95,7 +95,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - authors?: null | Author | Array + authors?: null | Author | Array | undefined /** * The generator used for the document. @@ -106,7 +106,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - generator?: null | string + generator?: null | string | undefined /** * The keywords for the document. If an array is provided, it will be flattened into a single tag with comma separation. @@ -119,7 +119,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - keywords?: null | string | Array + keywords?: null | string | Array | undefined /** * The referrer setting for the document. @@ -129,7 +129,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - referrer?: null | ReferrerEnum + referrer?: null | ReferrerEnum | undefined /** * The theme color for the document. @@ -151,7 +151,12 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - themeColor?: null | string | ThemeColorDescriptor | ThemeColorDescriptor[] + themeColor?: + | null + | string + | ThemeColorDescriptor + | ThemeColorDescriptor[] + | undefined /** * The color scheme for the document. @@ -163,7 +168,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - colorScheme?: null | ColorSchemeEnum + colorScheme?: null | ColorSchemeEnum | undefined /** * The viewport setting for the document. @@ -175,7 +180,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - viewport?: null | string | ViewportLayout + viewport?: null | string | ViewportLayout | undefined /** * The creator of the document. @@ -185,7 +190,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - creator?: null | string + creator?: null | string | undefined /** * The publisher of the document. @@ -196,7 +201,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - publisher?: null | string + publisher?: null | string | undefined // https://developer.mozilla.org/docs/Web/HTML/Element/meta/name#other_metadata_names @@ -213,7 +218,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - robots?: null | string | Robots + robots?: null | string | Robots | undefined /** * The canonical and alternate URLs for the document. @@ -243,7 +248,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - alternates?: null | AlternateURLs + alternates?: null | AlternateURLs | undefined /** * The icons for the document. Defaults to rel="icon". @@ -263,7 +268,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - icons?: null | IconURL | Array | Icons + icons?: null | IconURL | Array | Icons | undefined /** * A web application manifest, as defined in the Web Application Manifest specification. @@ -276,7 +281,7 @@ interface Metadata extends DeprecatedMetadataFields { * ``` * */ - manifest?: null | string | URL + manifest?: null | string | URL | undefined /** * The Open Graph metadata for the document. @@ -303,7 +308,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - openGraph?: null | OpenGraph + openGraph?: null | OpenGraph | undefined /** * The Twitter metadata for the document. @@ -320,7 +325,7 @@ interface Metadata extends DeprecatedMetadataFields { * ``` * */ - twitter?: null | Twitter + twitter?: null | Twitter | undefined /** * The Facebook metadata for the document. @@ -339,7 +344,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - facebook?: null | Facebook + facebook?: null | Facebook | undefined /** * The common verification tokens for the document. @@ -351,7 +356,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - verification?: Verification + verification?: Verification | undefined /** * The Apple web app metadata for the document. @@ -366,7 +371,7 @@ interface Metadata extends DeprecatedMetadataFields { * ``` * */ - appleWebApp?: null | boolean | AppleWebApp + appleWebApp?: null | boolean | AppleWebApp | undefined /** * Indicates if devices should try to interpret various formats and make actionable links out of them. For example it controles @@ -378,7 +383,7 @@ interface Metadata extends DeprecatedMetadataFields { * ``` * */ - formatDetection?: null | FormatDetection + formatDetection?: null | FormatDetection | undefined /** * The metadata for the iTunes App. @@ -390,7 +395,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - itunes?: null | ItunesApp + itunes?: null | ItunesApp | undefined /** * A brief description of what this web-page is about. Not recommended, superseded by description. @@ -403,7 +408,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - abstract?: null | string + abstract?: null | string | undefined /** * The Facebook AppLinks metadata for the document. @@ -417,7 +422,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - appLinks?: null | AppLinks + appLinks?: null | AppLinks | undefined /** * The archives link rel property. @@ -427,7 +432,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - archives?: null | string | Array + archives?: null | string | Array | undefined /** * The assets link rel property. @@ -437,7 +442,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - assets?: null | string | Array + assets?: null | string | Array | undefined /** * The bookmarks link rel property. @@ -447,7 +452,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - bookmarks?: null | string | Array // This is technically against HTML spec but is used in wild + bookmarks?: null | string | Array | undefined // This is technically against HTML spec but is used in wild // meta name properties @@ -459,7 +464,7 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - category?: null | string + category?: null | string | undefined /** * The classification meta name property. @@ -469,14 +474,16 @@ interface Metadata extends DeprecatedMetadataFields { * * ``` */ - classification?: null | string + classification?: null | string | undefined /** * Arbitrary name/value pairs for the document. */ - other?: { - [name: string]: string | number | Array - } & DeprecatedMetadataFields + other?: + | ({ + [name: string]: string | number | Array + } & DeprecatedMetadataFields) + | undefined } interface ResolvedMetadata extends DeprecatedMetadataFields { @@ -576,25 +583,25 @@ type RobotsFile = { // Apply rules for all rules: | { - userAgent?: string | string[] - allow?: string | string[] - disallow?: string | string[] - crawlDelay?: number + userAgent?: string | string[] | undefined + allow?: string | string[] | undefined + disallow?: string | string[] | undefined + crawlDelay?: number | undefined } // Apply rules for specific user agents | Array<{ userAgent: string | string[] - allow?: string | string[] - disallow?: string | string[] - crawlDelay?: number + allow?: string | string[] | undefined + disallow?: string | string[] | undefined + crawlDelay?: number | undefined }> - sitemap?: string | string[] - host?: string + sitemap?: string | string[] | undefined + host?: string | undefined } type SitemapFile = Array<{ url: string - lastModified?: string | Date + lastModified?: string | Date | undefined changeFrequency?: | 'always' | 'hourly' @@ -603,12 +610,15 @@ type SitemapFile = Array<{ | 'monthly' | 'yearly' | 'never' - priority?: number - alternates?: { - languages?: Languages - } - images?: string[] - videos?: Videos[] + | undefined + priority?: number | undefined + alternates?: + | { + languages?: Languages | undefined + } + | undefined + images?: string[] | undefined + videos?: Videos[] | undefined }> type ResolvingMetadata = Promise @@ -639,7 +649,12 @@ interface Viewport extends ViewportLayout { * * ``` */ - themeColor?: null | string | ThemeColorDescriptor | ThemeColorDescriptor[] + themeColor?: + | null + | string + | ThemeColorDescriptor + | ThemeColorDescriptor[] + | undefined /** * The color scheme for the document. @@ -650,7 +665,7 @@ interface Viewport extends ViewportLayout { * * ``` */ - colorScheme?: null | ColorSchemeEnum + colorScheme?: null | ColorSchemeEnum | undefined } type ResolvingViewport = Promise diff --git a/packages/next/src/lib/metadata/types/metadata-types.ts b/packages/next/src/lib/metadata/types/metadata-types.ts index f955ac9858d9d..1843a5459895b 100644 --- a/packages/next/src/lib/metadata/types/metadata-types.ts +++ b/packages/next/src/lib/metadata/types/metadata-types.ts @@ -9,14 +9,14 @@ export interface DeprecatedMetadataFields { * Deprecated options that have a preferred method * @deprecated Use appWebApp to configure mobile-web-app-capable which provides */ - 'apple-touch-fullscreen'?: never + 'apple-touch-fullscreen'?: never | undefined /** * Obsolete since iOS 7. * @see https://web.dev/apple-touch-icon/ * @deprecated use icons.apple or instead */ - 'apple-touch-icon-precomposed'?: never + 'apple-touch-icon-precomposed'?: never | undefined } export type TemplateString = @@ -37,9 +37,9 @@ export type AbsoluteString = { export type Author = { // renders as - phoneNumbers?: string | Array - faxNumbers?: string | Array - siteName?: string - locale?: Locale - alternateLocale?: Locale | Array - images?: OGImage | Array - audio?: OGAudio | Array - videos?: OGVideo | Array - url?: string | URL - countryName?: string - ttl?: number + determiner?: 'a' | 'an' | 'the' | 'auto' | '' | undefined + title?: string | TemplateString | undefined + description?: string | undefined + emails?: string | Array | undefined + phoneNumbers?: string | Array | undefined + faxNumbers?: string | Array | undefined + siteName?: string | undefined + locale?: Locale | undefined + alternateLocale?: Locale | Array | undefined + images?: OGImage | Array | undefined + audio?: OGAudio | Array | undefined + videos?: OGVideo | Array | undefined + url?: string | URL | undefined + countryName?: string | undefined + ttl?: number | undefined } type OpenGraphWebsite = OpenGraphMetadata & { type: 'website' } type OpenGraphArticle = OpenGraphMetadata & { type: 'article' - publishedTime?: string // datetime - modifiedTime?: string // datetime - expirationTime?: string // datetime - authors?: null | string | URL | Array - section?: null | string - tags?: null | string | Array + publishedTime?: string | undefined // datetime + modifiedTime?: string | undefined // datetime + expirationTime?: string | undefined // datetime + authors?: null | string | URL | Array | undefined + section?: null | string | undefined + tags?: null | string | Array | undefined } type OpenGraphBook = OpenGraphMetadata & { type: 'book' - isbn?: null | string - releaseDate?: null | string // datetime - authors?: null | string | URL | Array - tags?: null | string | Array + isbn?: null | string | undefined + releaseDate?: null | string | undefined // datetime + authors?: null | string | URL | Array | undefined + tags?: null | string | Array | undefined } type OpenGraphProfile = OpenGraphMetadata & { type: 'profile' - firstName?: null | string - lastName?: null | string - username?: null | string - gender?: null | string + firstName?: null | string | undefined + lastName?: null | string | undefined + username?: null | string | undefined + gender?: null | string | undefined } type OpenGraphMusicSong = OpenGraphMetadata & { type: 'music.song' - duration?: null | number - albums?: null | string | URL | OGAlbum | Array - musicians?: null | string | URL | Array + duration?: null | number | undefined + albums?: + | null + | string + | URL + | OGAlbum + | Array + | undefined + musicians?: null | string | URL | Array | undefined } type OpenGraphMusicAlbum = OpenGraphMetadata & { type: 'music.album' - songs?: null | string | URL | OGSong | Array - musicians?: null | string | URL | Array - releaseDate?: null | string // datetime + songs?: + | null + | string + | URL + | OGSong + | Array + | undefined + musicians?: null | string | URL | Array | undefined + releaseDate?: null | string | undefined // datetime } type OpenGraphMusicPlaylist = OpenGraphMetadata & { type: 'music.playlist' - songs?: null | string | URL | OGSong | Array - creators?: null | string | URL | Array + songs?: + | null + | string + | URL + | OGSong + | Array + | undefined + creators?: null | string | URL | Array | undefined } type OpenGraphRadioStation = OpenGraphMetadata & { type: 'music.radio_station' - creators?: null | string | URL | Array + creators?: null | string | URL | Array | undefined } type OpenGraphVideoMovie = OpenGraphMetadata & { type: 'video.movie' - actors?: null | string | URL | OGActor | Array - directors?: null | string | URL | Array - writers?: null | string | URL | Array - duration?: null | number - releaseDate?: null | string // datetime - tags?: null | string | Array + actors?: + | null + | string + | URL + | OGActor + | Array + | undefined + directors?: null | string | URL | Array | undefined + writers?: null | string | URL | Array | undefined + duration?: null | number | undefined + releaseDate?: null | string | undefined // datetime + tags?: null | string | Array | undefined } type OpenGraphVideoEpisode = OpenGraphMetadata & { type: 'video.episode' - actors?: null | string | URL | OGActor | Array - directors?: null | string | URL | Array - writers?: null | string | URL | Array - duration?: null | number - releaseDate?: null | string // datetime - tags?: null | string | Array - series?: null | string | URL + actors?: + | null + | string + | URL + | OGActor + | Array + | undefined + directors?: null | string | URL | Array | undefined + writers?: null | string | URL | Array | undefined + duration?: null | number | undefined + releaseDate?: null | string | undefined // datetime + tags?: null | string | Array | undefined + series?: null | string | URL | undefined } type OpenGraphVideoTVShow = OpenGraphMetadata & { type: 'video.tv_show' @@ -125,25 +155,25 @@ type OpenGraphVideoOther = OpenGraphMetadata & { type OGImage = string | OGImageDescriptor | URL type OGImageDescriptor = { url: string | URL - secureUrl?: string | URL - alt?: string - type?: string - width?: string | number - height?: string | number + secureUrl?: string | URL | undefined + alt?: string | undefined + type?: string | undefined + width?: string | number | undefined + height?: string | number | undefined } type OGAudio = string | OGAudioDescriptor | URL type OGAudioDescriptor = { url: string | URL - secureUrl?: string | URL - type?: string + secureUrl?: string | URL | undefined + type?: string | undefined } type OGVideo = string | OGVideoDescriptor | URL type OGVideoDescriptor = { url: string | URL - secureUrl?: string | URL - type?: string - width?: string | number - height?: string | number + secureUrl?: string | URL | undefined + type?: string | undefined + width?: string | number | undefined + height?: string | number | undefined } export type ResolvedOpenGraph = @@ -162,87 +192,87 @@ export type ResolvedOpenGraph = | ResolvedOpenGraphMetadata type ResolvedOpenGraphMetadata = { - determiner?: 'a' | 'an' | 'the' | 'auto' | '' + determiner?: 'a' | 'an' | 'the' | 'auto' | '' | undefined title: AbsoluteTemplateString - description?: string - emails?: Array - phoneNumbers?: Array - faxNumbers?: Array - siteName?: string - locale?: Locale - alternateLocale?: Array - images?: Array - audio?: Array - videos?: Array + description?: string | undefined + emails?: Array | undefined + phoneNumbers?: Array | undefined + faxNumbers?: Array | undefined + siteName?: string | undefined + locale?: Locale | undefined + alternateLocale?: Array | undefined + images?: Array | undefined + audio?: Array | undefined + videos?: Array | undefined url: null | URL | string - countryName?: string - ttl?: number + countryName?: string | undefined + ttl?: number | undefined } type ResolvedOpenGraphWebsite = ResolvedOpenGraphMetadata & { type: 'website' } type ResolvedOpenGraphArticle = ResolvedOpenGraphMetadata & { type: 'article' - publishedTime?: string // datetime - modifiedTime?: string // datetime - expirationTime?: string // datetime - authors?: Array - section?: string - tags?: Array + publishedTime?: string | undefined // datetime + modifiedTime?: string | undefined // datetime + expirationTime?: string | undefined // datetime + authors?: Array | undefined + section?: string | undefined + tags?: Array | undefined } type ResolvedOpenGraphBook = ResolvedOpenGraphMetadata & { type: 'book' - isbn?: string - releaseDate?: string // datetime - authors?: Array - tags?: Array + isbn?: string | undefined + releaseDate?: string | undefined // datetime + authors?: Array | undefined + tags?: Array | undefined } type ResolvedOpenGraphProfile = ResolvedOpenGraphMetadata & { type: 'profile' - firstName?: string - lastName?: string - username?: string - gender?: string + firstName?: string | undefined + lastName?: string | undefined + username?: string | undefined + gender?: string | undefined } type ResolvedOpenGraphMusicSong = ResolvedOpenGraphMetadata & { type: 'music.song' - duration?: number - albums?: Array - musicians?: Array + duration?: number | undefined + albums?: Array | undefined + musicians?: Array | undefined } type ResolvedOpenGraphMusicAlbum = ResolvedOpenGraphMetadata & { type: 'music.album' - songs?: Array - musicians?: Array - releaseDate?: string // datetime + songs?: Array | undefined + musicians?: Array | undefined + releaseDate?: string | undefined // datetime } type ResolvedOpenGraphMusicPlaylist = ResolvedOpenGraphMetadata & { type: 'music.playlist' - songs?: Array - creators?: Array + songs?: Array | undefined + creators?: Array | undefined } type ResolvedOpenGraphRadioStation = ResolvedOpenGraphMetadata & { type: 'music.radio_station' - creators?: Array + creators?: Array | undefined } type ResolvedOpenGraphVideoMovie = ResolvedOpenGraphMetadata & { type: 'video.movie' - actors?: Array - directors?: Array - writers?: Array - duration?: number - releaseDate?: string // datetime - tags?: Array + actors?: Array | undefined + directors?: Array | undefined + writers?: Array | undefined + duration?: number | undefined + releaseDate?: string | undefined // datetime + tags?: Array | undefined } type ResolvedOpenGraphVideoEpisode = ResolvedOpenGraphMetadata & { type: 'video.episode' - actors?: Array - directors?: Array - writers?: Array - duration?: number - releaseDate?: string // datetime - tags?: Array - series?: string | URL + actors?: Array | undefined + directors?: Array | undefined + writers?: Array | undefined + duration?: number | undefined + releaseDate?: string | undefined // datetime + tags?: Array | undefined + series?: string | URL | undefined } type ResolvedOpenGraphVideoTVShow = ResolvedOpenGraphMetadata & { type: 'video.tv_show' @@ -253,15 +283,15 @@ type ResolvedOpenGraphVideoOther = ResolvedOpenGraphMetadata & { type OGSong = { url: string | URL - disc?: number - track?: number + disc?: number | undefined + track?: number | undefined } type OGAlbum = { url: string | URL - disc?: number - track?: number + disc?: number | undefined + track?: number | undefined } type OGActor = { url: string | URL - role?: string + role?: string | undefined } diff --git a/packages/next/src/lib/metadata/types/twitter-types.ts b/packages/next/src/lib/metadata/types/twitter-types.ts index 6bd44173bb21d..2300c9e572f71 100644 --- a/packages/next/src/lib/metadata/types/twitter-types.ts +++ b/packages/next/src/lib/metadata/types/twitter-types.ts @@ -11,13 +11,13 @@ export type Twitter = type TwitterMetadata = { // defaults to card="summary" - site?: string // username for account associated to the site itself - siteId?: string // id for account associated to the site itself - creator?: string // username for the account associated to the creator of the content on the site - creatorId?: string // id for the account associated to the creator of the content on the site - description?: string - title?: string | TemplateString - images?: TwitterImage | Array + site?: string | undefined // username for account associated to the site itself + siteId?: string | undefined // id for account associated to the site itself + creator?: string | undefined // username for the account associated to the creator of the content on the site + creatorId?: string | undefined // id for the account associated to the creator of the content on the site + description?: string | undefined + title?: string | TemplateString | undefined + images?: TwitterImage | Array | undefined } type TwitterSummary = TwitterMetadata & { card: 'summary' @@ -35,26 +35,28 @@ type TwitterApp = TwitterMetadata & { } export type TwitterAppDescriptor = { id: { - iphone?: string | number - ipad?: string | number - googleplay?: string + iphone?: string | number | undefined + ipad?: string | number | undefined + googleplay?: string | undefined } - url?: { - iphone?: string | URL - ipad?: string | URL - googleplay?: string | URL - } - name?: string + url?: + | { + iphone?: string | URL | undefined + ipad?: string | URL | undefined + googleplay?: string | URL | undefined + } + | undefined + name?: string | undefined } type TwitterImage = string | TwitterImageDescriptor | URL type TwitterImageDescriptor = { url: string | URL - alt?: string - secureUrl?: string | URL - type?: string - width?: string | number - height?: string | number + alt?: string | undefined + secureUrl?: string | URL | undefined + type?: string | undefined + width?: string | number | undefined + height?: string | number | undefined } type TwitterPlayerDescriptor = { playerUrl: string | URL @@ -65,11 +67,11 @@ type TwitterPlayerDescriptor = { type ResolvedTwitterImage = { url: string | URL - alt?: string - secureUrl?: string | URL - type?: string - width?: string | number - height?: string | number + alt?: string | undefined + secureUrl?: string | URL | undefined + type?: string | undefined + width?: string | number | undefined + height?: string | number | undefined } type ResolvedTwitterSummary = { site: string | null @@ -78,7 +80,7 @@ type ResolvedTwitterSummary = { creatorId: string | null description: string | null title: AbsoluteTemplateString - images?: Array + images?: Array | undefined } type ResolvedTwitterPlayer = ResolvedTwitterSummary & { players: Array diff --git a/test/production/typescript-basic/typechecking/metadata/manifest.ts b/test/production/typescript-basic/typechecking/metadata/manifest.ts new file mode 100644 index 0000000000000..e1960683636c9 --- /dev/null +++ b/test/production/typescript-basic/typechecking/metadata/manifest.ts @@ -0,0 +1,76 @@ +import type { MetadataRoute } from 'next' +// eslint-disable-next-line @typescript-eslint/no-unused-expressions +;() => { + ;({ + background_color: undefined, + categories: undefined, + description: undefined, + dir: undefined, + display: undefined, + display_override: undefined, + file_handlers: undefined, + icons: undefined, + id: undefined, + lang: undefined, + launch_handler: undefined, + name: undefined, + orientation: undefined, + prefer_related_applications: undefined, + protocol_handlers: undefined, + related_applications: undefined, + scope: undefined, + screenshots: undefined, + share_target: undefined, + short_name: undefined, + shortcuts: undefined, + start_url: undefined, + theme_color: undefined, + }) satisfies MetadataRoute.Manifest + ;({ + icons: [ + { + src: '', + type: undefined, + sizes: undefined, + purpose: undefined, + }, + ], + related_applications: [ + { + platform: '', + url: '', + id: undefined, + }, + ], + screenshots: [ + { + form_factor: undefined, + label: undefined, + platform: undefined, + src: '', + type: undefined, + sizes: undefined, + }, + ], + share_target: { + action: '', + method: undefined, + enctype: undefined, + params: { + title: undefined, + text: undefined, + url: undefined, + files: undefined, + }, + }, + shortcuts: [ + { + name: '', + short_name: undefined, + description: undefined, + url: '', + icons: undefined, + }, + ], + }) satisfies MetadataRoute.Manifest +} diff --git a/test/production/typescript-basic/typechecking/metadata/metadata.ts b/test/production/typescript-basic/typechecking/metadata/metadata.ts new file mode 100644 index 0000000000000..5b1e52f3c0264 --- /dev/null +++ b/test/production/typescript-basic/typechecking/metadata/metadata.ts @@ -0,0 +1,507 @@ +import type { Metadata } from 'next' +import { ResolvedMetadata } from 'next/types' +// eslint-disable-next-line @typescript-eslint/no-unused-expressions +;() => { + ;({ + 'apple-touch-fullscreen': undefined, + 'apple-touch-icon-precomposed': undefined, + metadataBase: undefined, + title: undefined, + description: undefined, + applicationName: undefined, + authors: undefined, + generator: undefined, + keywords: undefined, + referrer: undefined, + themeColor: undefined, + colorScheme: undefined, + viewport: undefined, + creator: undefined, + publisher: undefined, + robots: undefined, + alternates: undefined, + icons: undefined, + manifest: undefined, + openGraph: undefined, + twitter: undefined, + facebook: undefined, + verification: undefined, + appleWebApp: undefined, + formatDetection: undefined, + itunes: undefined, + abstract: undefined, + appLinks: undefined, + archives: undefined, + assets: undefined, + bookmarks: undefined, + category: undefined, + classification: undefined, + other: undefined, + }) satisfies Metadata + ;({ + authors: { + url: undefined, + name: undefined, + }, + themeColor: { + color: '', + media: undefined, + }, + viewport: { + width: undefined, + height: undefined, + initialScale: undefined, + minimumScale: undefined, + maximumScale: undefined, + userScalable: undefined, + viewportFit: undefined, + interactiveWidget: undefined, + }, + robots: { + googleBot: undefined, + + index: undefined, + follow: undefined, + + noindex: undefined, + nofollow: undefined, + + noarchive: undefined, + nosnippet: undefined, + noimageindex: undefined, + nocache: undefined, + notranslate: undefined, + indexifembedded: undefined, + nositelinkssearchbox: undefined, + unavailable_after: undefined, + 'max-video-preview': undefined, + 'max-image-preview': undefined, + 'max-snippet': undefined, + }, + alternates: { + canonical: undefined, + languages: undefined, + media: undefined, + types: undefined, + }, + icons: { + icon: undefined, + shortcut: undefined, + apple: undefined, + other: { + url: '', + type: undefined, + sizes: undefined, + color: undefined, + rel: undefined, + media: undefined, + fetchPriority: undefined, + }, + }, + verification: { + google: undefined, + yahoo: undefined, + yandex: undefined, + me: undefined, + other: undefined, + }, + formatDetection: { + telephone: undefined, + date: undefined, + address: undefined, + email: undefined, + url: undefined, + }, + itunes: { + appId: '', + appArgument: undefined, + }, + }) satisfies Metadata + ;({ + canonical: { + title: undefined, + url: '', + }, + }) satisfies Metadata['alternates'] + ;({ + type: 'website', + determiner: undefined, + title: undefined, + description: undefined, + emails: undefined, + phoneNumbers: undefined, + faxNumbers: undefined, + siteName: undefined, + locale: undefined, + alternateLocale: undefined, + images: undefined, + audio: undefined, + videos: undefined, + url: undefined, + countryName: undefined, + ttl: undefined, + }) satisfies Metadata['openGraph'] + ;({ + images: { + url: '', + secureUrl: undefined, + alt: undefined, + type: undefined, + width: undefined, + height: undefined, + }, + audio: { + url: '', + secureUrl: undefined, + type: undefined, + }, + videos: { + url: '', + secureUrl: undefined, + type: undefined, + width: undefined, + height: undefined, + }, + }) satisfies Metadata['openGraph'] + ;({ + type: 'article', + publishedTime: undefined, + modifiedTime: undefined, + expirationTime: undefined, + authors: undefined, + section: undefined, + tags: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'book', + isbn: undefined, + releaseDate: undefined, + authors: undefined, + tags: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'profile', + firstName: undefined, + lastName: undefined, + username: undefined, + gender: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'music.song', + duration: undefined, + albums: undefined, + musicians: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'music.song', + albums: { + url: '', + disc: undefined, + track: undefined, + }, + }) satisfies Metadata['openGraph'] + ;({ + type: 'music.album', + songs: undefined, + musicians: undefined, + releaseDate: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'music.album', + songs: { + url: '', + disc: undefined, + track: undefined, + }, + }) satisfies Metadata['openGraph'] + ;({ + type: 'music.playlist', + songs: undefined, + creators: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'music.radio_station', + creators: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'video.movie', + actors: undefined, + directors: undefined, + writers: undefined, + duration: undefined, + releaseDate: undefined, + tags: undefined, + }) satisfies Metadata['openGraph'] + ;({ + type: 'video.movie', + actors: { + url: '', + role: undefined, + }, + }) satisfies Metadata['openGraph'] + ;({ + type: 'video.episode', + actors: undefined, + directors: undefined, + writers: undefined, + duration: undefined, + releaseDate: undefined, + tags: undefined, + series: undefined, + }) satisfies Metadata['openGraph'] + ;({ + card: 'app', + site: undefined, + siteId: undefined, + creator: undefined, + creatorId: undefined, + description: undefined, + title: undefined, + images: undefined, + app: { + id: {}, + url: undefined, + name: undefined, + }, + }) satisfies Metadata['twitter'] + ;({ + card: 'app', + images: { + url: '', + alt: undefined, + secureUrl: undefined, + type: undefined, + width: undefined, + height: undefined, + }, + app: { + id: { + iphone: undefined, + ipad: undefined, + googleplay: undefined, + }, + url: { + iphone: undefined, + ipad: undefined, + googleplay: undefined, + }, + }, + }) satisfies Metadata['twitter'] + ;({ + appId: '', + admins: undefined, + }) satisfies Metadata['facebook'] + ;({ + appId: undefined, + admins: '', + }) satisfies Metadata['facebook'] + ;({ + capable: undefined, + title: undefined, + startupImage: undefined, + statusBarStyle: undefined, + }) satisfies Metadata['appleWebApp'] + ;({ + startupImage: { + url: '', + media: undefined, + }, + }) satisfies Metadata['appleWebApp'] + ;({ + ios: undefined, + iphone: undefined, + ipad: undefined, + android: undefined, + windows_phone: undefined, + windows: undefined, + windows_universal: undefined, + web: undefined, + }) satisfies Metadata['appLinks'] + ;({ + ios: { + url: '', + app_store_id: undefined, + app_name: undefined, + }, + android: { + package: '', + url: undefined, + class: undefined, + app_name: undefined, + }, + windows_phone: { + url: '', + app_id: undefined, + app_name: undefined, + }, + web: { + url: '', + should_fallback: undefined, + }, + }) satisfies Metadata['appLinks'] + ;({ + icon: [], + apple: [], + shortcut: undefined, + other: undefined, + }) satisfies ResolvedMetadata['icons'] + ;({ + determiner: undefined, + title: { template: null, absolute: '' }, + description: undefined, + emails: undefined, + phoneNumbers: undefined, + faxNumbers: undefined, + siteName: undefined, + locale: undefined, + alternateLocale: undefined, + images: undefined, + audio: undefined, + videos: undefined, + url: null, + countryName: undefined, + ttl: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'article', + publishedTime: undefined, + modifiedTime: undefined, + expirationTime: undefined, + authors: undefined, + section: undefined, + tags: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'book', + isbn: undefined, + releaseDate: undefined, + authors: undefined, + tags: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'book', + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'profile', + firstName: undefined, + lastName: undefined, + username: undefined, + gender: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'music.song', + duration: undefined, + albums: undefined, + musicians: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'music.album', + songs: undefined, + musicians: undefined, + releaseDate: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'music.playlist', + songs: undefined, + creators: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'music.radio_station', + creators: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'video.movie', + actors: undefined, + directors: undefined, + writers: undefined, + duration: undefined, + releaseDate: undefined, + tags: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + title: { template: null, absolute: '' }, + url: null, + type: 'video.episode', + actors: undefined, + directors: undefined, + writers: undefined, + duration: undefined, + releaseDate: undefined, + tags: undefined, + series: undefined, + }) satisfies ResolvedMetadata['openGraph'] + ;({ + card: 'summary', + site: null, + siteId: null, + creator: null, + creatorId: null, + description: null, + title: { template: null, absolute: '' }, + images: undefined, + }) satisfies ResolvedMetadata['twitter'] + ;({ + card: 'summary', + site: null, + siteId: null, + creator: null, + creatorId: null, + description: null, + title: { template: null, absolute: '' }, + images: [ + { + url: '', + alt: undefined, + secureUrl: undefined, + type: undefined, + width: undefined, + height: undefined, + }, + ], + }) satisfies ResolvedMetadata['twitter'] + ;({ + appId: undefined, + admins: undefined, + }) satisfies ResolvedMetadata['facebook'] + ;({ + google: undefined, + yahoo: undefined, + yandex: undefined, + me: undefined, + other: undefined, + }) satisfies ResolvedMetadata['verification'] + ;({ + capable: false, + title: undefined, + startupImage: undefined, + statusBarStyle: undefined, + }) satisfies ResolvedMetadata['appleWebApp'] + ;({ + ios: undefined, + iphone: undefined, + ipad: undefined, + android: undefined, + windows_phone: undefined, + windows: undefined, + windows_universal: undefined, + web: undefined, + }) satisfies ResolvedMetadata['appLinks'] +} diff --git a/test/production/typescript-basic/typechecking/metadata/robots.ts b/test/production/typescript-basic/typechecking/metadata/robots.ts new file mode 100644 index 0000000000000..b0aabe53cf996 --- /dev/null +++ b/test/production/typescript-basic/typechecking/metadata/robots.ts @@ -0,0 +1,14 @@ +import type { MetadataRoute } from 'next' +// eslint-disable-next-line @typescript-eslint/no-unused-expressions +;() => { + ;({ + rules: { + userAgent: undefined, + allow: undefined, + disallow: undefined, + crawlDelay: undefined, + }, + sitemap: undefined, + host: undefined, + }) satisfies MetadataRoute.Robots +} diff --git a/test/production/typescript-basic/typechecking/metadata/sitemap.ts b/test/production/typescript-basic/typechecking/metadata/sitemap.ts new file mode 100644 index 0000000000000..039d086a305b5 --- /dev/null +++ b/test/production/typescript-basic/typechecking/metadata/sitemap.ts @@ -0,0 +1,59 @@ +import type { MetadataRoute } from 'next' +// eslint-disable-next-line @typescript-eslint/no-unused-expressions +;() => { + ;({ + url: '', + lastModified: undefined, + changeFrequency: undefined, + priority: undefined, + alternates: undefined, + images: undefined, + videos: undefined, + }) satisfies MetadataRoute.Sitemap[number] + ;({ + url: '', + alternates: { + languages: undefined, + }, + videos: [ + { + title: '', + thumbnail_loc: '', + description: '', + content_loc: undefined, + player_loc: undefined, + duration: undefined, + expiration_date: undefined, + rating: undefined, + view_count: undefined, + publication_date: undefined, + family_friendly: undefined, + restriction: undefined, + platform: undefined, + requires_subscription: undefined, + uploader: undefined, + live: undefined, + tag: undefined, + }, + ], + }) satisfies MetadataRoute.Sitemap[number] + ;({ + url: '', + alternates: { + languages: { + en: undefined, + }, + }, + videos: [ + { + title: '', + thumbnail_loc: '', + description: '', + uploader: { + info: undefined, + content: undefined, + }, + }, + ], + }) satisfies MetadataRoute.Sitemap[number] +} diff --git a/test/production/typescript-basic/typechecking/metadata/viewport.ts b/test/production/typescript-basic/typechecking/metadata/viewport.ts new file mode 100644 index 0000000000000..c159812c01954 --- /dev/null +++ b/test/production/typescript-basic/typechecking/metadata/viewport.ts @@ -0,0 +1,22 @@ +import type { Viewport } from 'next' +// eslint-disable-next-line @typescript-eslint/no-unused-expressions +;() => { + ;({ + width: undefined, + height: undefined, + initialScale: undefined, + minimumScale: undefined, + maximumScale: undefined, + userScalable: undefined, + viewportFit: undefined, + interactiveWidget: undefined, + themeColor: undefined, + colorScheme: undefined, + }) satisfies Viewport + ;({ + themeColor: { + color: '', + media: undefined, + }, + }) satisfies Viewport +} From 084bc4a51c18bcd2e36fa9514c0d1797669c1207 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Sun, 24 Nov 2024 23:24:33 +0000 Subject: [PATCH 12/82] v15.0.4-canary.27 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 2a42d07043277..a75f71ed6057e 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.4-canary.26" + "version": "15.0.4-canary.27" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 5090d5775d272..cc72a36fb6386 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index d7865b7751e5d..1b78beee999c6 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/api-reference/config/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.4-canary.26", + "@next/eslint-plugin-next": "15.0.4-canary.27", "@rushstack/eslint-patch": "^1.10.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index c0edef2482496..1556142ba9dee 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 1be710bc2b699..2c03e58320bae 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index b47de3a135a87..6a21632e6473c 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index c0786898f238c..f048a1ed4b9d3 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 44b8705621143..289754c415820 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index a3e8d54161c4a..8ba6c42ca66c9 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 16bd34a4c3228..69b14091ea21c 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index eb8ae614cd5a1..54351b952b82c 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index ef848acda3ed5..645debc7f83ab 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index e607c606eff4b..87a45a175a4b9 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 8a424560f29a1..7c6a39481d060 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -97,7 +97,7 @@ ] }, "dependencies": { - "@next/env": "15.0.4-canary.26", + "@next/env": "15.0.4-canary.27", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.13", "busboy": "1.6.0", @@ -161,11 +161,11 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/font": "15.0.4-canary.26", - "@next/polyfill-module": "15.0.4-canary.26", - "@next/polyfill-nomodule": "15.0.4-canary.26", - "@next/react-refresh-utils": "15.0.4-canary.26", - "@next/swc": "15.0.4-canary.26", + "@next/font": "15.0.4-canary.27", + "@next/polyfill-module": "15.0.4-canary.27", + "@next/polyfill-nomodule": "15.0.4-canary.27", + "@next/react-refresh-utils": "15.0.4-canary.27", + "@next/swc": "15.0.4-canary.27", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.9.2-nightly-20241111.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index a33cfea426213..747513e495e9f 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 54096633d017f..a94abd52f1f36 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.4-canary.26", + "version": "15.0.4-canary.27", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.4-canary.26", + "next": "15.0.4-canary.27", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "5.6.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e52c282c05966..03d76878e2ea2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -795,7 +795,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.10.3 @@ -859,7 +859,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -987,19 +987,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../font '@next/polyfill-module': - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1633,7 +1633,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.4-canary.26 + specifier: 15.0.4-canary.27 version: link:../next outdent: specifier: 0.8.0 From 06fed46ecd88b1f0bfdd2b18f0e69457f28df34f Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Mon, 25 Nov 2024 11:05:01 +0100 Subject: [PATCH 13/82] port turbopack-swc-utils to ResolvedVc (#73086) --- .../crates/turbopack-core/src/issue/mod.rs | 29 ++++++++++++------- .../crates/turbopack-ecmascript/src/parse.rs | 4 +-- .../src/references/mod.rs | 2 +- .../src/webpack/references.rs | 4 +-- .../crates/turbopack-swc-utils/src/emitter.rs | 12 ++++---- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/turbopack/crates/turbopack-core/src/issue/mod.rs b/turbopack/crates/turbopack-core/src/issue/mod.rs index 836ebf07e5e2b..3dd2bc88f637c 100644 --- a/turbopack/crates/turbopack-core/src/issue/mod.rs +++ b/turbopack/crates/turbopack-core/src/issue/mod.rs @@ -430,7 +430,7 @@ impl CapturedIssues { #[turbo_tasks::value] #[derive(Clone, Debug)] pub struct IssueSource { - source: Vc>, + source: ResolvedVc>, range: Option>, } @@ -447,7 +447,7 @@ impl IssueSource { // Sometimes we only have the source file that causes an issue, not the // exact location, such as as in some generated code. #[turbo_tasks::function] - pub fn from_source_only(source: Vc>) -> Vc { + pub fn from_source_only(source: ResolvedVc>) -> Vc { Self::cell(IssueSource { source, range: None, @@ -456,7 +456,7 @@ impl IssueSource { #[turbo_tasks::function] pub fn from_line_col( - source: Vc>, + source: ResolvedVc>, start: SourcePos, end: SourcePos, ) -> Vc { @@ -511,7 +511,11 @@ impl IssueSource { /// * `start`: The start index of the span. Must use **1-based** indexing. /// * `end`: The end index of the span. Must use **1-based** indexing. #[turbo_tasks::function] - pub fn from_swc_offsets(source: Vc>, start: usize, end: usize) -> Vc { + pub fn from_swc_offsets( + source: ResolvedVc>, + start: usize, + end: usize, + ) -> Vc { Self::cell(IssueSource { source, range: match (start == 0, end == 0) { @@ -536,7 +540,7 @@ impl IssueSource { /// * `start`: Byte offset into the source that the text begins. 0-based index and inclusive. /// * `end`: Byte offset into the source that the text ends. 0-based index and exclusive. pub async fn from_byte_offset( - source: Vc>, + source: ResolvedVc>, start: usize, end: usize, ) -> Result> { @@ -581,12 +585,12 @@ impl IssueSource { } async fn source_pos( - source: Vc>, + source: ResolvedVc>, origin: Vc, start: SourcePos, end: SourcePos, -) -> Result>, SourcePos, SourcePos)>> { - let Some(generator) = Vc::try_resolve_sidecast::>(source).await? +) -> Result>, SourcePos, SourcePos)>> { + let Some(generator) = ResolvedVc::try_sidecast::>(source).await? else { return Ok(None); }; @@ -628,7 +632,10 @@ async fn source_pos( return Ok(None); }; - let (content_1, content_2) = (content_1.resolve().await?, content_2.resolve().await?); + let (content_1, content_2) = ( + content_1.to_resolved().await?, + content_2.to_resolved().await?, + ); if content_1 != content_2 { return Ok(None); @@ -775,7 +782,7 @@ impl IssueSource { #[turbo_tasks::function] pub async fn into_plain(&self) -> Result> { Ok(PlainIssueSource { - asset: PlainSource::from_source(self.source).await?, + asset: PlainSource::from_source(*self.source).await?, range: match self.range { Some(range) => match &*range.await? { SourceRange::LineColumn(start, end) => Some((*start, *end)), @@ -809,7 +816,7 @@ pub struct PlainSource { #[turbo_tasks::value_impl] impl PlainSource { #[turbo_tasks::function] - pub async fn from_source(asset: Vc>) -> Result> { + pub async fn from_source(asset: ResolvedVc>) -> Result> { let asset_content = asset.content().await?; let content = match *asset_content { AssetContent::File(file_content) => file_content.await?, diff --git a/turbopack/crates/turbopack-ecmascript/src/parse.rs b/turbopack/crates/turbopack-ecmascript/src/parse.rs index 4524a3067512b..29f02d485889e 100644 --- a/turbopack/crates/turbopack-ecmascript/src/parse.rs +++ b/turbopack/crates/turbopack-ecmascript/src/parse.rs @@ -262,14 +262,14 @@ async fn parse_file_content( true, false, Box::new(IssueEmitter::new( - *source, + source, source_map.clone(), Some("Ecmascript file had an error".into()), )), ); let emitter = Box::new(IssueEmitter::new( - *source, + source, source_map.clone(), Some("Parsing ecmascript source code failed".into()), )); diff --git a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs index ecf71e01e3f57..33572e74edfba 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs @@ -586,7 +586,7 @@ pub(crate) async fn analyse_ecmascript_module_internal( let handler = Handler::with_emitter( true, false, - Box::new(IssueEmitter::new(*source, source_map.clone(), None)), + Box::new(IssueEmitter::new(source, source_map.clone(), None)), ); let mut var_graph = diff --git a/turbopack/crates/turbopack-ecmascript/src/webpack/references.rs b/turbopack/crates/turbopack-ecmascript/src/webpack/references.rs index ee7750c034bf3..d40c52b2657c1 100644 --- a/turbopack/crates/turbopack-ecmascript/src/webpack/references.rs +++ b/turbopack/crates/turbopack-ecmascript/src/webpack/references.rs @@ -21,12 +21,12 @@ use crate::{ #[turbo_tasks::function] pub async fn module_references( - source: Vc>, + source: ResolvedVc>, runtime: Vc, transforms: ResolvedVc, ) -> Result> { let parsed = parse( - source, + *source, Value::new(EcmascriptModuleAssetType::Ecmascript), *transforms, ) diff --git a/turbopack/crates/turbopack-swc-utils/src/emitter.rs b/turbopack/crates/turbopack-swc-utils/src/emitter.rs index c89b38a30f18b..c8f91258387c1 100644 --- a/turbopack/crates/turbopack-swc-utils/src/emitter.rs +++ b/turbopack/crates/turbopack-swc-utils/src/emitter.rs @@ -6,7 +6,7 @@ use swc_core::common::{ SourceMap, }; use turbo_rcstr::RcStr; -use turbo_tasks::Vc; +use turbo_tasks::{ResolvedVc, Vc}; use turbopack_core::{ issue::{analyze::AnalyzeIssue, IssueExt, IssueSeverity, IssueSource, StyledString}, source::Source, @@ -14,15 +14,15 @@ use turbopack_core::{ #[derive(Clone)] pub struct IssueEmitter { - pub source: Vc>, + pub source: ResolvedVc>, pub source_map: Arc, pub title: Option, - pub emitted_issues: Vec>, + pub emitted_issues: Vec>, } impl IssueEmitter { pub fn new( - source: Vc>, + source: ResolvedVc>, source_map: Arc, title: Option, ) -> Self { @@ -79,7 +79,7 @@ impl Emitter for IssueEmitter { } let source = db.span.primary_span().map(|span| { - IssueSource::from_swc_offsets(self.source, span.lo.to_usize(), span.hi.to_usize()) + IssueSource::from_swc_offsets(*self.source, span.lo.to_usize(), span.hi.to_usize()) }); // TODO add other primary and secondary spans with labels as sub_issues @@ -91,7 +91,7 @@ impl Emitter for IssueEmitter { code, source, } - .cell(); + .resolved_cell(); self.emitted_issues.push(issue); From 70be9654abb5fc741935cd3ab3ebfe423e134531 Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Mon, 25 Nov 2024 11:07:50 +0100 Subject: [PATCH 14/82] port turbopack-mdx to use ResolvedVc (#73080) --- turbopack/crates/turbopack-mdx/src/lib.rs | 90 +++++++++++++---------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/turbopack/crates/turbopack-mdx/src/lib.rs b/turbopack/crates/turbopack-mdx/src/lib.rs index 3a6d112c9fe78..ad47c0f46dba5 100644 --- a/turbopack/crates/turbopack-mdx/src/lib.rs +++ b/turbopack/crates/turbopack-mdx/src/lib.rs @@ -5,7 +5,7 @@ use anyhow::Result; use mdxjs::{compile, MdxParseOptions, Options}; use turbo_rcstr::RcStr; -use turbo_tasks::{ValueDefault, Vc}; +use turbo_tasks::{ResolvedVc, ValueDefault, Vc}; use turbo_tasks_fs::{rope::Rope, File, FileContent, FileSystemPath}; use turbopack_core::{ asset::{Asset, AssetContent}, @@ -80,13 +80,13 @@ impl ValueDefault for MdxTransformOptions { #[turbo_tasks::value] pub struct MdxTransform { - options: Vc, + options: ResolvedVc, } #[turbo_tasks::value_impl] impl MdxTransform { #[turbo_tasks::function] - pub fn new(options: Vc) -> Vc { + pub fn new(options: ResolvedVc) -> Vc { MdxTransform { options }.cell() } } @@ -94,7 +94,7 @@ impl MdxTransform { #[turbo_tasks::value_impl] impl SourceTransform for MdxTransform { #[turbo_tasks::function] - fn transform(&self, source: Vc>) -> Vc> { + fn transform(&self, source: ResolvedVc>) -> Vc> { Vc::upcast( MdxTransformedAsset { options: self.options, @@ -107,8 +107,8 @@ impl SourceTransform for MdxTransform { #[turbo_tasks::value] struct MdxTransformedAsset { - options: Vc, - source: Vc>, + options: ResolvedVc, + source: ResolvedVc>, } #[turbo_tasks::value_impl] @@ -124,7 +124,7 @@ impl Asset for MdxTransformedAsset { #[turbo_tasks::function] async fn content(self: Vc) -> Result> { let this = self.await?; - Ok(self + Ok(*self .process() .issue_file_path(this.source.ident().path(), "MDX processing") .await? @@ -184,38 +184,47 @@ impl MdxTransformedAsset { match result { Ok(mdx_jsx_component) => Ok(MdxTransformResult { - content: AssetContent::file(File::from(Rope::from(mdx_jsx_component)).into()), + content: AssetContent::file(File::from(Rope::from(mdx_jsx_component)).into()) + .to_resolved() + .await?, } .cell()), Err(err) => { - let loc = err.place.map(|p| { - let (start, end) = match *p { - // markdown's positions are 1-indexed, SourcePos is 0-indexed. - // Both end positions point to the first character after the range - markdown::message::Place::Position(p) => ( - SourcePos { - line: p.start.line - 1, - column: p.start.column - 1, - }, - SourcePos { - line: p.end.line - 1, - column: p.end.column - 1, - }, - ), - markdown::message::Place::Point(p) => { - let p = SourcePos { - line: p.line - 1, - column: p.column - 1, - }; - (p, p) - } - }; - - IssueSource::from_line_col(self.source, start, end) - }); + let loc = match err.place { + Some(p) => { + let (start, end) = match *p { + // markdown's positions are 1-indexed, SourcePos is 0-indexed. + // Both end positions point to the first character after the range + markdown::message::Place::Position(p) => ( + SourcePos { + line: p.start.line - 1, + column: p.start.column - 1, + }, + SourcePos { + line: p.end.line - 1, + column: p.end.column - 1, + }, + ), + markdown::message::Place::Point(p) => { + let p = SourcePos { + line: p.line - 1, + column: p.column - 1, + }; + (p, p) + } + }; + + Some( + IssueSource::from_line_col(*self.source, start, end) + .to_resolved() + .await?, + ) + } + None => None, + }; MdxIssue { - path: self.source.ident().path(), + path: self.source.ident().path().to_resolved().await?, loc, reason: err.reason, mdx_rule_id: *err.rule_id, @@ -225,7 +234,8 @@ impl MdxTransformedAsset { .emit(); Ok(MdxTransformResult { - content: AssetContent::File(FileContent::NotFound.resolved_cell()).cell(), + content: AssetContent::File(FileContent::NotFound.resolved_cell()) + .resolved_cell(), } .cell()) } @@ -235,14 +245,14 @@ impl MdxTransformedAsset { #[turbo_tasks::value] struct MdxTransformResult { - content: Vc, + content: ResolvedVc, } #[turbo_tasks::value] struct MdxIssue { /// Place of message. - path: Vc, - loc: Option>, + path: ResolvedVc, + loc: Option>, /// Reason for message (should use markdown). reason: String, /// Category of message. @@ -255,12 +265,12 @@ struct MdxIssue { impl Issue for MdxIssue { #[turbo_tasks::function] fn file_path(&self) -> Vc { - self.path + *self.path } #[turbo_tasks::function] fn source(&self) -> Vc { - Vc::cell(self.loc.map(|s| s.resolve_source_map(self.path))) + Vc::cell(self.loc.map(|s| s.resolve_source_map(*self.path))) } #[turbo_tasks::function] From 2bf477954ef6be241b189a93b3e8e58bcb737a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Mon, 25 Nov 2024 19:55:20 +0900 Subject: [PATCH 15/82] feat: Update `lightningcss` to `v1.0.0-alpha.61` (#73161) ### What? Update `lightningcss` to the latest. - https://github.com/parcel-bundler/lightningcss/releases/tag/v1.28.2 ### Why? It's released. --- Cargo.lock | 5 +++-- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 073d6a1fbf966..222d9cbed901d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3402,9 +3402,9 @@ dependencies = [ [[package]] name = "lightningcss" -version = "1.0.0-alpha.60" +version = "1.0.0-alpha.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f3aad0f3d9105ab72b02caf1b2a998a6d549f3fff8cca0c558e590c3245edfd" +checksum = "20c9e1f991b3861d25bf872ecca2eb6a73f7a9fe671da047cd1f9b49c65cbc40" dependencies = [ "ahash 0.8.11", "bitflags 2.5.0", @@ -3414,6 +3414,7 @@ dependencies = [ "dashmap 5.5.3", "data-encoding", "getrandom", + "indexmap 2.5.0", "itertools 0.10.5", "lazy_static", "lightningcss-derive", diff --git a/Cargo.toml b/Cargo.toml index 3566410bd36f4..aed0d1881c6b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -146,7 +146,7 @@ indoc = "2.0.0" itertools = "0.10.5" lazy_static = "1.4.0" log = "0.4.17" -lightningcss = { version = "1.0.0-alpha.60", features = [ +lightningcss = { version = "1.0.0-alpha.61", features = [ "serde", "visitor", "into_owned", From 2853a5de812283876a50e91220216e429d61cdf0 Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Mon, 25 Nov 2024 12:37:02 +0100 Subject: [PATCH 16/82] port turbopack-resolve to ResolvedVc (#73083) --- .../src/node_native_binding.rs | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/turbopack/crates/turbopack-resolve/src/node_native_binding.rs b/turbopack/crates/turbopack-resolve/src/node_native_binding.rs index 8ffd044328396..c72d54860489f 100644 --- a/turbopack/crates/turbopack-resolve/src/node_native_binding.rs +++ b/turbopack/crates/turbopack-resolve/src/node_native_binding.rs @@ -33,18 +33,18 @@ struct NodePreGypConfig { #[turbo_tasks::value] #[derive(Hash, Clone, Debug)] pub struct NodePreGypConfigReference { - pub context_dir: Vc, - pub config_file_pattern: Vc, - pub compile_target: Vc, + pub context_dir: ResolvedVc, + pub config_file_pattern: ResolvedVc, + pub compile_target: ResolvedVc, } #[turbo_tasks::value_impl] impl NodePreGypConfigReference { #[turbo_tasks::function] pub fn new( - context_dir: Vc, - config_file_pattern: Vc, - compile_target: Vc, + context_dir: ResolvedVc, + config_file_pattern: ResolvedVc, + compile_target: ResolvedVc, ) -> Vc { Self::cell(NodePreGypConfigReference { context_dir, @@ -59,9 +59,9 @@ impl ModuleReference for NodePreGypConfigReference { #[turbo_tasks::function] fn resolve_reference(&self) -> Vc { resolve_node_pre_gyp_files( - self.context_dir, - self.config_file_pattern, - self.compile_target, + *self.context_dir, + *self.config_file_pattern, + *self.compile_target, ) } } @@ -226,17 +226,20 @@ pub async fn resolve_node_pre_gyp_files( #[turbo_tasks::value] #[derive(Hash, Clone, Debug)] pub struct NodeGypBuildReference { - pub context_dir: Vc, - pub compile_target: Vc, + pub context_dir: ResolvedVc, + pub compile_target: ResolvedVc, } #[turbo_tasks::value_impl] impl NodeGypBuildReference { #[turbo_tasks::function] - pub fn new(context_dir: Vc, target: Vc) -> Vc { + pub fn new( + context_dir: ResolvedVc, + compile_target: ResolvedVc, + ) -> Vc { Self::cell(NodeGypBuildReference { context_dir, - compile_target: target, + compile_target, }) } } @@ -245,7 +248,7 @@ impl NodeGypBuildReference { impl ModuleReference for NodeGypBuildReference { #[turbo_tasks::function] fn resolve_reference(&self) -> Vc { - resolve_node_gyp_build_files(self.context_dir, self.compile_target) + resolve_node_gyp_build_files(*self.context_dir, *self.compile_target) } } @@ -346,14 +349,14 @@ pub async fn resolve_node_gyp_build_files( #[turbo_tasks::value] #[derive(Hash, Clone, Debug)] pub struct NodeBindingsReference { - pub context_dir: Vc, + pub context_dir: ResolvedVc, pub file_name: RcStr, } #[turbo_tasks::value_impl] impl NodeBindingsReference { #[turbo_tasks::function] - pub fn new(context_dir: Vc, file_name: RcStr) -> Vc { + pub fn new(context_dir: ResolvedVc, file_name: RcStr) -> Vc { Self::cell(NodeBindingsReference { context_dir, file_name, @@ -365,7 +368,7 @@ impl NodeBindingsReference { impl ModuleReference for NodeBindingsReference { #[turbo_tasks::function] fn resolve_reference(&self) -> Vc { - resolve_node_bindings_files(self.context_dir, self.file_name.clone()) + resolve_node_bindings_files(*self.context_dir, self.file_name.clone()) } } From 1cade4eb69ca0e400e6f04f529708f7522233ece Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Mon, 25 Nov 2024 12:37:42 +0100 Subject: [PATCH 17/82] move turbopack-image to ResolvedVc (#73079) --- .../crates/turbopack-image/src/process/mod.rs | 65 +++++++++++-------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/turbopack/crates/turbopack-image/src/process/mod.rs b/turbopack/crates/turbopack-image/src/process/mod.rs index cc1c75dc19552..47bb96a05250a 100644 --- a/turbopack/crates/turbopack-image/src/process/mod.rs +++ b/turbopack/crates/turbopack-image/src/process/mod.rs @@ -101,13 +101,14 @@ fn extension_to_image_format(extension: &str) -> Option { }) } -fn result_to_issue(ident: Vc, result: Result) -> Option { +fn result_to_issue(path: ResolvedVc, result: Result) -> Option { match result { Ok(r) => Some(r), Err(err) => { ImageProcessingIssue { - path: ident.path(), - message: StyledString::Text(format!("{}", PrettyPrintError(&err)).into()).cell(), + path, + message: StyledString::Text(format!("{}", PrettyPrintError(&err)).into()) + .resolved_cell(), issue_severity: None, title: None, } @@ -119,11 +120,11 @@ fn result_to_issue(ident: Vc, result: Result) -> Option { } fn load_image( - ident: Vc, + path: ResolvedVc, bytes: &[u8], extension: Option<&str>, ) -> Option<(ImageBuffer, Option)> { - result_to_issue(ident, load_image_internal(ident, bytes, extension)) + result_to_issue(path, load_image_internal(path, bytes, extension)) } /// Type of raw image buffer read by reader from `load_image`. @@ -134,7 +135,7 @@ enum ImageBuffer { } fn load_image_internal( - ident: Vc, + path: ResolvedVc, bytes: &[u8], extension: Option<&str>, ) -> Result<(ImageBuffer, Option)> { @@ -163,15 +164,15 @@ fn load_image_internal( #[cfg(not(feature = "avif"))] if matches!(format, Some(ImageFormat::Avif)) { ImageProcessingIssue { - path: ident.path(), + path, message: StyledString::Text( "This version of Turbopack does not support AVIF images, will emit without \ optimization or encoding" .into(), ) - .cell(), + .resolved_cell(), title: Some(StyledString::Text("AVIF image not supported".into()).resolved_cell()), - issue_severity: Some(IssueSeverity::Warning.into()), + issue_severity: Some(IssueSeverity::Warning.resolved_cell()), } .cell() .emit(); @@ -181,15 +182,15 @@ fn load_image_internal( #[cfg(not(feature = "webp"))] if matches!(format, Some(ImageFormat::WebP)) { ImageProcessingIssue { - path: ident.path(), + path, message: StyledString::Text( "This version of Turbopack does not support WEBP images, will emit without \ optimization or encoding" .into(), ) - .cell(), + .resolved_cell(), title: Some(StyledString::Text("WEBP image not supported".into()).resolved_cell()), - issue_severity: Some(IssueSeverity::Warning.into()), + issue_severity: Some(IssueSeverity::Warning.resolved_cell()), } .cell() .emit(); @@ -201,7 +202,7 @@ fn load_image_internal( } fn compute_blur_data( - ident: Vc, + path: ResolvedVc, image: image::DynamicImage, format: ImageFormat, options: &BlurPlaceholderOptions, @@ -212,8 +213,9 @@ fn compute_blur_data( Ok(r) => Some(r), Err(err) => { ImageProcessingIssue { - path: ident.path(), - message: StyledString::Text(format!("{}", PrettyPrintError(&err)).into()).cell(), + path, + message: StyledString::Text(format!("{}", PrettyPrintError(&err)).into()) + .resolved_cell(), issue_severity: None, title: None, } @@ -346,18 +348,19 @@ pub async fn get_meta_data( bail!("Input image not found"); }; let bytes = content.content().to_bytes()?; - let path = ident.path().await?; + let path_resolved = ident.path().to_resolved().await?; + let path = path_resolved.await?; let extension = path.extension_ref(); if extension == Some("svg") { let content = result_to_issue( - ident, + path_resolved, std::str::from_utf8(&bytes).context("Input image is not valid utf-8"), ); let Some(content) = content else { return Ok(ImageMetaData::fallback_value(Some(mime::IMAGE_SVG)).cell()); }; let info = result_to_issue( - ident, + path_resolved, calculate(content).context("Failed to parse svg source code for image dimensions"), ); let Some((width, height)) = info else { @@ -371,7 +374,7 @@ pub async fn get_meta_data( } .cell()); } - let Some((image, format)) = load_image(ident, &bytes, extension) else { + let Some((image, format)) = load_image(path_resolved, &bytes, extension) else { return Ok(ImageMetaData::fallback_value(None).cell()); }; @@ -388,7 +391,12 @@ pub async fn get_meta_data( | Some(ImageFormat::WebP) | Some(ImageFormat::Avif) ) { - compute_blur_data(ident, image, format.unwrap(), &*blur_placeholder.await?) + compute_blur_data( + path_resolved, + image, + format.unwrap(), + &*blur_placeholder.await?, + ) } else { None } @@ -423,8 +431,9 @@ pub async fn optimize( return Ok(FileContent::NotFound.cell()); }; let bytes = content.content().to_bytes()?; + let path = ident.path().to_resolved().await?; - let Some((image, format)) = load_image(ident, &bytes, ident.path().await?.extension_ref()) + let Some((image, format)) = load_image(path, &bytes, ident.path().await?.extension_ref()) else { return Ok(FileContent::NotFound.cell()); }; @@ -477,22 +486,24 @@ pub async fn optimize( #[turbo_tasks::value] struct ImageProcessingIssue { - path: Vc, - message: Vc, + path: ResolvedVc, + message: ResolvedVc, title: Option>, - issue_severity: Option>, + issue_severity: Option>, } #[turbo_tasks::value_impl] impl Issue for ImageProcessingIssue { #[turbo_tasks::function] fn severity(&self) -> Vc { - self.issue_severity.unwrap_or(IssueSeverity::Error.into()) + self.issue_severity + .map(|s| *s) + .unwrap_or(IssueSeverity::Error.into()) } #[turbo_tasks::function] fn file_path(&self) -> Vc { - self.path + *self.path } #[turbo_tasks::function] @@ -509,6 +520,6 @@ impl Issue for ImageProcessingIssue { #[turbo_tasks::function] fn description(&self) -> Vc { - Vc::cell(Some(self.message)) + Vc::cell(Some(*self.message)) } } From 1899edd047a0056cbcd97c7f005fd0182868760f Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:20:17 +0100 Subject: [PATCH 18/82] Turbopack: more tracing spans (#73010) - adds per-module tracing for `find server actions` (it's implemented in the same way for next/dynamic and client references). Now, `find server actions` isn't just a single blob anymore. - add a tracing span for `all_server_paths` --- crates/next-api/src/app.rs | 4 ++ crates/next-api/src/middleware.rs | 4 ++ crates/next-api/src/pages.rs | 4 ++ crates/next-api/src/paths.rs | 54 +++++++++-------- crates/next-api/src/server_actions.rs | 85 +++++++++++++++++++-------- 5 files changed, 104 insertions(+), 47 deletions(-) diff --git a/crates/next-api/src/app.rs b/crates/next-api/src/app.rs index df2876bea5f48..0bb5248a4de4d 100644 --- a/crates/next-api/src/app.rs +++ b/crates/next-api/src/app.rs @@ -1,3 +1,5 @@ +use std::future::IntoFuture; + use anyhow::{Context, Result}; use next_core::{ all_assets_from_entries, @@ -1643,6 +1645,8 @@ impl Endpoint for AppEndpoint { let client_relative_root = this.app_project.project().client_relative_path(); let client_paths = all_paths_in_root(output_assets, client_relative_root) + .into_future() + .instrument(tracing::info_span!("client_paths")) .await? .clone_value(); diff --git a/crates/next-api/src/middleware.rs b/crates/next-api/src/middleware.rs index fee7bc715f682..a1bd72470654a 100644 --- a/crates/next-api/src/middleware.rs +++ b/crates/next-api/src/middleware.rs @@ -1,3 +1,5 @@ +use std::future::IntoFuture; + use anyhow::{bail, Context, Result}; use next_core::{ all_assets_from_entries, @@ -285,6 +287,8 @@ impl Endpoint for MiddlewareEndpoint { // Middleware could in theory have a client path (e.g. `new URL`). let client_relative_root = this.project.client_relative_path(); let client_paths = all_paths_in_root(output_assets, client_relative_root) + .into_future() + .instrument(tracing::info_span!("client_paths")) .await? .clone_value(); diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index 76b61d07a680e..7e974c15229ed 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -1,3 +1,5 @@ +use std::future::IntoFuture; + use anyhow::{bail, Context, Result}; use next_core::{ all_assets_from_entries, create_page_loader_entry_module, get_asset_path_from_pathname, @@ -1279,6 +1281,8 @@ impl Endpoint for PageEndpoint { let client_relative_root = this.pages_project.project().client_relative_path(); let client_paths = all_paths_in_root(output_assets, client_relative_root) + .into_future() + .instrument(tracing::info_span!("client_paths")) .await? .clone_value(); diff --git a/crates/next-api/src/paths.rs b/crates/next-api/src/paths.rs index 547df5838055d..694b6c01ef98c 100644 --- a/crates/next-api/src/paths.rs +++ b/crates/next-api/src/paths.rs @@ -1,6 +1,7 @@ use anyhow::Result; use next_core::{all_assets_from_entries, next_manifests::AssetBinding}; use serde::{Deserialize, Serialize}; +use tracing::Instrument; use turbo_rcstr::RcStr; use turbo_tasks::{trace::TraceRawVcs, ResolvedVc, TryFlatJoinIterExt, Vc}; use turbo_tasks_fs::FileSystemPath; @@ -29,30 +30,35 @@ pub async fn all_server_paths( assets: Vc, node_root: Vc, ) -> Result> { - let all_assets = all_assets_from_entries(assets).await?; - let node_root = &node_root.await?; - Ok(Vc::cell( - all_assets - .iter() - .map(|&asset| async move { - Ok( - if let Some(path) = node_root.get_path_to(&*asset.ident().path().await?) { - let content_hash = match *asset.content().await? { - AssetContent::File(file) => *file.hash().await?, - AssetContent::Redirect { .. } => 0, - }; - Some(ServerPath { - path: path.to_string(), - content_hash, - }) - } else { - None - }, - ) - }) - .try_flat_join() - .await?, - )) + let span = tracing::info_span!("all_server_paths"); + async move { + let all_assets = all_assets_from_entries(assets).await?; + let node_root = &node_root.await?; + Ok(Vc::cell( + all_assets + .iter() + .map(|&asset| async move { + Ok( + if let Some(path) = node_root.get_path_to(&*asset.ident().path().await?) { + let content_hash = match *asset.content().await? { + AssetContent::File(file) => *file.hash().await?, + AssetContent::Redirect { .. } => 0, + }; + Some(ServerPath { + path: path.to_string(), + content_hash, + }) + } else { + None + }, + ) + }) + .try_flat_join() + .await?, + )) + } + .instrument(span) + .await } /// Return a list of relative paths to `root` for all output assets references diff --git a/crates/next-api/src/server_actions.rs b/crates/next-api/src/server_actions.rs index 469edf93f97df..f8cf72f977fdb 100644 --- a/crates/next-api/src/server_actions.rs +++ b/crates/next-api/src/server_actions.rs @@ -1,4 +1,4 @@ -use std::{collections::BTreeMap, io::Write, iter::once}; +use std::{collections::BTreeMap, future::Future, io::Write, iter::once}; use anyhow::{bail, Context, Result}; use indexmap::map::Entry; @@ -19,11 +19,11 @@ use swc_core::{ utils::find_pat_ids, }, }; -use tracing::Instrument; +use tracing::{Instrument, Level}; use turbo_rcstr::RcStr; use turbo_tasks::{ - graph::{GraphTraversal, NonDeterministic}, - FxIndexMap, ResolvedVc, TryFlatJoinIterExt, Value, ValueToString, Vc, + graph::{GraphTraversal, NonDeterministic, VisitControlFlow}, + FxIndexMap, ReadRef, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Value, ValueToString, Vc, }; use turbo_tasks_fs::{self, rope::RopeBuilder, File, FileSystemPath}; use turbopack_core::{ @@ -68,7 +68,7 @@ pub(crate) async fn create_server_actions_manifest( asset_context: Vc>, chunking_context: Vc>, ) -> Result> { - let actions = get_actions(rsc_entry, server_reference_modules, asset_context); + let actions = find_actions(rsc_entry, server_reference_modules, asset_context); let loader = build_server_actions_loader(project_path, page_name.clone(), actions, asset_context); let evaluable = Vc::try_resolve_sidecast::>(loader) @@ -188,7 +188,7 @@ async fn build_manifest( /// comment which identifies server actions. Every found server action will be /// returned along with the module which exports that action. #[turbo_tasks::function] -async fn get_actions( +async fn find_actions( rsc_entry: ResolvedVc>, server_reference_modules: Vc, asset_context: Vc>, @@ -197,13 +197,22 @@ async fn get_actions( let actions = NonDeterministic::new() .skip_duplicates() .visit( - once((ActionLayer::Rsc, rsc_entry)).chain( + once(( + ActionLayer::Rsc, + rsc_entry, + rsc_entry.ident().to_string().await?, + )) + .chain( server_reference_modules .await? .iter() - .map(|m| (ActionLayer::ActionBrowser, *m)), + .map(|m| async move { + Ok((ActionLayer::ActionBrowser, *m, m.ident().to_string().await?)) + }) + .try_join() + .await?, ), - get_referenced_modules, + FindActionsVisit {}, ) .await .completed()? @@ -217,7 +226,7 @@ async fn get_actions( // to use the RSC layer's module. We do that by merging the hashes (which match // in both layers) and preferring the RSC layer's action. let mut all_actions: HashToLayerNameModule = FxIndexMap::default(); - for ((layer, module), actions_map) in actions.iter() { + for ((layer, module, _), actions_map) in actions.iter() { let module = if *layer == ActionLayer::Rsc { *module } else { @@ -245,6 +254,46 @@ async fn get_actions( .await } +type FindActionsNode = (ActionLayer, ResolvedVc>, ReadRef); +struct FindActionsVisit {} +impl turbo_tasks::graph::Visit for FindActionsVisit { + type Edge = FindActionsNode; + type EdgesIntoIter = impl Iterator; + type EdgesFuture = impl Future>; + + fn visit(&mut self, edge: Self::Edge) -> VisitControlFlow { + VisitControlFlow::Continue(edge) + } + + fn edges(&mut self, node: &Self::Edge) -> Self::EdgesFuture { + get_referenced_modules(node.clone()) + } + + fn span(&mut self, node: &Self::Edge) -> tracing::Span { + let (_, _, name) = node; + tracing::span!( + Level::INFO, + "find server actions visit", + name = display(name) + ) + } +} + +/// Our graph traversal visitor, which finds the primary modules directly +/// referenced by parent. +async fn get_referenced_modules( + (layer, module, _): FindActionsNode, +) -> Result + Send> { + let modules = primary_referenced_modules(*module).await?; + + Ok(modules + .into_iter() + .map(move |&m| async move { Ok((layer, m, m.ident().to_string().await?)) }) + .try_join() + .await? + .into_iter()) +} + /// The ActionBrowser layer's module is in the Client context, and we need to /// bring it into the RSC context. async fn to_rsc_context( @@ -265,16 +314,6 @@ async fn to_rsc_context( Ok(module) } -/// Our graph traversal visitor, which finds the primary modules directly -/// referenced by parent. -async fn get_referenced_modules( - (layer, module): (ActionLayer, ResolvedVc>), -) -> Result>)> + Send> { - primary_referenced_modules(*module) - .await - .map(|modules| modules.into_iter().map(move |&m| (layer, m))) -} - /// Parses the Server Actions comment for all exported action function names. /// /// Action names are stored in a leading BlockComment prefixed by @@ -440,12 +479,12 @@ fn is_turbopack_internal_var(with: &Option>) -> bool { /// Converts our cached [parse_actions] call into a data type suitable for /// collecting into a flat-mapped [FxIndexMap]. async fn parse_actions_filter_map( - (layer, module): (ActionLayer, ResolvedVc>), -) -> Result>), Vc)>> { + (layer, module, name): FindActionsNode, +) -> Result)>> { parse_actions(*module).await.map(|option_action_map| { option_action_map .clone_value() - .map(|action_map| ((layer, module), action_map)) + .map(|action_map| ((layer, module, name), action_map)) }) } From 56b28ce8f814273b3a991e878731384fb0ebe025 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 25 Nov 2024 13:28:06 +0100 Subject: [PATCH 19/82] Reenable otel test for Turbopack (#73093) Turbopack has supported instrumentation.js for a long time now --- .../client-component-renderer-logger.ts | 1 - .../instrumentation/opentelemetry.test.ts | 1467 +++++++++-------- 2 files changed, 735 insertions(+), 733 deletions(-) diff --git a/packages/next/src/server/client-component-renderer-logger.ts b/packages/next/src/server/client-component-renderer-logger.ts index f7cc69379b7f5..7364961371de7 100644 --- a/packages/next/src/server/client-component-renderer-logger.ts +++ b/packages/next/src/server/client-component-renderer-logger.ts @@ -26,7 +26,6 @@ export function wrapClientComponentLoader(ComponentMod: any) { loadChunk: (...args: any[]) => { const startTime = performance.now() try { - clientComponentLoadCount += 1 return ComponentMod.__next_app__.loadChunk(...args) } finally { clientComponentLoadTimes += performance.now() - startTime diff --git a/test/e2e/opentelemetry/instrumentation/opentelemetry.test.ts b/test/e2e/opentelemetry/instrumentation/opentelemetry.test.ts index 4f3fe027a2c53..42587f9824771 100644 --- a/test/e2e/opentelemetry/instrumentation/opentelemetry.test.ts +++ b/test/e2e/opentelemetry/instrumentation/opentelemetry.test.ts @@ -18,6 +18,7 @@ describe('opentelemetry', () => { dependencies: require('./package.json').dependencies, env: { TEST_OTEL_COLLECTOR_PORT: String(COLLECTOR_PORT), + NEXT_TELEMETRY_DISABLED: '1', }, }) @@ -61,755 +62,758 @@ describe('opentelemetry', () => { }, }, ]) { - // turbopack does not support instrumentation.js - ;(process.env.TURBOPACK || process.env.__NEXT_EXPERIMENTAL_PPR - ? describe.skip - : describe)(env.name, () => { - describe('app router', () => { - it('should handle RSC with fetch', async () => { - await next.fetch('/app/param/rsc-fetch', env.fetchInit) - - await expectTrace(getCollector(), [ - { - name: 'GET /app/[param]/rsc-fetch', - attributes: { - 'http.method': 'GET', - 'http.route': '/app/[param]/rsc-fetch', - 'http.status_code': 200, - 'http.target': '/app/param/rsc-fetch', - 'next.route': '/app/[param]/rsc-fetch', - 'next.rsc': false, - 'next.span_name': 'GET /app/[param]/rsc-fetch', - 'next.span_type': 'BaseServer.handleRequest', - }, - kind: 1, - status: { code: 0 }, - traceId: env.span.traceId, - parentId: env.span.rootParentId, - spans: [ - { - name: 'render route (app) /app/[param]/rsc-fetch', - attributes: { - 'next.route': '/app/[param]/rsc-fetch', - 'next.span_name': - 'render route (app) /app/[param]/rsc-fetch', - 'next.span_type': 'AppRender.getBodyResult', - }, - kind: 0, - status: { code: 0 }, - spans: [ - { - name: 'build component tree', - attributes: { - 'next.span_name': 'build component tree', - 'next.span_type': 'NextNodeServer.createComponentTree', - }, - kind: 0, - status: { code: 0 }, - spans: [ - { - name: 'resolve segment modules', - attributes: { - 'next.segment': '__PAGE__', - 'next.span_name': 'resolve segment modules', - 'next.span_type': - 'NextNodeServer.getLayoutOrPageModule', - }, - kind: 0, - status: { code: 0 }, + ;(process.env.__NEXT_EXPERIMENTAL_PPR ? describe.skip : describe)( + env.name, + () => { + describe('app router', () => { + it('should handle RSC with fetch', async () => { + await next.fetch('/app/param/rsc-fetch', env.fetchInit) + + await expectTrace(getCollector(), [ + { + name: 'GET /app/[param]/rsc-fetch', + attributes: { + 'http.method': 'GET', + 'http.route': '/app/[param]/rsc-fetch', + 'http.status_code': 200, + 'http.target': '/app/param/rsc-fetch', + 'next.route': '/app/[param]/rsc-fetch', + 'next.rsc': false, + 'next.span_name': 'GET /app/[param]/rsc-fetch', + 'next.span_type': 'BaseServer.handleRequest', + }, + kind: 1, + status: { code: 0 }, + traceId: env.span.traceId, + parentId: env.span.rootParentId, + spans: [ + { + name: 'render route (app) /app/[param]/rsc-fetch', + attributes: { + 'next.route': '/app/[param]/rsc-fetch', + 'next.span_name': + 'render route (app) /app/[param]/rsc-fetch', + 'next.span_type': 'AppRender.getBodyResult', + }, + kind: 0, + status: { code: 0 }, + spans: [ + { + name: 'build component tree', + attributes: { + 'next.span_name': 'build component tree', + 'next.span_type': + 'NextNodeServer.createComponentTree', }, - { - name: 'resolve segment modules', - attributes: { - 'next.segment': '[param]', - 'next.span_name': 'resolve segment modules', - 'next.span_type': - 'NextNodeServer.getLayoutOrPageModule', + kind: 0, + status: { code: 0 }, + spans: [ + { + name: 'resolve segment modules', + attributes: { + 'next.segment': '__PAGE__', + 'next.span_name': 'resolve segment modules', + 'next.span_type': + 'NextNodeServer.getLayoutOrPageModule', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - ], - }, - { - name: 'fetch GET https://example.vercel.sh/', - attributes: { - 'http.method': 'GET', - 'http.url': 'https://example.vercel.sh/', - 'net.peer.name': 'example.vercel.sh', - 'next.span_name': - 'fetch GET https://example.vercel.sh/', - 'next.span_type': 'AppRender.fetch', + { + name: 'resolve segment modules', + attributes: { + 'next.segment': '[param]', + 'next.span_name': 'resolve segment modules', + 'next.span_type': + 'NextNodeServer.getLayoutOrPageModule', + }, + kind: 0, + status: { code: 0 }, + }, + ], }, - kind: 2, - status: { code: 0 }, - }, - { - name: 'generateMetadata /app/[param]/layout', - attributes: { - 'next.page': '/app/[param]/layout', - 'next.span_name': - 'generateMetadata /app/[param]/layout', - 'next.span_type': 'ResolveMetadata.generateMetadata', + { + name: 'fetch GET https://example.vercel.sh/', + attributes: { + 'http.method': 'GET', + 'http.url': 'https://example.vercel.sh/', + 'net.peer.name': 'example.vercel.sh', + 'next.span_name': + 'fetch GET https://example.vercel.sh/', + 'next.span_type': 'AppRender.fetch', + }, + kind: 2, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - { - name: 'generateMetadata /app/[param]/rsc-fetch/page', - attributes: { - 'next.page': '/app/[param]/rsc-fetch/page', - 'next.span_name': - 'generateMetadata /app/[param]/rsc-fetch/page', - 'next.span_type': 'ResolveMetadata.generateMetadata', + { + name: 'generateMetadata /app/[param]/layout', + attributes: { + 'next.page': '/app/[param]/layout', + 'next.span_name': + 'generateMetadata /app/[param]/layout', + 'next.span_type': 'ResolveMetadata.generateMetadata', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - { - attributes: { - 'next.clientComponentLoadCount': isNextDev - ? // In dev, additional client components are being loaded - // due to RSC props being deserialized. - 9 - : 6, - 'next.span_type': - 'NextNodeServer.clientComponentLoading', + { + name: 'generateMetadata /app/[param]/rsc-fetch/page', + attributes: { + 'next.page': '/app/[param]/rsc-fetch/page', + 'next.span_name': + 'generateMetadata /app/[param]/rsc-fetch/page', + 'next.span_type': 'ResolveMetadata.generateMetadata', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - name: 'NextNodeServer.clientComponentLoading', - status: { - code: 0, + { + attributes: { + 'next.clientComponentLoadCount': isNextDev + ? // In dev, additional client components are being loaded + // due to RSC props being deserialized. + 9 + : 6, + 'next.span_type': + 'NextNodeServer.clientComponentLoading', + }, + kind: 0, + name: 'NextNodeServer.clientComponentLoading', + status: { + code: 0, + }, }, - }, - { - name: 'start response', - attributes: { - 'next.span_name': 'start response', - 'next.span_type': 'NextNodeServer.startResponse', + { + name: 'start response', + attributes: { + 'next.span_name': 'start response', + 'next.span_type': 'NextNodeServer.startResponse', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, + ], + }, + { + name: 'resolve page components', + attributes: { + 'next.route': '/app/[param]/rsc-fetch', + 'next.span_name': 'resolve page components', + 'next.span_type': 'NextNodeServer.findPageComponents', }, - ], - }, - { - name: 'resolve page components', - attributes: { - 'next.route': '/app/[param]/rsc-fetch', - 'next.span_name': 'resolve page components', - 'next.span_type': 'NextNodeServer.findPageComponents', + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - ], - }, - ]) - }) - - it('should propagate custom context without span', async () => { - await next.fetch('/app/param/rsc-fetch', { - ...env.fetchInit, - headers: { ...env.fetchInit?.headers, 'x-custom': 'custom1' }, + ], + }, + ]) }) - await expectTrace(getCollector(), [ - { - name: 'GET /app/[param]/rsc-fetch', - attributes: { - custom: 'custom1', + it('should propagate custom context without span', async () => { + await next.fetch('/app/param/rsc-fetch', { + ...env.fetchInit, + headers: { ...env.fetchInit?.headers, 'x-custom': 'custom1' }, + }) + + await expectTrace(getCollector(), [ + { + name: 'GET /app/[param]/rsc-fetch', + attributes: { + custom: 'custom1', + }, }, - }, - ]) - }) + ]) + }) - it('should handle RSC with fetch on edge', async () => { - await next.fetch('/app/param/rsc-fetch/edge', env.fetchInit) + it('should handle RSC with fetch on edge', async () => { + await next.fetch('/app/param/rsc-fetch/edge', env.fetchInit) - await expectTrace(getCollector(), [ - { - traceId: env.span.traceId, - parentId: env.span.rootParentId, - runtime: 'edge', - name: 'GET /app/[param]/rsc-fetch/edge', - kind: 1, - attributes: { - 'next.span_name': 'GET /app/[param]/rsc-fetch/edge', - 'next.span_type': 'BaseServer.handleRequest', - 'http.method': 'GET', - 'http.target': '/app/param/rsc-fetch/edge?param=param', - 'http.status_code': 200, - 'next.route': '/app/[param]/rsc-fetch/edge', - 'http.route': '/app/[param]/rsc-fetch/edge', - }, - status: { code: 0 }, - spans: [ - { - name: 'render route (app) /app/[param]/rsc-fetch/edge', - kind: 0, - attributes: { - 'next.span_name': - 'render route (app) /app/[param]/rsc-fetch/edge', - 'next.span_type': 'AppRender.getBodyResult', - 'next.route': '/app/[param]/rsc-fetch/edge', - }, - status: { code: 0 }, - spans: [ - { - name: 'build component tree', - kind: 0, - attributes: { - 'next.span_name': 'build component tree', - 'next.span_type': 'NextNodeServer.createComponentTree', - }, - status: { code: 0 }, - spans: [ - { - name: 'resolve segment modules', - kind: 0, - attributes: { - 'next.span_name': 'resolve segment modules', - 'next.span_type': - 'NextNodeServer.getLayoutOrPageModule', - 'next.segment': '__PAGE__', - }, - status: { code: 0 }, + await expectTrace(getCollector(), [ + { + traceId: env.span.traceId, + parentId: env.span.rootParentId, + runtime: 'edge', + name: 'GET /app/[param]/rsc-fetch/edge', + kind: 1, + attributes: { + 'next.span_name': 'GET /app/[param]/rsc-fetch/edge', + 'next.span_type': 'BaseServer.handleRequest', + 'http.method': 'GET', + 'http.target': '/app/param/rsc-fetch/edge?param=param', + 'http.status_code': 200, + 'next.route': '/app/[param]/rsc-fetch/edge', + 'http.route': '/app/[param]/rsc-fetch/edge', + }, + status: { code: 0 }, + spans: [ + { + name: 'render route (app) /app/[param]/rsc-fetch/edge', + kind: 0, + attributes: { + 'next.span_name': + 'render route (app) /app/[param]/rsc-fetch/edge', + 'next.span_type': 'AppRender.getBodyResult', + 'next.route': '/app/[param]/rsc-fetch/edge', + }, + status: { code: 0 }, + spans: [ + { + name: 'build component tree', + kind: 0, + attributes: { + 'next.span_name': 'build component tree', + 'next.span_type': + 'NextNodeServer.createComponentTree', }, - { - name: 'resolve segment modules', - kind: 0, - attributes: { - 'next.span_name': 'resolve segment modules', - 'next.span_type': - 'NextNodeServer.getLayoutOrPageModule', - 'next.segment': '[param]', + status: { code: 0 }, + spans: [ + { + name: 'resolve segment modules', + kind: 0, + attributes: { + 'next.span_name': 'resolve segment modules', + 'next.span_type': + 'NextNodeServer.getLayoutOrPageModule', + 'next.segment': '__PAGE__', + }, + status: { code: 0 }, }, - status: { code: 0 }, + { + name: 'resolve segment modules', + kind: 0, + attributes: { + 'next.span_name': 'resolve segment modules', + 'next.span_type': + 'NextNodeServer.getLayoutOrPageModule', + 'next.segment': '[param]', + }, + status: { code: 0 }, + }, + ], + }, + { + name: 'fetch GET https://example.vercel.sh/', + kind: 2, + attributes: { + 'next.span_name': + 'fetch GET https://example.vercel.sh/', + 'next.span_type': 'AppRender.fetch', + 'http.url': 'https://example.vercel.sh/', + 'http.method': 'GET', + 'net.peer.name': 'example.vercel.sh', }, - ], - }, - { - name: 'fetch GET https://example.vercel.sh/', - kind: 2, - attributes: { - 'next.span_name': - 'fetch GET https://example.vercel.sh/', - 'next.span_type': 'AppRender.fetch', - 'http.url': 'https://example.vercel.sh/', - 'http.method': 'GET', - 'net.peer.name': 'example.vercel.sh', + status: { code: 0 }, }, - status: { code: 0 }, - }, - { - name: 'generateMetadata /app/[param]/layout', - kind: 0, - attributes: { - 'next.span_name': - 'generateMetadata /app/[param]/layout', - 'next.span_type': 'ResolveMetadata.generateMetadata', - 'next.page': '/app/[param]/layout', + { + name: 'generateMetadata /app/[param]/layout', + kind: 0, + attributes: { + 'next.span_name': + 'generateMetadata /app/[param]/layout', + 'next.span_type': 'ResolveMetadata.generateMetadata', + 'next.page': '/app/[param]/layout', + }, + status: { code: 0 }, }, - status: { code: 0 }, - }, - { - name: 'generateMetadata /app/[param]/rsc-fetch/edge/page', - kind: 0, - attributes: { - 'next.span_name': - 'generateMetadata /app/[param]/rsc-fetch/edge/page', - 'next.span_type': 'ResolveMetadata.generateMetadata', - 'next.page': '/app/[param]/rsc-fetch/edge/page', + { + name: 'generateMetadata /app/[param]/rsc-fetch/edge/page', + kind: 0, + attributes: { + 'next.span_name': + 'generateMetadata /app/[param]/rsc-fetch/edge/page', + 'next.span_type': 'ResolveMetadata.generateMetadata', + 'next.page': '/app/[param]/rsc-fetch/edge/page', + }, + status: { code: 0 }, }, - status: { code: 0 }, - }, - ], - }, - ], - }, - - // TODO: what is this trace? What's the value in it? - { - traceId: env.span.traceId, - parentId: env.span.rootParentId, - runtime: 'nodejs', - name: 'GET /app/param/rsc-fetch/edge', - kind: 1, - attributes: { - 'next.span_name': 'GET /app/param/rsc-fetch/edge', - 'next.span_type': 'BaseServer.handleRequest', - 'http.method': 'GET', - 'http.target': '/app/param/rsc-fetch/edge', - 'http.status_code': 200, - }, - status: { code: 0 }, - spans: [ - { - name: 'start response', - kind: 0, - attributes: { - 'next.span_name': 'start response', - 'next.span_type': 'NextNodeServer.startResponse', + ], }, - status: { code: 0 }, - }, - ], - }, - ]) - }) + ], + }, - it('should handle RSC with fetch in RSC mode', async () => { - await next.fetch('/app/param/rsc-fetch', { - ...env.fetchInit, - headers: { - ...env.fetchInit?.headers, - Rsc: '1', - }, + // TODO: what is this trace? What's the value in it? + { + traceId: env.span.traceId, + parentId: env.span.rootParentId, + runtime: 'nodejs', + name: 'GET /app/param/rsc-fetch/edge', + kind: 1, + attributes: { + 'next.span_name': 'GET /app/param/rsc-fetch/edge', + 'next.span_type': 'BaseServer.handleRequest', + 'http.method': 'GET', + 'http.target': '/app/param/rsc-fetch/edge', + 'http.status_code': 200, + }, + status: { code: 0 }, + spans: [ + { + name: 'start response', + kind: 0, + attributes: { + 'next.span_name': 'start response', + 'next.span_type': 'NextNodeServer.startResponse', + }, + status: { code: 0 }, + }, + ], + }, + ]) }) - await expectTrace(getCollector(), [ - { - runtime: 'nodejs', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'RSC GET /app/[param]/rsc-fetch', - attributes: { - 'http.method': 'GET', - 'http.route': '/app/[param]/rsc-fetch', - 'http.status_code': 200, - 'http.target': '/app/param/rsc-fetch', - 'next.route': '/app/[param]/rsc-fetch', - 'next.rsc': true, - 'next.span_name': 'RSC GET /app/[param]/rsc-fetch', - 'next.span_type': 'BaseServer.handleRequest', + it('should handle RSC with fetch in RSC mode', async () => { + await next.fetch('/app/param/rsc-fetch', { + ...env.fetchInit, + headers: { + ...env.fetchInit?.headers, + Rsc: '1', }, - kind: 1, - status: { code: 0 }, - }, - ]) - }) - - it('should handle route handlers in app router', async () => { - await next.fetch('/api/app/param/data', env.fetchInit) + }) - await expectTrace(getCollector(), [ - { - name: 'GET /api/app/[param]/data/route', - attributes: { - 'http.method': 'GET', - 'http.route': '/api/app/[param]/data/route', - 'http.status_code': 200, - 'http.target': '/api/app/param/data', - 'next.route': '/api/app/[param]/data/route', - 'next.span_name': 'GET /api/app/[param]/data/route', - 'next.span_type': 'BaseServer.handleRequest', + await expectTrace(getCollector(), [ + { + runtime: 'nodejs', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'RSC GET /app/[param]/rsc-fetch', + attributes: { + 'http.method': 'GET', + 'http.route': '/app/[param]/rsc-fetch', + 'http.status_code': 200, + 'http.target': '/app/param/rsc-fetch', + 'next.route': '/app/[param]/rsc-fetch', + 'next.rsc': true, + 'next.span_name': 'RSC GET /app/[param]/rsc-fetch', + 'next.span_type': 'BaseServer.handleRequest', + }, + kind: 1, + status: { code: 0 }, }, - kind: 1, - status: { code: 0 }, - traceId: env.span.traceId, - parentId: env.span.rootParentId, - spans: [ - { - name: 'executing api route (app) /api/app/[param]/data/route', - attributes: { - 'next.route': '/api/app/[param]/data/route', - 'next.span_name': - 'executing api route (app) /api/app/[param]/data/route', - 'next.span_type': 'AppRouteRouteHandlers.runHandler', - }, - kind: 0, - status: { code: 0 }, + ]) + }) + + it('should handle route handlers in app router', async () => { + await next.fetch('/api/app/param/data', env.fetchInit) + + await expectTrace(getCollector(), [ + { + name: 'GET /api/app/[param]/data/route', + attributes: { + 'http.method': 'GET', + 'http.route': '/api/app/[param]/data/route', + 'http.status_code': 200, + 'http.target': '/api/app/param/data', + 'next.route': '/api/app/[param]/data/route', + 'next.span_name': 'GET /api/app/[param]/data/route', + 'next.span_type': 'BaseServer.handleRequest', }, - { - name: 'resolve page components', - attributes: { - 'next.route': '/api/app/[param]/data', - 'next.span_name': 'resolve page components', - 'next.span_type': 'NextNodeServer.findPageComponents', + kind: 1, + status: { code: 0 }, + traceId: env.span.traceId, + parentId: env.span.rootParentId, + spans: [ + { + name: 'executing api route (app) /api/app/[param]/data/route', + attributes: { + 'next.route': '/api/app/[param]/data/route', + 'next.span_name': + 'executing api route (app) /api/app/[param]/data/route', + 'next.span_type': 'AppRouteRouteHandlers.runHandler', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - { - name: 'start response', - attributes: { - 'next.span_name': 'start response', - 'next.span_type': 'NextNodeServer.startResponse', + { + name: 'resolve page components', + attributes: { + 'next.route': '/api/app/[param]/data', + 'next.span_name': 'resolve page components', + 'next.span_type': 'NextNodeServer.findPageComponents', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - ], - }, - ]) - }) + { + name: 'start response', + attributes: { + 'next.span_name': 'start response', + 'next.span_type': 'NextNodeServer.startResponse', + }, + kind: 0, + status: { code: 0 }, + }, + ], + }, + ]) + }) - it('should handle route handlers in app router on edge', async () => { - await next.fetch('/api/app/param/data/edge', env.fetchInit) + it('should handle route handlers in app router on edge', async () => { + await next.fetch('/api/app/param/data/edge', env.fetchInit) - await expectTrace(getCollector(), [ - { - runtime: 'edge', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'executing api route (app) /api/app/[param]/data/edge/route', - attributes: { - 'next.route': '/api/app/[param]/data/edge/route', - 'next.span_name': - 'executing api route (app) /api/app/[param]/data/edge/route', - 'next.span_type': 'AppRouteRouteHandlers.runHandler', + await expectTrace(getCollector(), [ + { + runtime: 'edge', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'executing api route (app) /api/app/[param]/data/edge/route', + attributes: { + 'next.route': '/api/app/[param]/data/edge/route', + 'next.span_name': + 'executing api route (app) /api/app/[param]/data/edge/route', + 'next.span_type': 'AppRouteRouteHandlers.runHandler', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - // TODO: what is this trace? What's the value in it? - { - runtime: 'nodejs', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'GET /api/app/param/data/edge', - kind: 1, - attributes: { - 'next.span_name': 'GET /api/app/param/data/edge', - 'next.span_type': 'BaseServer.handleRequest', - 'http.method': 'GET', - 'http.target': '/api/app/param/data/edge', - 'http.status_code': 200, - }, - status: { code: 0 }, - spans: [ - { - name: 'start response', - kind: 0, - attributes: { - 'next.span_name': 'start response', - 'next.span_type': 'NextNodeServer.startResponse', - }, - status: { code: 0 }, + // TODO: what is this trace? What's the value in it? + { + runtime: 'nodejs', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'GET /api/app/param/data/edge', + kind: 1, + attributes: { + 'next.span_name': 'GET /api/app/param/data/edge', + 'next.span_type': 'BaseServer.handleRequest', + 'http.method': 'GET', + 'http.target': '/api/app/param/data/edge', + 'http.status_code': 200, }, - ], - }, - ]) - }) + status: { code: 0 }, + spans: [ + { + name: 'start response', + kind: 0, + attributes: { + 'next.span_name': 'start response', + 'next.span_type': 'NextNodeServer.startResponse', + }, + status: { code: 0 }, + }, + ], + }, + ]) + }) - it('should trace middleware', async () => { - await next.fetch('/behind-middleware', env.fetchInit) + it('should trace middleware', async () => { + await next.fetch('/behind-middleware', env.fetchInit) - await expectTrace(getCollector(), [ - { - runtime: 'edge', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'middleware GET /behind-middleware', - attributes: { - 'http.method': 'GET', - 'http.target': '/behind-middleware', - 'next.span_name': 'middleware GET /behind-middleware', - 'next.span_type': 'Middleware.execute', + await expectTrace(getCollector(), [ + { + runtime: 'edge', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'middleware GET /behind-middleware', + attributes: { + 'http.method': 'GET', + 'http.target': '/behind-middleware', + 'next.span_name': 'middleware GET /behind-middleware', + 'next.span_type': 'Middleware.execute', + }, + status: { code: 0 }, + spans: [], }, - status: { code: 0 }, - spans: [], - }, - { - runtime: 'nodejs', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'GET /behind-middleware', - attributes: { - 'http.method': 'GET', - 'http.route': '/behind-middleware', - 'http.status_code': 200, - 'http.target': '/behind-middleware', - 'next.route': '/behind-middleware', - 'next.span_name': 'GET /behind-middleware', - 'next.span_type': 'BaseServer.handleRequest', + { + runtime: 'nodejs', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'GET /behind-middleware', + attributes: { + 'http.method': 'GET', + 'http.route': '/behind-middleware', + 'http.status_code': 200, + 'http.target': '/behind-middleware', + 'next.route': '/behind-middleware', + 'next.span_name': 'GET /behind-middleware', + 'next.span_type': 'BaseServer.handleRequest', + }, }, - }, - ]) + ]) + }) }) - }) - describe('pages', () => { - it('should handle getServerSideProps', async () => { - await next.fetch('/pages/param/getServerSideProps', env.fetchInit) + describe('pages', () => { + it('should handle getServerSideProps', async () => { + await next.fetch('/pages/param/getServerSideProps', env.fetchInit) - await expectTrace(getCollector(), [ - { - name: 'GET /pages/[param]/getServerSideProps', - attributes: { - 'http.method': 'GET', - 'http.route': '/pages/[param]/getServerSideProps', - 'http.status_code': 200, - 'http.target': '/pages/param/getServerSideProps', - 'next.route': '/pages/[param]/getServerSideProps', - 'next.span_name': 'GET /pages/[param]/getServerSideProps', - 'next.span_type': 'BaseServer.handleRequest', - }, - kind: 1, - status: { code: 0 }, - traceId: env.span.traceId, - parentId: env.span.rootParentId, - spans: [ - { - name: 'getServerSideProps /pages/[param]/getServerSideProps', - attributes: { - 'next.route': '/pages/[param]/getServerSideProps', - 'next.span_name': - 'getServerSideProps /pages/[param]/getServerSideProps', - 'next.span_type': 'Render.getServerSideProps', - }, - kind: 0, - status: { code: 0 }, + await expectTrace(getCollector(), [ + { + name: 'GET /pages/[param]/getServerSideProps', + attributes: { + 'http.method': 'GET', + 'http.route': '/pages/[param]/getServerSideProps', + 'http.status_code': 200, + 'http.target': '/pages/param/getServerSideProps', + 'next.route': '/pages/[param]/getServerSideProps', + 'next.span_name': 'GET /pages/[param]/getServerSideProps', + 'next.span_type': 'BaseServer.handleRequest', }, - { - name: 'render route (pages) /pages/[param]/getServerSideProps', - attributes: { - 'next.route': '/pages/[param]/getServerSideProps', - 'next.span_name': - 'render route (pages) /pages/[param]/getServerSideProps', - 'next.span_type': 'Render.renderDocument', + kind: 1, + status: { code: 0 }, + traceId: env.span.traceId, + parentId: env.span.rootParentId, + spans: [ + { + name: 'getServerSideProps /pages/[param]/getServerSideProps', + attributes: { + 'next.route': '/pages/[param]/getServerSideProps', + 'next.span_name': + 'getServerSideProps /pages/[param]/getServerSideProps', + 'next.span_type': 'Render.getServerSideProps', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - { - name: 'resolve page components', - attributes: { - 'next.route': '/pages/[param]/getServerSideProps', - 'next.span_name': 'resolve page components', - 'next.span_type': 'NextNodeServer.findPageComponents', + { + name: 'render route (pages) /pages/[param]/getServerSideProps', + attributes: { + 'next.route': '/pages/[param]/getServerSideProps', + 'next.span_name': + 'render route (pages) /pages/[param]/getServerSideProps', + 'next.span_type': 'Render.renderDocument', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - ], - }, - ]) - }) + { + name: 'resolve page components', + attributes: { + 'next.route': '/pages/[param]/getServerSideProps', + 'next.span_name': 'resolve page components', + 'next.span_type': 'NextNodeServer.findPageComponents', + }, + kind: 0, + status: { code: 0 }, + }, + ], + }, + ]) + }) - it("should handle getStaticProps when fallback: 'blocking'", async () => { - const v = env.span.rootParentId ? '2' : '' - await next.fetch(`/pages/param/getStaticProps${v}`, env.fetchInit) + it("should handle getStaticProps when fallback: 'blocking'", async () => { + const v = env.span.rootParentId ? '2' : '' + await next.fetch(`/pages/param/getStaticProps${v}`, env.fetchInit) - await expectTrace(getCollector(), [ - { - name: `GET /pages/[param]/getStaticProps${v}`, - attributes: { - 'http.method': 'GET', - 'http.route': `/pages/[param]/getStaticProps${v}`, - 'http.status_code': 200, - 'http.target': `/pages/param/getStaticProps${v}`, - 'next.route': `/pages/[param]/getStaticProps${v}`, - 'next.span_name': `GET /pages/[param]/getStaticProps${v}`, - 'next.span_type': 'BaseServer.handleRequest', - }, - kind: 1, - status: { code: 0 }, - traceId: env.span.traceId, - parentId: env.span.rootParentId, - spans: [ - { - name: `getStaticProps /pages/[param]/getStaticProps${v}`, - attributes: { - 'next.route': `/pages/[param]/getStaticProps${v}`, - 'next.span_name': `getStaticProps /pages/[param]/getStaticProps${v}`, - 'next.span_type': 'Render.getStaticProps', - }, - kind: 0, - status: { code: 0 }, + await expectTrace(getCollector(), [ + { + name: `GET /pages/[param]/getStaticProps${v}`, + attributes: { + 'http.method': 'GET', + 'http.route': `/pages/[param]/getStaticProps${v}`, + 'http.status_code': 200, + 'http.target': `/pages/param/getStaticProps${v}`, + 'next.route': `/pages/[param]/getStaticProps${v}`, + 'next.span_name': `GET /pages/[param]/getStaticProps${v}`, + 'next.span_type': 'BaseServer.handleRequest', }, - { - name: `render route (pages) /pages/[param]/getStaticProps${v}`, - attributes: { - 'next.route': `/pages/[param]/getStaticProps${v}`, - 'next.span_name': `render route (pages) /pages/[param]/getStaticProps${v}`, - 'next.span_type': 'Render.renderDocument', + kind: 1, + status: { code: 0 }, + traceId: env.span.traceId, + parentId: env.span.rootParentId, + spans: [ + { + name: `getStaticProps /pages/[param]/getStaticProps${v}`, + attributes: { + 'next.route': `/pages/[param]/getStaticProps${v}`, + 'next.span_name': `getStaticProps /pages/[param]/getStaticProps${v}`, + 'next.span_type': 'Render.getStaticProps', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - { - name: 'resolve page components', - attributes: { - 'next.route': `/pages/[param]/getStaticProps${v}`, - 'next.span_name': 'resolve page components', - 'next.span_type': 'NextNodeServer.findPageComponents', + { + name: `render route (pages) /pages/[param]/getStaticProps${v}`, + attributes: { + 'next.route': `/pages/[param]/getStaticProps${v}`, + 'next.span_name': `render route (pages) /pages/[param]/getStaticProps${v}`, + 'next.span_type': 'Render.renderDocument', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - ], - }, - ]) - }) + { + name: 'resolve page components', + attributes: { + 'next.route': `/pages/[param]/getStaticProps${v}`, + 'next.span_name': 'resolve page components', + 'next.span_type': 'NextNodeServer.findPageComponents', + }, + kind: 0, + status: { code: 0 }, + }, + ], + }, + ]) + }) - it('should handle getServerSideProps on edge', async () => { - await next.fetch( - '/pages/param/edge/getServerSideProps', - env.fetchInit - ) + it('should handle getServerSideProps on edge', async () => { + await next.fetch( + '/pages/param/edge/getServerSideProps', + env.fetchInit + ) - await expectTrace(getCollector(), [ - { - runtime: 'edge', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'GET /pages/[param]/edge/getServerSideProps', - kind: 1, - attributes: { - 'next.span_name': 'GET /pages/[param]/edge/getServerSideProps', - 'next.span_type': 'BaseServer.handleRequest', - 'http.method': 'GET', - 'http.target': - '/pages/param/edge/getServerSideProps?param=param', - 'http.status_code': 200, - 'next.route': '/pages/[param]/edge/getServerSideProps', - 'http.route': '/pages/[param]/edge/getServerSideProps', - }, - status: { code: 0 }, - spans: [ - { - name: 'getServerSideProps /pages/[param]/edge/getServerSideProps', - kind: 0, - attributes: { - 'next.span_name': - 'getServerSideProps /pages/[param]/edge/getServerSideProps', - 'next.span_type': 'Render.getServerSideProps', - 'next.route': '/pages/[param]/edge/getServerSideProps', - }, - status: { code: 0 }, + await expectTrace(getCollector(), [ + { + runtime: 'edge', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'GET /pages/[param]/edge/getServerSideProps', + kind: 1, + attributes: { + 'next.span_name': + 'GET /pages/[param]/edge/getServerSideProps', + 'next.span_type': 'BaseServer.handleRequest', + 'http.method': 'GET', + 'http.target': + '/pages/param/edge/getServerSideProps?param=param', + 'http.status_code': 200, + 'next.route': '/pages/[param]/edge/getServerSideProps', + 'http.route': '/pages/[param]/edge/getServerSideProps', }, - { - name: 'render route (pages) /pages/[param]/edge/getServerSideProps', - kind: 0, - attributes: { - 'next.span_name': - 'render route (pages) /pages/[param]/edge/getServerSideProps', - 'next.span_type': 'Render.renderDocument', - 'next.route': '/pages/[param]/edge/getServerSideProps', + status: { code: 0 }, + spans: [ + { + name: 'getServerSideProps /pages/[param]/edge/getServerSideProps', + kind: 0, + attributes: { + 'next.span_name': + 'getServerSideProps /pages/[param]/edge/getServerSideProps', + 'next.span_type': 'Render.getServerSideProps', + 'next.route': '/pages/[param]/edge/getServerSideProps', + }, + status: { code: 0 }, }, - status: { code: 0 }, - }, - ], - }, - - // TODO: what is this trace? What's the value in it? - { - runtime: 'nodejs', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'GET /pages/param/edge/getServerSideProps', - kind: 1, - attributes: { - 'next.span_name': 'GET /pages/param/edge/getServerSideProps', - 'next.span_type': 'BaseServer.handleRequest', - 'http.method': 'GET', - 'http.target': '/pages/param/edge/getServerSideProps', - 'http.status_code': 200, - }, - status: { code: 0 }, - spans: [ - { - name: 'start response', - kind: 0, - attributes: { - 'next.span_name': 'start response', - 'next.span_type': 'NextNodeServer.startResponse', + { + name: 'render route (pages) /pages/[param]/edge/getServerSideProps', + kind: 0, + attributes: { + 'next.span_name': + 'render route (pages) /pages/[param]/edge/getServerSideProps', + 'next.span_type': 'Render.renderDocument', + 'next.route': '/pages/[param]/edge/getServerSideProps', + }, + status: { code: 0 }, }, - status: { code: 0 }, + ], + }, + + // TODO: what is this trace? What's the value in it? + { + runtime: 'nodejs', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'GET /pages/param/edge/getServerSideProps', + kind: 1, + attributes: { + 'next.span_name': 'GET /pages/param/edge/getServerSideProps', + 'next.span_type': 'BaseServer.handleRequest', + 'http.method': 'GET', + 'http.target': '/pages/param/edge/getServerSideProps', + 'http.status_code': 200, }, - ], - }, - ]) - }) + status: { code: 0 }, + spans: [ + { + name: 'start response', + kind: 0, + attributes: { + 'next.span_name': 'start response', + 'next.span_type': 'NextNodeServer.startResponse', + }, + status: { code: 0 }, + }, + ], + }, + ]) + }) - it('should handle api routes in pages', async () => { - await next.fetch('/api/pages/param/basic', env.fetchInit) + it('should handle api routes in pages', async () => { + await next.fetch('/api/pages/param/basic', env.fetchInit) - await expectTrace(getCollector(), [ - { - name: 'GET /api/pages/[param]/basic', - attributes: { - 'http.method': 'GET', - 'http.route': '/api/pages/[param]/basic', - 'http.status_code': 200, - 'http.target': '/api/pages/param/basic', - 'next.route': '/api/pages/[param]/basic', - 'next.span_name': 'GET /api/pages/[param]/basic', - 'next.span_type': 'BaseServer.handleRequest', - }, - kind: 1, - status: { code: 0 }, - traceId: env.span.traceId, - parentId: env.span.rootParentId, - spans: [ - { - name: 'executing api route (pages) /api/pages/[param]/basic', - attributes: { - 'next.span_name': - 'executing api route (pages) /api/pages/[param]/basic', - 'next.span_type': 'Node.runHandler', - }, - kind: 0, - status: { code: 0 }, + await expectTrace(getCollector(), [ + { + name: 'GET /api/pages/[param]/basic', + attributes: { + 'http.method': 'GET', + 'http.route': '/api/pages/[param]/basic', + 'http.status_code': 200, + 'http.target': '/api/pages/param/basic', + 'next.route': '/api/pages/[param]/basic', + 'next.span_name': 'GET /api/pages/[param]/basic', + 'next.span_type': 'BaseServer.handleRequest', }, - ], - }, - ]) - }) + kind: 1, + status: { code: 0 }, + traceId: env.span.traceId, + parentId: env.span.rootParentId, + spans: [ + { + name: 'executing api route (pages) /api/pages/[param]/basic', + attributes: { + 'next.span_name': + 'executing api route (pages) /api/pages/[param]/basic', + 'next.span_type': 'Node.runHandler', + }, + kind: 0, + status: { code: 0 }, + }, + ], + }, + ]) + }) - it('should handle api routes in pages on edge', async () => { - await next.fetch('/api/pages/param/edge', env.fetchInit) + it('should handle api routes in pages on edge', async () => { + await next.fetch('/api/pages/param/edge', env.fetchInit) - await expectTrace(getCollector(), [ - { - runtime: 'edge', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'executing api route (pages) /api/pages/[param]/edge', - attributes: { - 'next.span_name': - 'executing api route (pages) /api/pages/[param]/edge', - 'next.span_type': 'Node.runHandler', + await expectTrace(getCollector(), [ + { + runtime: 'edge', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'executing api route (pages) /api/pages/[param]/edge', + attributes: { + 'next.span_name': + 'executing api route (pages) /api/pages/[param]/edge', + 'next.span_type': 'Node.runHandler', + }, + kind: 0, + status: { code: 0 }, }, - kind: 0, - status: { code: 0 }, - }, - // TODO: what is this trace? What's the value in it? - { - runtime: 'nodejs', - traceId: env.span.traceId, - parentId: env.span.rootParentId, - name: 'GET /api/pages/param/edge', - kind: 1, - attributes: { - 'next.span_name': 'GET /api/pages/param/edge', - 'next.span_type': 'BaseServer.handleRequest', - 'http.method': 'GET', - 'http.target': '/api/pages/param/edge', - 'http.status_code': 200, - }, - status: { code: 0 }, - spans: [ - { - name: 'start response', - kind: 0, - attributes: { - 'next.span_name': 'start response', - 'next.span_type': 'NextNodeServer.startResponse', - }, - status: { code: 0 }, + // TODO: what is this trace? What's the value in it? + { + runtime: 'nodejs', + traceId: env.span.traceId, + parentId: env.span.rootParentId, + name: 'GET /api/pages/param/edge', + kind: 1, + attributes: { + 'next.span_name': 'GET /api/pages/param/edge', + 'next.span_type': 'BaseServer.handleRequest', + 'http.method': 'GET', + 'http.target': '/api/pages/param/edge', + 'http.status_code': 200, }, - ], - }, - ]) + status: { code: 0 }, + spans: [ + { + name: 'start response', + kind: 0, + attributes: { + 'next.span_name': 'start response', + 'next.span_type': 'NextNodeServer.startResponse', + }, + status: { code: 0 }, + }, + ], + }, + ]) + }) }) - }) - }) + } + ) } }) @@ -841,58 +845,57 @@ describe('opentelemetry with disabled fetch tracing', () => { afterEach(async () => { await collector.shutdown() }) + ;(process.env.__NEXT_EXPERIMENTAL_PPR ? describe.skip : describe)( + 'root context', + () => { + describe('app router with disabled fetch', () => { + it('should handle RSC with disabled fetch', async () => { + await next.fetch('/app/param/rsc-fetch') - // turbopack does not support instrumentation.js - ;(process.env.TURBOPACK || process.env.__NEXT_EXPERIMENTAL_PPR - ? describe.skip - : describe)('root context', () => { - describe('app router with disabled fetch', () => { - it('should handle RSC with disabled fetch', async () => { - await next.fetch('/app/param/rsc-fetch') - - await expectTrace(getCollector(), [ - { - name: 'GET /app/[param]/rsc-fetch', - traceId: '[trace-id]', - parentId: undefined, - spans: [ - { - name: 'render route (app) /app/[param]/rsc-fetch', - spans: [ - { - name: 'build component tree', - spans: [ - { - name: 'resolve segment modules', - }, - { - name: 'resolve segment modules', - }, - ], - }, - { - name: 'generateMetadata /app/[param]/layout', - }, - { - name: 'generateMetadata /app/[param]/rsc-fetch/page', - }, - { - name: 'NextNodeServer.clientComponentLoading', - }, - { - name: 'start response', - }, - ], - }, - { - name: 'resolve page components', - }, - ], - }, - ]) + await expectTrace(getCollector(), [ + { + name: 'GET /app/[param]/rsc-fetch', + traceId: '[trace-id]', + parentId: undefined, + spans: [ + { + name: 'render route (app) /app/[param]/rsc-fetch', + spans: [ + { + name: 'build component tree', + spans: [ + { + name: 'resolve segment modules', + }, + { + name: 'resolve segment modules', + }, + ], + }, + { + name: 'generateMetadata /app/[param]/layout', + }, + { + name: 'generateMetadata /app/[param]/rsc-fetch/page', + }, + { + name: 'NextNodeServer.clientComponentLoading', + }, + { + name: 'start response', + }, + ], + }, + { + name: 'resolve page components', + }, + ], + }, + ]) + }) }) - }) - }) + } + ) }) type HierSavedSpan = SavedSpan & { spans?: HierSavedSpan[] } From adfdd09d53bbbd182010b45d9b69579656232466 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Mon, 25 Nov 2024 15:00:38 +0100 Subject: [PATCH 20/82] Omit unnecessary cache wrapper import (#73160) When a `"use cache"` module has no exported or annotated cache function, we can omit the import statement for the cache wrapper function. --- .../src/transforms/server_actions.rs | 47 ++++++++++--------- .../server-actions/server-graph/23/output.js | 1 - .../server-actions/server/51/output.js | 1 - .../server-actions/server/56/output.js | 3 -- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index a134ac8369f83..1262072b410c9 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -1316,9 +1316,6 @@ impl VisitMut for ServerActions { let in_cache_file = matches!(self.file_directive, Some(Directive::UseCache { .. })); let in_action_file = matches!(self.file_directive, Some(Directive::UseServer)); - self.has_action = in_action_file; - self.has_cache = in_cache_file; - if in_cache_file { // If we're in a "use cache" file, collect all original IDs from // export specifiers in a pre-pass so that we know which functions @@ -1697,13 +1694,34 @@ impl VisitMut for ServerActions { } } + let mut actions = self.export_actions.take(); + + if in_action_file || in_cache_file && !self.config.is_react_server_layer { + actions.extend( + self.exported_idents + .iter() + .map(|e| (e.1.clone(), e.2.clone())), + ); + + if !actions.is_empty() { + self.has_action |= in_action_file; + self.has_cache |= in_cache_file; + } + }; + + // Make it a hashmap of id -> name. + let actions = actions + .into_iter() + .map(|a| (a.1, a.0)) + .collect::(); + // If it's compiled in the client layer, each export field needs to be // wrapped by a reference creation call. let create_ref_ident = private_ident!("createServerReference"); let call_server_ident = private_ident!("callServer"); let find_source_map_url_ident = private_ident!("findSourceMapURL"); - if should_track_exports && !self.config.is_react_server_layer { + if (self.has_action || self.has_cache) && !self.config.is_react_server_layer { // import { // createServerReference, // callServer, @@ -1828,7 +1846,7 @@ impl VisitMut for ServerActions { // // But it's only needed for the server layer, because on the client // layer they're transformed into references already. - if self.config.is_react_server_layer { + if (self.has_action || self.has_cache) && self.config.is_react_server_layer { new.append(&mut self.extra_items); // For "use cache" files, there's no need to do extra annotations. @@ -1883,23 +1901,6 @@ impl VisitMut for ServerActions { } if self.has_action || self.has_cache { - let mut actions = self.export_actions.clone(); - - // All exported values are considered as actions if the file is an action file. - if in_action_file || in_cache_file && !self.config.is_react_server_layer { - actions.extend( - self.exported_idents - .iter() - .map(|e| (e.1.clone(), e.2.clone())), - ); - }; - - // Make it a hashmap of id -> name. - let actions = actions - .into_iter() - .map(|a| (a.1, a.0)) - .collect::(); - // Prepend a special comment to the top of the file. self.comments.add_leading( self.start_pos, @@ -1911,7 +1912,7 @@ impl VisitMut for ServerActions { ); } - // import { cache as $cache } from "private-next-rsc-cache-wrapper"; + // import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; if self.has_cache && self.config.is_react_server_layer { new.push(ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl { span: DUMMY_SP, diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js index d9446d59b1c2f..e6afdb681e4ff 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/23/output.js @@ -1,6 +1,5 @@ /* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function b() { // this is not allowed here this.foo(); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js index 60640e76dbcc7..ffebfc7ac7b7e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js @@ -1,6 +1,5 @@ /* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","609ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function $$RSC_SERVER_ACTION_0(a, b, c) { return
{a} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js index ca1e3414c1174..568492853d2a5 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/56/output.js @@ -1,6 +1,3 @@ -/* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference"; -import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; // No method nor function property should be considered a cache function. export const obj = { foo () { From 6602327c72c1024f596c7bb0f4a2c6e9f44ca128 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Mon, 25 Nov 2024 15:26:24 +0100 Subject: [PATCH 21/82] Handle server function directives in class methods (#73060) With this PR, we are allowing _static_ class methods to be annotated with `"use cache"` or `"use server"`. Class _instance_ methods on the other hand are not allowed as server functions. --- .../src/transforms/server_actions.rs | 99 +++++++++++++++++-- .../server-actions/server-graph/25/input.js | 12 +++ .../server-actions/server-graph/25/output.js | 10 ++ .../server-graph/25/output.stderr | 24 +++++ .../server-actions/server-graph/26/input.js | 13 +++ .../server-actions/server-graph/26/output.js | 19 ++++ .../server-graph/26/output.stderr | 16 +++ .../fixture/server-actions/server/57/input.js | 12 +++ .../server-actions/server/57/output.js | 17 ++++ .../app/static-class-method/cached.ts | 8 ++ .../app/static-class-method/form.tsx | 18 ++++ .../app/static-class-method/page.tsx | 6 ++ test/e2e/app-dir/use-cache/use-cache.test.ts | 21 ++++ 13 files changed, 266 insertions(+), 9 deletions(-) create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/input.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.stderr create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/input.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.js create mode 100644 crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.stderr create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/57/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/57/output.js create mode 100644 test/e2e/app-dir/use-cache/app/static-class-method/cached.ts create mode 100644 test/e2e/app-dir/use-cache/app/static-class-method/form.tsx create mode 100644 test/e2e/app-dir/use-cache/app/static-class-method/page.tsx diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index 1262072b410c9..634650c093ed1 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -67,9 +67,15 @@ enum ServerActionsErrorKind { span: Span, directive: Directive, }, + InlineUseCacheInClassInstanceMethod { + span: Span, + }, InlineUseCacheInClientComponent { span: Span, }, + InlineUseServerInClassInstanceMethod { + span: Span, + }, InlineUseServerInClientComponent { span: Span, }, @@ -903,10 +909,9 @@ impl ServerActions { impl VisitMut for ServerActions { fn visit_mut_export_decl(&mut self, decl: &mut ExportDecl) { - let old = self.in_exported_expr; - self.in_exported_expr = true; + let old_in_exported_expr = replace(&mut self.in_exported_expr, true); decl.decl.visit_mut_with(self); - self.in_exported_expr = old; + self.in_exported_expr = old_in_exported_expr; } fn visit_mut_export_default_decl(&mut self, decl: &mut ExportDefaultDecl) { @@ -1231,12 +1236,11 @@ impl VisitMut for ServerActions { self.in_exported_expr = old_in_exported_expr; self.this_status = old_this_status; - if let Some(expr) = &self.rewrite_expr_to_proxy_expr { + if let Some(expr) = self.rewrite_expr_to_proxy_expr.take() { *n = PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { key, - value: expr.clone(), + value: expr, }))); - self.rewrite_expr_to_proxy_expr = None; } return; @@ -1259,6 +1263,66 @@ impl VisitMut for ServerActions { self.in_exported_expr = old_in_exported_expr; } + fn visit_mut_class_member(&mut self, n: &mut ClassMember) { + if let ClassMember::Method(ClassMethod { + is_abstract: false, + is_static: true, + kind: MethodKind::Method, + key, + span, + accessibility: None | Some(Accessibility::Public), + .. + }) = n + { + let key = key.clone(); + let span = *span; + let old_arrow_or_fn_expr_ident = self.arrow_or_fn_expr_ident.clone(); + + if let PropName::Ident(ident_name) = &key { + self.arrow_or_fn_expr_ident = Some(ident_name.clone().into()); + } + + let old_this_status = replace(&mut self.this_status, ThisStatus::Allowed); + self.rewrite_expr_to_proxy_expr = None; + self.in_exported_expr = false; + n.visit_mut_children_with(self); + self.this_status = old_this_status; + self.arrow_or_fn_expr_ident = old_arrow_or_fn_expr_ident; + + if let Some(expr) = self.rewrite_expr_to_proxy_expr.take() { + *n = ClassMember::ClassProp(ClassProp { + span, + key, + value: Some(expr), + is_static: true, + ..Default::default() + }); + } + } else { + n.visit_mut_children_with(self); + } + } + + fn visit_mut_class_method(&mut self, n: &mut ClassMethod) { + if n.is_static { + n.visit_mut_children_with(self); + } else { + let (is_action_fn, is_cache_fn) = has_body_directive(&n.function.body); + + if is_action_fn { + emit_error( + ServerActionsErrorKind::InlineUseServerInClassInstanceMethod { span: n.span }, + ); + } else if is_cache_fn { + emit_error( + ServerActionsErrorKind::InlineUseCacheInClassInstanceMethod { span: n.span }, + ); + } else { + n.visit_mut_children_with(self); + } + } + } + fn visit_mut_call_expr(&mut self, n: &mut CallExpr) { if let Callee::Expr(box Expr::Ident(Ident { sym, .. })) = &mut n.callee { if sym == "jsxDEV" || sym == "_jsxDEV" { @@ -1304,9 +1368,8 @@ impl VisitMut for ServerActions { self.rewrite_expr_to_proxy_expr = None; n.visit_mut_children_with(self); - if let Some(expr) = &self.rewrite_expr_to_proxy_expr { - *n = (**expr).clone(); - self.rewrite_expr_to_proxy_expr = None; + if let Some(expr) = self.rewrite_expr_to_proxy_expr.take() { + *n = *expr; } } @@ -2850,6 +2913,15 @@ fn emit_error(error_kind: ServerActionsErrorKind) { } }, ), + ServerActionsErrorKind::InlineUseCacheInClassInstanceMethod { span } => ( + span, + formatdoc! { + r#" + It is not allowed to define inline "use cache" annotated class instance methods. + To define cached functions, use functions, object method properties, or static class methods instead. + "# + }, + ), ServerActionsErrorKind::InlineUseCacheInClientComponent { span } => ( span, formatdoc! { @@ -2859,6 +2931,15 @@ fn emit_error(error_kind: ServerActionsErrorKind) { "# }, ), + ServerActionsErrorKind::InlineUseServerInClassInstanceMethod { span } => ( + span, + formatdoc! { + r#" + It is not allowed to define inline "use server" annotated class instance methods. + To define Server Actions, use functions, object method properties, or static class methods instead. + "# + }, + ), ServerActionsErrorKind::InlineUseServerInClientComponent { span } => ( span, formatdoc! { diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/input.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/input.js new file mode 100644 index 0000000000000..c818c2bf03a53 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/input.js @@ -0,0 +1,12 @@ +export class MyClass { + async foo() { + 'use cache' + + return fetch('https://example.com').then((res) => res.json()) + } + async bar() { + 'use server' + + console.log(42) + } +} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.js new file mode 100644 index 0000000000000..477db72fc14ad --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.js @@ -0,0 +1,10 @@ +export class MyClass { + async foo() { + 'use cache'; + return fetch('https://example.com').then((res)=>res.json()); + } + async bar() { + 'use server'; + console.log(42); + } +} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.stderr b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.stderr new file mode 100644 index 0000000000000..542bea78f37df --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/25/output.stderr @@ -0,0 +1,24 @@ + x It is not allowed to define inline "use cache" annotated class instance methods. + | To define cached functions, use functions, object method properties, or static class methods instead. + | + ,-[input.js:2:1] + 1 | export class MyClass { + 2 | ,-> async foo() { + 3 | | 'use cache' + 4 | | + 5 | | return fetch('https://example.com').then((res) => res.json()) + 6 | `-> } + 7 | async bar() { + `---- + x It is not allowed to define inline "use server" annotated class instance methods. + | To define Server Actions, use functions, object method properties, or static class methods instead. + | + ,-[input.js:7:1] + 6 | } + 7 | ,-> async bar() { + 8 | | 'use server' + 9 | | + 10 | | console.log(42) + 11 | `-> } + 12 | } + `---- diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/input.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/input.js new file mode 100644 index 0000000000000..6996bf0752c93 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/input.js @@ -0,0 +1,13 @@ +export class MyClass { + static async foo() { + return fetch('https://example.com').then((res) => res.json()) + } + static async bar() { + 'use cache' + + // arguments is not allowed here + console.log(arguments) + // this is not allowed here + return this.foo() + } +} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.js new file mode 100644 index 0000000000000..bc52378465ff1 --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.js @@ -0,0 +1,19 @@ +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", 0, /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ async function bar() { + // arguments is not allowed here + console.log(arguments); + // this is not allowed here + return this.foo(); +}); +Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { + "value": "bar", + "writable": false +}); +export class MyClass { + static async foo() { + return fetch('https://example.com').then((res)=>res.json()); + } + static bar = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); +} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.stderr b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.stderr new file mode 100644 index 0000000000000..0ec06fcce221b --- /dev/null +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/26/output.stderr @@ -0,0 +1,16 @@ + x "use cache" functions cannot use `arguments`. + | + ,-[input.js:9:1] + 8 | // arguments is not allowed here + 9 | console.log(arguments) + : ^^^^^^^^^ + 10 | // this is not allowed here + `---- + x "use cache" functions cannot use `this`. + | + ,-[input.js:11:1] + 10 | // this is not allowed here + 11 | return this.foo() + : ^^^^ + 12 | } + `---- diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/57/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/57/input.js new file mode 100644 index 0000000000000..2d588a600d449 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/57/input.js @@ -0,0 +1,12 @@ +export class MyClass { + static async foo() { + 'use cache' + + return fetch('https://example.com').then((res) => res.json()) + } + static async bar() { + 'use server' + + console.log(42) + } +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/57/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/57/output.js new file mode 100644 index 0000000000000..175231a3d2b04 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/57/output.js @@ -0,0 +1,17 @@ +/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", 0, /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ async function foo() { + return fetch('https://example.com').then((res)=>res.json()); +}); +Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { + "value": "foo", + "writable": false +}); +export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function bar() { + console.log(42); +}; +export class MyClass { + static foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); + static bar = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null); +} diff --git a/test/e2e/app-dir/use-cache/app/static-class-method/cached.ts b/test/e2e/app-dir/use-cache/app/static-class-method/cached.ts new file mode 100644 index 0000000000000..3d5c0aa004fd0 --- /dev/null +++ b/test/e2e/app-dir/use-cache/app/static-class-method/cached.ts @@ -0,0 +1,8 @@ +export class Cached { + static async getRandomValue() { + 'use cache' + const v = Math.random() + console.log(v) + return v + } +} diff --git a/test/e2e/app-dir/use-cache/app/static-class-method/form.tsx b/test/e2e/app-dir/use-cache/app/static-class-method/form.tsx new file mode 100644 index 0000000000000..bf3a36c2c803c --- /dev/null +++ b/test/e2e/app-dir/use-cache/app/static-class-method/form.tsx @@ -0,0 +1,18 @@ +'use client' + +import { useActionState } from 'react' + +export function Form({ + getRandomValue, +}: { + getRandomValue: () => Promise +}) { + const [result, formAction, isPending] = useActionState(getRandomValue, -1) + + return ( +
+ +

{isPending ? 'loading...' : result}

+
+ ) +} diff --git a/test/e2e/app-dir/use-cache/app/static-class-method/page.tsx b/test/e2e/app-dir/use-cache/app/static-class-method/page.tsx new file mode 100644 index 0000000000000..3023f48a95a4e --- /dev/null +++ b/test/e2e/app-dir/use-cache/app/static-class-method/page.tsx @@ -0,0 +1,6 @@ +import { Cached } from './cached' +import { Form } from './form' + +export default function Page() { + return
+} diff --git a/test/e2e/app-dir/use-cache/use-cache.test.ts b/test/e2e/app-dir/use-cache/use-cache.test.ts index cdafe76208da2..819f70f418302 100644 --- a/test/e2e/app-dir/use-cache/use-cache.test.ts +++ b/test/e2e/app-dir/use-cache/use-cache.test.ts @@ -431,4 +431,25 @@ describe('use-cache', () => { expect(await browser.elementByCss('#form-2 p').text()).toBe(value2) }) }) + + it('works with "use cache" in static class methods', async () => { + const browser = await next.browser('/static-class-method') + + let value = await browser.elementByCss('p').text() + + expect(value).toBe('-1') + + await browser.elementByCss('button').click() + + await retry(async () => { + value = await browser.elementByCss('p').text() + expect(value).toMatch(/\d\.\d+/) + }) + + await browser.elementByCss('button').click() + + await retry(async () => { + expect(await browser.elementByCss('p').text()).toBe(value) + }) + }) }) From 712d7c9eab896a929df69b240abf1c4511324f88 Mon Sep 17 00:00:00 2001 From: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> Date: Mon, 25 Nov 2024 07:03:41 -0800 Subject: [PATCH 22/82] 15.1 docs: `forbidden`, `unauthorized`, and `authInterrupts` (#73039) **Do not merge until https://github.com/vercel/next.js/pull/72785 lands in canary.** Closes: - https://linear.app/vercel/issue/DOC-3820/[unstable]-forbidden-and-forbiddenjs - https://linear.app/vercel/issue/DOC-3849/[unstable]-unauthorized-and-unauthorizedjs - https://linear.app/vercel/issue/DOC-3860/[experimental]-authinterrupts-config-option --- .../03-file-conventions/forbidden.mdx | 50 ++++ .../03-file-conventions/not-found.mdx | 10 +- .../03-file-conventions/unauthorized.mdx | 114 +++++++++ .../04-functions/forbidden.mdx | 172 +++++++++++++ .../04-functions/unauthorized.mdx | 230 ++++++++++++++++++ .../01-next-config-js/authInterrupts.mdx | 33 +++ 6 files changed, 606 insertions(+), 3 deletions(-) create mode 100644 docs/01-app/03-api-reference/03-file-conventions/forbidden.mdx create mode 100644 docs/01-app/03-api-reference/03-file-conventions/unauthorized.mdx create mode 100644 docs/01-app/03-api-reference/04-functions/forbidden.mdx create mode 100644 docs/01-app/03-api-reference/04-functions/unauthorized.mdx create mode 100644 docs/01-app/03-api-reference/05-config/01-next-config-js/authInterrupts.mdx diff --git a/docs/01-app/03-api-reference/03-file-conventions/forbidden.mdx b/docs/01-app/03-api-reference/03-file-conventions/forbidden.mdx new file mode 100644 index 0000000000000..de4be46954652 --- /dev/null +++ b/docs/01-app/03-api-reference/03-file-conventions/forbidden.mdx @@ -0,0 +1,50 @@ +--- +title: forbidden.js +description: API reference for the forbidden.js special file. +related: + links: + - app/api-reference/functions/forbidden +version: canary +--- + +The **forbidden** file is used to render UI when the [`forbidden`](/docs/app/api-reference/functions/forbidden) function is invoked during authentication. Along with allowing you to customize the UI, Next.js will return a `403` status code. + +```tsx filename="app/forbidden.tsx" switcher +import Link from 'next/link' + +export default function Forbidden() { + return ( +
+

Forbidden

+

You are not authorized to access this resource.

+ Return Home +
+ ) +} +``` + +```jsx filename="app/forbidden.jsx" switcher +import Link from 'next/link' + +export default function Forbidden() { + return ( +
+

Forbidden

+

You are not authorized to access this resource.

+ Return Home +
+ ) +} +``` + +## Reference + +### Props + +`forbidden.js` components do not accept any props. + +## Version History + +| Version | Changes | +| --------- | -------------------------- | +| `v15.1.0` | `forbidden.js` introduced. | diff --git a/docs/01-app/03-api-reference/03-file-conventions/not-found.mdx b/docs/01-app/03-api-reference/03-file-conventions/not-found.mdx index dd23e63c4f06d..a5b2aae9db1a6 100644 --- a/docs/01-app/03-api-reference/03-file-conventions/not-found.mdx +++ b/docs/01-app/03-api-reference/03-file-conventions/not-found.mdx @@ -33,13 +33,17 @@ export default function NotFound() { } ``` -> **Good to know**: In addition to catching expected `notFound()` errors, the root `app/not-found.js` file also handles any unmatched URLs for your whole application. This means users that visit a URL that is not handled by your app will be shown the UI exported by the `app/not-found.js` file. +## Reference -## Props +### Props `not-found.js` components do not accept any props. -## Data Fetching +> **Good to know**: In addition to catching expected `notFound()` errors, the root `app/not-found.js` file also handles any unmatched URLs for your whole application. This means users that visit a URL that is not handled by your app will be shown the UI exported by the `app/not-found.js` file. + +## Examples + +### Data Fetching By default, `not-found` is a Server Component. You can mark it as `async` to fetch and display data: diff --git a/docs/01-app/03-api-reference/03-file-conventions/unauthorized.mdx b/docs/01-app/03-api-reference/03-file-conventions/unauthorized.mdx new file mode 100644 index 0000000000000..dda9f82ea463a --- /dev/null +++ b/docs/01-app/03-api-reference/03-file-conventions/unauthorized.mdx @@ -0,0 +1,114 @@ +--- +title: unauthorized.js +description: API reference for the unauthorized.js special file. +related: + links: + - app/api-reference/functions/unauthorized +version: canary +--- + +The **unauthorized** file is used to render UI when the [`unauthorized`](/docs/app/api-reference/functions/unauthorized) function is invoked during authentication. Along with allowing you to customize the UI, Next.js will return a `401` status code. + +```tsx filename="app/unauthorized.tsx" switcher +import Login from '@/app/components/Login' + +export default function Unauthorized() { + return ( +
+

401 - Unauthorized

+

Please log in to access this page.

+ +
+ ) +} +``` + +```jsx filename="app/unauthorized.js" switcher +import Login from '@/app/components/Login' + +export default function Unauthorized() { + return ( +
+

401 - Unauthorized

+

Please log in to access this page.

+ +
+ ) +} +``` + +## Reference + +### Props + +`unauthorized.js` components do not accept any props. + +## Examples + +### Displaying login UI to unauthenticated users + +You can use [`unauthorized`](/docs/app/api-reference/functions/unauthorized) function to render the `unauthorized.js` file with a login UI. + +```tsx filename="app/dashboard/page.tsx" switcher +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/server' + +export default async function DashboardPage() { + const session = await verifySession() + + if (!session) { + unauthorized() + } + + return
Dashboard
+} +``` + +```jsx filename="app/dashboard/page.js" switcher +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/server' + +export default async function DashboardPage() { + const session = await verifySession() + + if (!session) { + unauthorized() + } + + return
Dashboard
+} +``` + +```tsx filename="app/unauthorized.tsx" switcher +import Login from '@/app/components/Login' + +export default function UnauthorizedPage() { + return ( +
+

401 - Unauthorized

+

Please log in to access this page.

+ +
+ ) +} +``` + +```jsx filename="app/unauthorized.js" switcher +import Login from '@/app/components/Login' + +export default function UnauthorizedPage() { + return ( +
+

401 - Unauthorized

+

Please log in to access this page.

+ +
+ ) +} +``` + +## Version History + +| Version | Changes | +| --------- | ----------------------------- | +| `v15.1.0` | `unauthorized.js` introduced. | diff --git a/docs/01-app/03-api-reference/04-functions/forbidden.mdx b/docs/01-app/03-api-reference/04-functions/forbidden.mdx new file mode 100644 index 0000000000000..1bb8fc118fc43 --- /dev/null +++ b/docs/01-app/03-api-reference/04-functions/forbidden.mdx @@ -0,0 +1,172 @@ +--- +title: forbidden +description: API Reference for the forbidden function. +version: canary +related: + links: + - app/api-reference/file-conventions/forbidden +--- + +The `forbidden` function throws an error that renders a Next.js 403 error page. It is useful for handling authorization errors in your application. You can customize the UI using the [`forbidden.js` file](/docs/app/api-reference/file-conventions/forbidden). + +To start using `forbidden`, enable the experimental [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts) configuration option in your `next.config.js` file: + +```ts filename="next.config.ts" switcher +import type { NextConfig } from 'next' + +const nextConfig: NextConfig = { + experimental: { + authInterrupts: true, + }, +} + +export default nextConfig +``` + +```js filename="next.config.js" switcher +module.exports = { + experimental: { + authInterrupts: true, + }, +} +``` + +`forbidden` can be used in [Server Components](/docs/app/building-your-application/rendering/server-components), [Server Actions](/docs/app/building-your-application/data-fetching/server-actions-and-mutations), and [Route Handlers](/docs/app/building-your-application/routing/route-handlers). + +```tsx filename="app/auth/route.tsx" switcher +import { verifySession } from '@/app/lib/dal' +import { forbidden } from 'next/navigation' + +export default async function AdminPage() { + const session = await verifySession() + + // Check if the user has the 'admin' role + if (session.role !== 'admin') { + forbidden() + } + + // Render the admin page for authorized users + return <> +} +``` + +```jsx filename="app/auth/route.js" switcher +import { verifySession } from '@/app/lib/dal' +import { forbidden } from 'next/navigation' + +export default async function AdminPage() { + const session = await verifySession() + + // Check if the user has the 'admin' role + if (session.role !== 'admin') { + forbidden() + } + + // Render the admin page for authorized users + return <> +} +``` + +## Good to know + +- The `forbidden` function cannot be called in the [root layout](/docs/app/building-your-application/routing/layouts-and-templates#root-layout-required). + +## Examples + +### Role-based route protection + +You can use the `forbidden` function to restrict access to certain routes based on user roles. This ensures that users who are authenticated but lack the required permissions cannot access the route. + +```tsx filename="app/admin/page.tsx" switcher +import { verifySession } from '@/app/lib/dal' +import { forbidden } from 'next/navigation' + +export default async function AdminPage() { + const session = await verifySession() + + // Check if the user has the 'admin' role + if (session.role !== 'admin') { + forbidden() + } + + // Render the admin page for authorized users + return ( +
+

Admin Dashboard

+

Welcome, {session.user.name}!

+
+ ) +} +``` + +```jsx filename="app/admin/page.js" switcher +import { verifySession } from '@/app/lib/dal' +import { forbidden } from 'next/navigation' + +export default async function AdminPage() { + const session = await verifySession() + + // Check if the user has the 'admin' role + if (session.role !== 'admin') { + forbidden() + } + + // Render the admin page for authorized users + return ( +
+

Admin Dashboard

+

Welcome, {session.user.name}!

+
+ ) +} +``` + +### Mutations with Server Actions + +When implementing mutations in Server Actions, you can use `forbidden` to only allow users with a specific role to update sensitive data. + +```tsx filename="app/auth/route.tsx" switcher +'use server' + +import { verifySession } from '@/app/lib/dal' +import { forbidden } from 'next/navigation' +import db from '@/app/lib/db' + +export async function updateRole(formData: FormData) { + const session = await verifySession() + + // Ensure only admins can update roles + if (session.role !== 'admin') { + forbidden() + } + + // Perform the role update for authorized users + // ... +} +``` + +```jsx filename="app/auth/route.js" switcher +'use server' + +import { verifySession } from '@/app/lib/dal' +import { forbidden } from 'next/navigation' +import db from '@/app/lib/db' + +export async function updateRole(formData) { + const session = await verifySession() + + // Ensure only admins can update roles + if (session.role !== 'admin') { + forbidden() + } + + // Perform the role update for authorized users + // ... +} +``` + +## Version History + +| Version | Changes | +| --------- | ----------------------- | +| `v15.1.0` | `forbidden` introduced. | diff --git a/docs/01-app/03-api-reference/04-functions/unauthorized.mdx b/docs/01-app/03-api-reference/04-functions/unauthorized.mdx new file mode 100644 index 0000000000000..5422f5458abc7 --- /dev/null +++ b/docs/01-app/03-api-reference/04-functions/unauthorized.mdx @@ -0,0 +1,230 @@ +--- +title: unauthorized +description: API Reference for the unauthorized function. +version: canary +related: + links: + - app/api-reference/file-conventions/unauthorized +--- + +The `unauthorized` function throws an error that renders a Next.js 401 error page. It is useful for handling authorization errors in your application. You can customize the UI using the [`unauthorized.js` file](/docs/app/api-reference/file-conventions/unauthorized). + +To start using `unauthorized`, enable the experimental [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts) configuration option in your `next.config.js` file: + +```ts filename="next.config.ts" switcher +import type { NextConfig } from 'next' + +const nextConfig: NextConfig = { + experimental: { + authInterrupts: true, + }, +} + +export default nextConfig +``` + +```js filename="next.config.js" switcher +module.exports = { + experimental: { + authInterrupts: true, + }, +} +``` + +`unauthorized` can be invoked in [Server Components](/docs/app/building-your-application/rendering/server-components), [Server Actions](/docs/app/building-your-application/data-fetching/server-actions-and-mutations), and [Route Handlers](/docs/app/building-your-application/routing/route-handlers). + +```tsx filename="app/dashboard/page.tsx" switcher +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' + +export default async function DashboardPage() { + const session = await verifySession() + + if (!session) { + unauthorized() + } + + // Render the dashboard for authenticated users + return ( +
+

Welcome to the Dashboard

+

Hi, {session.user.name}.

+
+ ) +} +``` + +```jsx filename="app/dashboard/page.js" switcher +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' + +export default async function DashboardPage() { + const session = await verifySession() + + if (!session) { + unauthorized() + } + + // Render the dashboard for authenticated users + return ( +
+

Welcome to the Dashboard

+

Hi, {session.user.name}.

+
+ ) +} +``` + +## Examples + +### Displaying login UI to unauthenticated users + +You can use `unauthorized` function to display the `unauthorized.js` file with a login UI. + +```tsx filename="app/dashboard/page.tsx" switcher +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' + +export default async function DashboardPage() { + const session = await verifySession() + + if (!session) { + unauthorized() + } + + return
Dashboard
+} +``` + +```jsx filename="app/dashboard/page.js" switcher +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' + +export default async function DashboardPage() { + const session = await verifySession() + + if (!session) { + unauthorized() + } + + return
Dashboard
+} +``` + +```tsx filename="app/unauthorized.tsx" switcher +import Login from '@/app/components/Login' + +export default function UnauthorizedPage() { + return ( +
+

401 - Unauthorized

+

Please log in to access this page.

+ +
+ ) +} +``` + +```jsx filename="app/unauthorized.js" switcher +import Login from '@/app/components/Login' + +export default function UnauthorizedPage() { + return ( +
+

401 - Unauthorized

+

Please log in to access this page.

+ +
+ ) +} +``` + +### Mutations with Server Actions + +You can invoke `unauthorized` in Server Actions to ensure only authenticated users can perform specific mutations. + +```ts filename="app/actions/update-profile.ts" switcher +'use server' + +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' +import db from '@/app/lib/db' + +export async function updateProfile(data: FormData) { + const session = await verifySession() + + // If the user is not authenticated, return a 401 + if (!session) { + unauthorized() + } + + // Proceed with mutation + // ... +} +``` + +```js filename="app/actions/update-profile.js" switcher +'use server' + +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' +import db from '@/app/lib/db' + +export async function updateProfile(data) { + const session = await verifySession() + + // If the user is not authenticated, return a 401 + if (!session) { + unauthorized() + } + + // Proceed with mutation + // ... +} +``` + +### Fetching data with Route Handlers + +You can use `unauthorized` in Route Handlers to ensure only authenticated users can access the endpoint. + +```tsx filename="app/api/profile/route.ts" switcher +import { NextRequest, NextResponse } from 'next/server' +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' + +export async function GET(req: NextRequest): Promise { + // Verify the user's session + const session = await verifySession() + + // If no session exists, return a 401 and render unauthorized.tsx + if (!session) { + unauthorized() + } + + // Fetch data + // ... +} +``` + +```jsx filename="app/api/profile/route.js" switcher +import { verifySession } from '@/app/lib/dal' +import { unauthorized } from 'next/navigation' + +export async function GET() { + const session = await verifySession() + + // If the user is not authenticated, return a 401 and render unauthorized.tsx + if (!session) { + unauthorized() + } + + // Fetch data + // ... +} +``` + +## Version History + +| Version | Changes | +| --------- | -------------------------- | +| `v15.1.0` | `unauthorized` introduced. | diff --git a/docs/01-app/03-api-reference/05-config/01-next-config-js/authInterrupts.mdx b/docs/01-app/03-api-reference/05-config/01-next-config-js/authInterrupts.mdx new file mode 100644 index 0000000000000..6509d0ce55017 --- /dev/null +++ b/docs/01-app/03-api-reference/05-config/01-next-config-js/authInterrupts.mdx @@ -0,0 +1,33 @@ +--- +title: authInterrupts +description: Learn how to enable the experimental `authInterrupts` configuration option to use `forbidden` and `unauthorized`. +version: canary +related: + links: + - app/api-reference/functions/forbidden + - app/api-reference/functions/unauthorized + - app/api-reference/file-conventions/forbidden + - app/api-reference/file-conventions/unauthorized +--- + +The `authInterrupts` configuration option allows you to use [`forbidden`](/docs/app/api-reference/functions/forbidden) and [`unauthorized`](/docs/app/api-reference/functions/unauthorized) APIs in your application. While these functions are experimental, you must enable the `authInterrupts` option in your `next.config.js` file to use them: + +```ts filename="next.config.ts" switcher +import type { NextConfig } from 'next' + +const nextConfig: NextConfig = { + experimental: { + authInterrupts: true, + }, +} + +export default nextConfig +``` + +```js filename="next.config.js" switcher +module.exports = { + experimental: { + authInterrupts: true, + }, +} +``` From 690dcaca713f96f7c20f9b515fdfde7ea3c527a8 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 25 Nov 2024 18:30:15 +0100 Subject: [PATCH 23/82] Enable another Turbopack build test (#73166) We forgot to update the manifest when merging the NFT PRs --- test/turbopack-build-tests-manifest.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/turbopack-build-tests-manifest.json b/test/turbopack-build-tests-manifest.json index 7ca2d256fe5dc..75052eec3f429 100644 --- a/test/turbopack-build-tests-manifest.json +++ b/test/turbopack-build-tests-manifest.json @@ -6050,9 +6050,10 @@ "passed": [ "prerender native module should render /blog/first correctly", "prerender native module should render /blog/second correctly", - "prerender native module should render index correctly" + "prerender native module should render index correctly", + "prerender native module should output traces" ], - "failed": ["prerender native module should output traces"], + "failed": [], "pending": [], "flakey": [], "runtimeError": false From 82cac697c40815fb26e80c6e989417235e803d99 Mon Sep 17 00:00:00 2001 From: Jiwon Choi Date: Tue, 26 Nov 2024 02:32:54 +0900 Subject: [PATCH 24/82] CNA: replace `.eslintrc.json` with `eslint.config.mjs` (#73162) ### Why? As we upgraded create-next-app ESLint to v9, use flat config (with compatible function) for the templates. `eslint.config.mjs`: ```mjs import { dirname } from "path"; import { fileURLToPath } from "url"; import { FlatCompat } from "@eslint/eslintrc"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, }); const eslintConfig = [...compat.extends("next/core-web-vitals")]; export default eslintConfig; ``` As `import.meta.dirname` was introduced in Node.js version v20.11.0, we can simplify to when on minimum version: ```mjs import { FlatCompat } from "@eslint/eslintrc"; const compat = new FlatCompat({ baseDirectory: import.meta.dirname, }); const eslintConfig = [...compat.extends("next/core-web-vitals")]; export default eslintConfig; ``` But best is that other dependency plugins support flat config so we can upgrade to pure Flat Config as well. Closes NDX-374 --- .../templates/app-empty/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/app-empty/js/eslintrc.json | 3 --- .../templates/app-empty/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/app-empty/ts/eslintrc.json | 3 --- .../templates/app-tw-empty/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/app-tw-empty/js/eslintrc.json | 3 --- .../templates/app-tw-empty/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/app-tw-empty/ts/eslintrc.json | 3 --- .../templates/app-tw/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/app-tw/js/eslintrc.json | 3 --- .../templates/app-tw/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/app-tw/ts/eslintrc.json | 3 --- .../templates/app/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/app/js/eslintrc.json | 3 --- .../templates/app/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/app/ts/eslintrc.json | 3 --- .../templates/default-empty/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/default-empty/js/eslintrc.json | 3 --- .../templates/default-empty/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/default-empty/ts/eslintrc.json | 3 --- .../default-tw-empty/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/default-tw-empty/js/eslintrc.json | 3 --- .../default-tw-empty/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/default-tw-empty/ts/eslintrc.json | 3 --- .../templates/default-tw/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/default-tw/js/eslintrc.json | 3 --- .../templates/default-tw/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/default-tw/ts/eslintrc.json | 3 --- .../templates/default/js/eslint.config.mjs | 14 ++++++++++++++ .../templates/default/js/eslintrc.json | 3 --- .../templates/default/ts/eslint.config.mjs | 16 ++++++++++++++++ .../templates/default/ts/eslintrc.json | 3 --- packages/create-next-app/templates/index.ts | 7 ++++--- .../create-next-app/lib/specification.ts | 5 +++-- test/integration/create-next-app/prompts.test.ts | 2 +- 35 files changed, 248 insertions(+), 54 deletions(-) create mode 100644 packages/create-next-app/templates/app-empty/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app-empty/js/eslintrc.json create mode 100644 packages/create-next-app/templates/app-empty/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app-empty/ts/eslintrc.json create mode 100644 packages/create-next-app/templates/app-tw-empty/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app-tw-empty/js/eslintrc.json create mode 100644 packages/create-next-app/templates/app-tw-empty/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app-tw-empty/ts/eslintrc.json create mode 100644 packages/create-next-app/templates/app-tw/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app-tw/js/eslintrc.json create mode 100644 packages/create-next-app/templates/app-tw/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app-tw/ts/eslintrc.json create mode 100644 packages/create-next-app/templates/app/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app/js/eslintrc.json create mode 100644 packages/create-next-app/templates/app/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/app/ts/eslintrc.json create mode 100644 packages/create-next-app/templates/default-empty/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default-empty/js/eslintrc.json create mode 100644 packages/create-next-app/templates/default-empty/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default-empty/ts/eslintrc.json create mode 100644 packages/create-next-app/templates/default-tw-empty/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default-tw-empty/js/eslintrc.json create mode 100644 packages/create-next-app/templates/default-tw-empty/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default-tw-empty/ts/eslintrc.json create mode 100644 packages/create-next-app/templates/default-tw/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default-tw/js/eslintrc.json create mode 100644 packages/create-next-app/templates/default-tw/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default-tw/ts/eslintrc.json create mode 100644 packages/create-next-app/templates/default/js/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default/js/eslintrc.json create mode 100644 packages/create-next-app/templates/default/ts/eslint.config.mjs delete mode 100644 packages/create-next-app/templates/default/ts/eslintrc.json diff --git a/packages/create-next-app/templates/app-empty/js/eslint.config.mjs b/packages/create-next-app/templates/app-empty/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app-empty/js/eslintrc.json b/packages/create-next-app/templates/app-empty/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/app-empty/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/app-empty/ts/eslint.config.mjs b/packages/create-next-app/templates/app-empty/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app-empty/ts/eslintrc.json b/packages/create-next-app/templates/app-empty/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/app-empty/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/app-tw-empty/js/eslint.config.mjs b/packages/create-next-app/templates/app-tw-empty/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app-tw-empty/js/eslintrc.json b/packages/create-next-app/templates/app-tw-empty/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/app-tw-empty/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/app-tw-empty/ts/eslint.config.mjs b/packages/create-next-app/templates/app-tw-empty/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app-tw-empty/ts/eslintrc.json b/packages/create-next-app/templates/app-tw-empty/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/app-tw-empty/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/app-tw/js/eslint.config.mjs b/packages/create-next-app/templates/app-tw/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/app-tw/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app-tw/js/eslintrc.json b/packages/create-next-app/templates/app-tw/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/app-tw/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/app-tw/ts/eslint.config.mjs b/packages/create-next-app/templates/app-tw/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/app-tw/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app-tw/ts/eslintrc.json b/packages/create-next-app/templates/app-tw/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/app-tw/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/app/js/eslint.config.mjs b/packages/create-next-app/templates/app/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/app/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app/js/eslintrc.json b/packages/create-next-app/templates/app/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/app/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/app/ts/eslint.config.mjs b/packages/create-next-app/templates/app/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/app/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/app/ts/eslintrc.json b/packages/create-next-app/templates/app/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/app/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/default-empty/js/eslint.config.mjs b/packages/create-next-app/templates/default-empty/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default-empty/js/eslintrc.json b/packages/create-next-app/templates/default-empty/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/default-empty/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/default-empty/ts/eslint.config.mjs b/packages/create-next-app/templates/default-empty/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default-empty/ts/eslintrc.json b/packages/create-next-app/templates/default-empty/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/default-empty/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/default-tw-empty/js/eslint.config.mjs b/packages/create-next-app/templates/default-tw-empty/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default-tw-empty/js/eslintrc.json b/packages/create-next-app/templates/default-tw-empty/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/default-tw-empty/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/default-tw-empty/ts/eslint.config.mjs b/packages/create-next-app/templates/default-tw-empty/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default-tw-empty/ts/eslintrc.json b/packages/create-next-app/templates/default-tw-empty/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/default-tw-empty/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/default-tw/js/eslint.config.mjs b/packages/create-next-app/templates/default-tw/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/default-tw/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default-tw/js/eslintrc.json b/packages/create-next-app/templates/default-tw/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/default-tw/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/default-tw/ts/eslint.config.mjs b/packages/create-next-app/templates/default-tw/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/default-tw/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default-tw/ts/eslintrc.json b/packages/create-next-app/templates/default-tw/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/default-tw/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/default/js/eslint.config.mjs b/packages/create-next-app/templates/default/js/eslint.config.mjs new file mode 100644 index 0000000000000..348c45a2fd821 --- /dev/null +++ b/packages/create-next-app/templates/default/js/eslint.config.mjs @@ -0,0 +1,14 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [...compat.extends("next/core-web-vitals")]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default/js/eslintrc.json b/packages/create-next-app/templates/default/js/eslintrc.json deleted file mode 100644 index bffb357a71225..0000000000000 --- a/packages/create-next-app/templates/default/js/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/packages/create-next-app/templates/default/ts/eslint.config.mjs b/packages/create-next-app/templates/default/ts/eslint.config.mjs new file mode 100644 index 0000000000000..c85fb67c463f2 --- /dev/null +++ b/packages/create-next-app/templates/default/ts/eslint.config.mjs @@ -0,0 +1,16 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), +]; + +export default eslintConfig; diff --git a/packages/create-next-app/templates/default/ts/eslintrc.json b/packages/create-next-app/templates/default/ts/eslintrc.json deleted file mode 100644 index 37224185490e6..0000000000000 --- a/packages/create-next-app/templates/default/ts/eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["next/core-web-vitals", "next/typescript"] -} diff --git a/packages/create-next-app/templates/index.ts b/packages/create-next-app/templates/index.ts index 5e564a4e1ce0b..a6b26d83a2b5c 100644 --- a/packages/create-next-app/templates/index.ts +++ b/packages/create-next-app/templates/index.ts @@ -53,7 +53,7 @@ export const installTemplate = async ({ console.log("\nInitializing project with template:", template, "\n"); const templatePath = path.join(__dirname, template, mode); const copySource = ["**"]; - if (!eslint) copySource.push("!eslintrc.json"); + if (!eslint) copySource.push("!eslint.config.mjs"); if (!tailwind) copySource.push( mode == "ts" ? "tailwind.config.ts" : "!tailwind.config.mjs", @@ -65,8 +65,7 @@ export const installTemplate = async ({ cwd: templatePath, rename(name) { switch (name) { - case "gitignore": - case "eslintrc.json": { + case "gitignore": { return `.${name}`; } // README.md is ignored by webpack-asset-relocator-loader used by ncc: @@ -232,6 +231,8 @@ export const installTemplate = async ({ ...packageJson.devDependencies, eslint: "^9", "eslint-config-next": version, + // TODO: Remove @eslint/eslintrc once eslint-config-next is pure Flat config + "@eslint/eslintrc": "^3", }; } diff --git a/test/integration/create-next-app/lib/specification.ts b/test/integration/create-next-app/lib/specification.ts index 5a18de476bf9a..66421b670516b 100644 --- a/test/integration/create-next-app/lib/specification.ts +++ b/test/integration/create-next-app/lib/specification.ts @@ -26,12 +26,13 @@ export const projectSpecification: ProjectSpecification = { global: { files: [ 'package.json', - '.eslintrc.json', + 'eslint.config.mjs', 'node_modules/next', '.gitignore', ], deps: ['next', 'react', 'react-dom'], - devDeps: ['eslint', 'eslint-config-next'], + // TODO: Remove @eslint/eslintrc once eslint-config-next is pure Flat config + devDeps: ['eslint', 'eslint-config-next', '@eslint/eslintrc'], }, default: { js: { diff --git a/test/integration/create-next-app/prompts.test.ts b/test/integration/create-next-app/prompts.test.ts index 2facdfe59ae7a..57b1c825c3823 100644 --- a/test/integration/create-next-app/prompts.test.ts +++ b/test/integration/create-next-app/prompts.test.ts @@ -194,7 +194,7 @@ describe('create-next-app prompts', () => { projectName, files: [ 'app', - '.eslintrc.json', + 'eslint.config.mjs', 'package.json', 'tailwind.config.ts', 'tsconfig.json', From 2d4d837350e15e4b6c4ab6049307dab0376dcac7 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:04:44 +0100 Subject: [PATCH 25/82] Turbopack: don't compute all paths for builds (#73036) Depends on https://github.com/vercel/next.js/pull/73010 A very small speedup, mostly noticeable in cpu time, not really in wall time ``` before: 504.86s user 73.31s system 792% cpu 1:12.93 total 522.09s user 76.70s system 778% cpu 1:16.94 total 503.73s user 68.78s system 818% cpu 1:09.92 total after: 471.20s user 61.73s system 757% cpu 1:10.33 total 481.69s user 69.05s system 805% cpu 1:08.33 total ``` --- crates/next-api/src/app.rs | 29 ++++++++++++++++++-------- crates/next-api/src/instrumentation.rs | 12 +++++++---- crates/next-api/src/middleware.rs | 29 +++++++++++++++----------- crates/next-api/src/pages.rs | 28 ++++++++++++++++++------- 4 files changed, 65 insertions(+), 33 deletions(-) diff --git a/crates/next-api/src/app.rs b/crates/next-api/src/app.rs index 0bb5248a4de4d..273c7c544855b 100644 --- a/crates/next-api/src/app.rs +++ b/crates/next-api/src/app.rs @@ -1638,17 +1638,28 @@ impl Endpoint for AppEndpoint { .project() .emit_all_output_assets(Vc::cell(output_assets)); - let node_root = this.app_project.project().node_root(); - let server_paths = all_server_paths(output_assets, node_root) + let (server_paths, client_paths) = if this + .app_project + .project() + .next_mode() .await? - .clone_value(); + .is_development() + { + let node_root = this.app_project.project().node_root(); + let server_paths = all_server_paths(output_assets, node_root) + .await? + .clone_value(); - let client_relative_root = this.app_project.project().client_relative_path(); - let client_paths = all_paths_in_root(output_assets, client_relative_root) - .into_future() - .instrument(tracing::info_span!("client_paths")) - .await? - .clone_value(); + let client_relative_root = this.app_project.project().client_relative_path(); + let client_paths = all_paths_in_root(output_assets, client_relative_root) + .into_future() + .instrument(tracing::info_span!("client_paths")) + .await? + .clone_value(); + (server_paths, client_paths) + } else { + (vec![], vec![]) + }; let written_endpoint = match *output { AppEndpointOutput::NodeJs { rsc_chunk, .. } => WrittenEndpoint::NodeJs { diff --git a/crates/next-api/src/instrumentation.rs b/crates/next-api/src/instrumentation.rs index e01514c3631bc..ef76071d2ea76 100644 --- a/crates/next-api/src/instrumentation.rs +++ b/crates/next-api/src/instrumentation.rs @@ -252,10 +252,14 @@ impl Endpoint for InstrumentationEndpoint { let _ = output_assets.resolve().await?; let _ = this.project.emit_all_output_assets(Vc::cell(output_assets)); - let node_root = this.project.node_root(); - let server_paths = all_server_paths(output_assets, node_root) - .await? - .clone_value(); + let server_paths = if this.project.next_mode().await?.is_development() { + let node_root = this.project.node_root(); + all_server_paths(output_assets, node_root) + .await? + .clone_value() + } else { + vec![] + }; Ok(WrittenEndpoint::Edge { server_paths, diff --git a/crates/next-api/src/middleware.rs b/crates/next-api/src/middleware.rs index a1bd72470654a..2d700046c94bd 100644 --- a/crates/next-api/src/middleware.rs +++ b/crates/next-api/src/middleware.rs @@ -279,18 +279,23 @@ impl Endpoint for MiddlewareEndpoint { let _ = output_assets.resolve().await?; let _ = this.project.emit_all_output_assets(Vc::cell(output_assets)); - let node_root = this.project.node_root(); - let server_paths = all_server_paths(output_assets, node_root) - .await? - .clone_value(); - - // Middleware could in theory have a client path (e.g. `new URL`). - let client_relative_root = this.project.client_relative_path(); - let client_paths = all_paths_in_root(output_assets, client_relative_root) - .into_future() - .instrument(tracing::info_span!("client_paths")) - .await? - .clone_value(); + let (server_paths, client_paths) = if this.project.next_mode().await?.is_development() { + let node_root = this.project.node_root(); + let server_paths = all_server_paths(output_assets, node_root) + .await? + .clone_value(); + + // Middleware could in theory have a client path (e.g. `new URL`). + let client_relative_root = this.project.client_relative_path(); + let client_paths = all_paths_in_root(output_assets, client_relative_root) + .into_future() + .instrument(tracing::info_span!("client_paths")) + .await? + .clone_value(); + (server_paths, client_paths) + } else { + (vec![], vec![]) + }; Ok(WrittenEndpoint::Edge { server_paths, diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index 7e974c15229ed..313cef1caef88 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -1275,16 +1275,28 @@ impl Endpoint for PageEndpoint { .emit_all_output_assets(Vc::cell(output_assets)); let node_root = this.pages_project.project().node_root(); - let server_paths = all_server_paths(output_assets, node_root) - .await? - .clone_value(); - let client_relative_root = this.pages_project.project().client_relative_path(); - let client_paths = all_paths_in_root(output_assets, client_relative_root) - .into_future() - .instrument(tracing::info_span!("client_paths")) + let (server_paths, client_paths) = if this + .pages_project + .project() + .next_mode() .await? - .clone_value(); + .is_development() + { + let server_paths = all_server_paths(output_assets, node_root) + .await? + .clone_value(); + + let client_relative_root = this.pages_project.project().client_relative_path(); + let client_paths = all_paths_in_root(output_assets, client_relative_root) + .into_future() + .instrument(tracing::info_span!("client_paths")) + .await? + .clone_value(); + (server_paths, client_paths) + } else { + (vec![], vec![]) + }; let node_root = &node_root.await?; let written_endpoint = match *output { From 6d69b0ce4d63e3d2d832915a5610f9874aafff5e Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 25 Nov 2024 13:16:14 -0500 Subject: [PATCH 26/82] Increase max cache tags to 128 (#73124) --- packages/next/src/lib/constants.ts | 2 +- test/e2e/app-dir/app-static/app-static.test.ts | 2 +- test/e2e/app-dir/app-static/app/too-many-cache-tags/page.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/next/src/lib/constants.ts b/packages/next/src/lib/constants.ts index fa5efaee99b57..e04349c03e867 100644 --- a/packages/next/src/lib/constants.ts +++ b/packages/next/src/lib/constants.ts @@ -27,7 +27,7 @@ export const NEXT_RESUME_HEADER = 'next-resume' // if these change make sure we update the related // documentation as well -export const NEXT_CACHE_TAG_MAX_ITEMS = 64 +export const NEXT_CACHE_TAG_MAX_ITEMS = 128 export const NEXT_CACHE_TAG_MAX_LENGTH = 256 export const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024 export const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_' diff --git a/test/e2e/app-dir/app-static/app-static.test.ts b/test/e2e/app-dir/app-static/app-static.test.ts index a61897bfada31..d06fb401ef852 100644 --- a/test/e2e/app-dir/app-static/app-static.test.ts +++ b/test/e2e/app-dir/app-static/app-static.test.ts @@ -128,7 +128,7 @@ describe('app-dir static/dynamic handling', () => { expect(res.status).toBe(200) await retry(() => { expect(next.cliOutput).toContain('exceeded max tag count for') - expect(next.cliOutput).toContain('tag-65') + expect(next.cliOutput).toContain('tag-129') }) }) } diff --git a/test/e2e/app-dir/app-static/app/too-many-cache-tags/page.tsx b/test/e2e/app-dir/app-static/app/too-many-cache-tags/page.tsx index 086813a91309a..2664adb45081f 100644 --- a/test/e2e/app-dir/app-static/app/too-many-cache-tags/page.tsx +++ b/test/e2e/app-dir/app-static/app/too-many-cache-tags/page.tsx @@ -3,7 +3,7 @@ export const revalidate = 0 export default async function Page() { const tags: string[] = [] - for (let i = 0; i < 96; i++) { + for (let i = 0; i < 130; i++) { tags.push(`tag-${i}`) } const data = await fetch( From 3ddd390ca53b8f3fb7bff2c9032d1dfef5bce477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 26 Nov 2024 04:46:57 +0900 Subject: [PATCH 27/82] perf(turbopack): Use `ResolvedVc` for `turbopack-css` (#73172) ### What? Use `ResolvedVc` instead of `Vc` for struct fields in `turbopack-css` ### Why? ### How? --- turbopack/crates/turbopack-css/src/asset.rs | 43 +++++++------- .../crates/turbopack-css/src/chunk/mod.rs | 59 ++++++++++--------- .../src/chunk/single_item_chunk/chunk.rs | 15 +++-- .../src/chunk/single_item_chunk/source_map.rs | 6 +- .../turbopack-css/src/chunk/source_map.rs | 6 +- .../crates/turbopack-css/src/module_asset.rs | 51 ++++++++-------- turbopack/crates/turbopack-css/src/process.rs | 26 ++++---- .../turbopack-css/src/references/compose.rs | 15 +++-- .../turbopack-css/src/references/import.rs | 30 +++++----- .../turbopack-css/src/references/url.rs | 18 +++--- 10 files changed, 143 insertions(+), 126 deletions(-) diff --git a/turbopack/crates/turbopack-css/src/asset.rs b/turbopack/crates/turbopack-css/src/asset.rs index aaecc657a2f2c..95896c65733c8 100644 --- a/turbopack/crates/turbopack-css/src/asset.rs +++ b/turbopack/crates/turbopack-css/src/asset.rs @@ -33,9 +33,9 @@ fn modifier() -> Vc { #[turbo_tasks::value] #[derive(Clone)] pub struct CssModuleAsset { - source: Vc>, - asset_context: Vc>, - import_context: Option>, + source: ResolvedVc>, + asset_context: ResolvedVc>, + import_context: Option>, ty: CssModuleAssetType, minify_type: MinifyType, } @@ -45,11 +45,11 @@ impl CssModuleAsset { /// Creates a new CSS asset. #[turbo_tasks::function] pub fn new( - source: Vc>, - asset_context: Vc>, + source: ResolvedVc>, + asset_context: ResolvedVc>, ty: CssModuleAssetType, minify_type: MinifyType, - import_context: Option>, + import_context: Option>, ) -> Vc { Self::cell(CssModuleAsset { source, @@ -74,9 +74,10 @@ impl ParseCss for CssModuleAsset { let this = self.await?; Ok(parse_css( - this.source, + *this.source, Vc::upcast(self), this.import_context + .map(|v| *v) .unwrap_or_else(|| ImportContext::new(vec![], vec![], vec![])), this.ty, )) @@ -125,7 +126,7 @@ impl Module for CssModuleAsset { // TODO: include CSS source map match &*result { - ParseCssResult::Ok { references, .. } => Ok(*references), + ParseCssResult::Ok { references, .. } => Ok(**references), ParseCssResult::Unparseable => Ok(ModuleReferences::empty()), ParseCssResult::NotFound => Ok(ModuleReferences::empty()), } @@ -144,8 +145,8 @@ impl Asset for CssModuleAsset { impl ChunkableModule for CssModuleAsset { #[turbo_tasks::function] fn as_chunk_item( - self: Vc, - chunking_context: Vc>, + self: ResolvedVc, + chunking_context: ResolvedVc>, ) -> Vc> { Vc::upcast(CssModuleChunkItem::cell(CssModuleChunkItem { module: self, @@ -166,14 +167,14 @@ impl ResolveOrigin for CssModuleAsset { #[turbo_tasks::function] fn asset_context(&self) -> Vc> { - self.asset_context + *self.asset_context } } #[turbo_tasks::value] struct CssModuleChunkItem { - module: Vc, - chunking_context: Vc>, + module: ResolvedVc, + chunking_context: ResolvedVc>, } #[turbo_tasks::value_impl] @@ -190,7 +191,7 @@ impl ChunkItem for CssModuleChunkItem { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - Vc::upcast(self.chunking_context) + Vc::upcast(*self.chunking_context) } #[turbo_tasks::function] @@ -200,7 +201,7 @@ impl ChunkItem for CssModuleChunkItem { #[turbo_tasks::function] fn module(&self) -> Vc> { - Vc::upcast(self.module) + Vc::upcast(*self.module) } } @@ -227,13 +228,13 @@ impl CssChunkItem for CssModuleChunkItem { if let Some(placeable) = ResolvedVc::try_downcast::>(module).await? { - let item = placeable.as_chunk_item(chunking_context); + let item = placeable.as_chunk_item(*chunking_context); if let Some(css_item) = Vc::try_resolve_downcast::>(item).await? { imports.push(CssImport::Internal( import_ref.to_resolved().await?, - css_item, + css_item.to_resolved().await?, )); } } @@ -252,7 +253,7 @@ impl CssChunkItem for CssModuleChunkItem { if let Some(placeable) = ResolvedVc::try_downcast::>(module).await? { - let item = placeable.as_chunk_item(chunking_context); + let item = placeable.as_chunk_item(*chunking_context); if let Some(css_item) = Vc::try_resolve_downcast::>(item).await? { @@ -268,7 +269,7 @@ impl CssChunkItem for CssModuleChunkItem { if let Some(code_gen) = Vc::try_resolve_sidecast::>(*r).await? { - code_gens.push(code_gen.code_generation(chunking_context)); + code_gens.push(code_gen.code_generation(*chunking_context)); } } // need to keep that around to allow references into that @@ -283,7 +284,7 @@ impl CssChunkItem for CssModuleChunkItem { let result = self .module - .finalize_css(chunking_context, self.module.await?.minify_type) + .finalize_css(*chunking_context, self.module.await?.minify_type) .await?; if let FinalCssResult::Ok { @@ -316,6 +317,6 @@ impl CssChunkItem for CssModuleChunkItem { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - self.chunking_context + *self.chunking_context } } diff --git a/turbopack/crates/turbopack-css/src/chunk/mod.rs b/turbopack/crates/turbopack-css/src/chunk/mod.rs index 207ed2fcedfb7..ad10c4f6d77e7 100644 --- a/turbopack/crates/turbopack-css/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-css/src/chunk/mod.rs @@ -32,16 +32,16 @@ use crate::{process::ParseCssResultSourceMap, util::stringify_js, ImportAssetRef #[turbo_tasks::value] pub struct CssChunk { - pub chunking_context: Vc>, - pub content: Vc, + pub chunking_context: ResolvedVc>, + pub content: ResolvedVc, } #[turbo_tasks::value_impl] impl CssChunk { #[turbo_tasks::function] pub fn new( - chunking_context: Vc>, - content: Vc, + chunking_context: ResolvedVc>, + content: ResolvedVc, ) -> Vc { CssChunk { chunking_context, @@ -52,7 +52,7 @@ impl CssChunk { #[turbo_tasks::function] fn chunk_content(&self) -> Vc { - self.content + *self.content } #[turbo_tasks::function] @@ -91,7 +91,7 @@ impl CssChunk { None => None, } } else { - content.source_map.map(Vc::upcast) + content.source_map.map(ResolvedVc::upcast).map(|v| *v) }; body.push_source(&content.inner_code, source_map); @@ -136,7 +136,7 @@ impl CssChunk { pub async fn write_import_context( body: &mut impl std::io::Write, - import_context: Option>, + import_context: Option>, ) -> Result { let mut close = String::new(); if let Some(import_context) = import_context { @@ -163,8 +163,8 @@ pub async fn write_import_context( #[turbo_tasks::value] pub struct CssChunkContent { - pub chunk_items: Vec>>, - pub referenced_output_assets: Vc, + pub chunk_items: Vec>>, + pub referenced_output_assets: ResolvedVc, } #[turbo_tasks::value_impl] @@ -177,7 +177,7 @@ impl Chunk for CssChunk { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - self.chunking_context + *self.chunking_context } #[turbo_tasks::function] @@ -194,17 +194,17 @@ impl OutputChunk for CssChunk { let entries_chunk_items = &content.chunk_items; let included_ids = entries_chunk_items .iter() - .map(|chunk_item| CssChunkItem::id(*chunk_item)) + .map(|chunk_item| CssChunkItem::id(**chunk_item)) .collect(); let imports_chunk_items: Vec<_> = entries_chunk_items .iter() .map(|&chunk_item| async move { let Some(css_item) = - Vc::try_resolve_downcast::>(chunk_item).await? + ResolvedVc::try_downcast::>(chunk_item).await? else { return Ok(vec![]); }; - Ok(css_item + css_item .content() .await? .imports @@ -216,7 +216,9 @@ impl OutputChunk for CssChunk { None } }) - .collect::>()) + .map(|v| async move { v.to_resolved().await }) + .try_join() + .await }) .try_join() .await? @@ -229,8 +231,8 @@ impl OutputChunk for CssChunk { .chain(imports_chunk_items.iter()) .map(|item| { Vc::upcast::>(SingleItemCssChunk::new( - self.chunking_context, - *item, + *self.chunking_context, + **item, )) .to_resolved() }) @@ -313,7 +315,7 @@ impl OutputAsset for CssChunk { let mut references = content.referenced_output_assets.await?.clone_value(); for item in content.chunk_items.iter() { references.push(ResolvedVc::upcast( - SingleItemCssChunk::new(this.chunking_context, *item) + SingleItemCssChunk::new(*this.chunking_context, **item) .to_resolved() .await?, )); @@ -349,13 +351,13 @@ impl GenerateSourceMap for CssChunk { #[turbo_tasks::value] pub struct CssChunkContext { - chunking_context: Vc>, + chunking_context: ResolvedVc>, } #[turbo_tasks::value_impl] impl CssChunkContext { #[turbo_tasks::function] - pub fn of(chunking_context: Vc>) -> Vc { + pub fn of(chunking_context: ResolvedVc>) -> Vc { CssChunkContext { chunking_context }.cell() } @@ -375,18 +377,21 @@ pub trait CssChunkPlaceable: ChunkableModule + Module + Asset {} #[derive(Clone, Debug)] #[turbo_tasks::value(shared)] pub enum CssImport { - External(Vc), - Internal(ResolvedVc, Vc>), + External(ResolvedVc), + Internal( + ResolvedVc, + ResolvedVc>, + ), Composes(ResolvedVc>), } #[derive(Debug)] #[turbo_tasks::value(shared)] pub struct CssChunkItemContent { - pub import_context: Option>, + pub import_context: Option>, pub imports: Vec, pub inner_code: Rope, - pub source_map: Option>, + pub source_map: Option>, } #[turbo_tasks::value_trait] @@ -472,9 +477,9 @@ impl ChunkType for CssChunkType { #[turbo_tasks::function] async fn chunk( &self, - chunking_context: Vc>, + chunking_context: ResolvedVc>, chunk_items: Vec, - referenced_output_assets: Vc, + referenced_output_assets: ResolvedVc, ) -> Result>> { let content = CssChunkContent { chunk_items: chunk_items @@ -486,14 +491,14 @@ impl ChunkType for CssChunkType { bail!("Chunk item is not an css chunk item but reporting chunk type css"); }; // CSS doesn't need to care about async_info, so we can discard it - Ok(chunk_item) + chunk_item.to_resolved().await }) .try_join() .await?, referenced_output_assets, } .cell(); - Ok(Vc::upcast(CssChunk::new(chunking_context, content))) + Ok(Vc::upcast(CssChunk::new(*chunking_context, content))) } #[turbo_tasks::function] diff --git a/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/chunk.rs b/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/chunk.rs index fbb400adabae1..96970ee1b8354 100644 --- a/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/chunk.rs +++ b/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/chunk.rs @@ -22,8 +22,8 @@ use crate::chunk::{write_import_context, CssChunkItem}; /// avoiding rule duplication. #[turbo_tasks::value] pub struct SingleItemCssChunk { - chunking_context: Vc>, - item: Vc>, + chunking_context: ResolvedVc>, + item: ResolvedVc>, } #[turbo_tasks::value_impl] @@ -31,8 +31,8 @@ impl SingleItemCssChunk { /// Creates a new [`Vc`]. #[turbo_tasks::function] pub fn new( - chunking_context: Vc>, - item: Vc>, + chunking_context: ResolvedVc>, + item: ResolvedVc>, ) -> Vc { SingleItemCssChunk { chunking_context, @@ -57,7 +57,10 @@ impl SingleItemCssChunk { let content = this.item.content().await?; let close = write_import_context(&mut code, content.import_context).await?; - code.push_source(&content.inner_code, content.source_map.map(Vc::upcast)); + code.push_source( + &content.inner_code, + content.source_map.map(ResolvedVc::upcast).map(|v| *v), + ); write!(code, "{close}")?; if *this @@ -89,7 +92,7 @@ impl Chunk for SingleItemCssChunk { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - self.chunking_context + *self.chunking_context } } diff --git a/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/source_map.rs b/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/source_map.rs index a02dd1b48c78c..d4f2cc064b39c 100644 --- a/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/source_map.rs +++ b/turbopack/crates/turbopack-css/src/chunk/single_item_chunk/source_map.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use turbo_tasks::Vc; +use turbo_tasks::{ResolvedVc, Vc}; use turbo_tasks_fs::File; use turbopack_core::{ asset::{Asset, AssetContent}, @@ -14,13 +14,13 @@ use super::chunk::SingleItemCssChunk; /// Represents the source map of a single item CSS chunk. #[turbo_tasks::value] pub struct SingleItemCssChunkSourceMapAsset { - chunk: Vc, + chunk: ResolvedVc, } #[turbo_tasks::value_impl] impl SingleItemCssChunkSourceMapAsset { #[turbo_tasks::function] - pub fn new(chunk: Vc) -> Vc { + pub fn new(chunk: ResolvedVc) -> Vc { SingleItemCssChunkSourceMapAsset { chunk }.cell() } } diff --git a/turbopack/crates/turbopack-css/src/chunk/source_map.rs b/turbopack/crates/turbopack-css/src/chunk/source_map.rs index cdc5978f01f1c..cc24908c82317 100644 --- a/turbopack/crates/turbopack-css/src/chunk/source_map.rs +++ b/turbopack/crates/turbopack-css/src/chunk/source_map.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use turbo_tasks::Vc; +use turbo_tasks::{ResolvedVc, Vc}; use turbo_tasks_fs::File; use turbopack_core::{ asset::{Asset, AssetContent}, @@ -14,13 +14,13 @@ use super::CssChunk; /// Represents the source map of an css chunk. #[turbo_tasks::value] pub struct CssChunkSourceMapAsset { - chunk: Vc, + chunk: ResolvedVc, } #[turbo_tasks::value_impl] impl CssChunkSourceMapAsset { #[turbo_tasks::function] - pub fn new(chunk: Vc) -> Vc { + pub fn new(chunk: ResolvedVc) -> Vc { CssChunkSourceMapAsset { chunk }.cell() } } diff --git a/turbopack/crates/turbopack-css/src/module_asset.rs b/turbopack/crates/turbopack-css/src/module_asset.rs index 564f5a0f6adce..7f2ecf58e2517 100644 --- a/turbopack/crates/turbopack-css/src/module_asset.rs +++ b/turbopack/crates/turbopack-css/src/module_asset.rs @@ -42,14 +42,17 @@ fn modifier() -> Vc { #[turbo_tasks::value] #[derive(Clone)] pub struct ModuleCssAsset { - pub source: Vc>, - pub asset_context: Vc>, + pub source: ResolvedVc>, + pub asset_context: ResolvedVc>, } #[turbo_tasks::value_impl] impl ModuleCssAsset { #[turbo_tasks::function] - pub fn new(source: Vc>, asset_context: Vc>) -> Vc { + pub fn new( + source: ResolvedVc>, + asset_context: ResolvedVc>, + ) -> Vc { Self::cell(ModuleCssAsset { source, asset_context, @@ -116,7 +119,7 @@ enum ModuleCssClass { }, Import { original: String, - from: Vc, + from: ResolvedVc, }, } @@ -151,7 +154,7 @@ impl ModuleCssAsset { #[turbo_tasks::function] fn inner(&self) -> Vc { self.asset_context.process( - self.source, + *self.source, Value::new(ReferenceType::Css(CssReferenceSubType::Internal)), ) } @@ -190,7 +193,9 @@ impl ModuleCssAsset { Request::parse(Value::new( RcStr::from(specifier.clone()).into(), )), - ), + ) + .to_resolved() + .await?, } } CssModuleReference::Local { name } => ModuleCssClass::Local { @@ -217,7 +222,7 @@ impl ModuleCssAsset { for class_name in class_names { match class_name { ModuleCssClass::Import { from, .. } => { - references.push(Vc::upcast(*from)); + references.push(Vc::upcast(**from)); } ModuleCssClass::Local { .. } | ModuleCssClass::Global { .. } => {} } @@ -232,8 +237,8 @@ impl ModuleCssAsset { impl ChunkableModule for ModuleCssAsset { #[turbo_tasks::function] fn as_chunk_item( - self: Vc, - chunking_context: Vc>, + self: ResolvedVc, + chunking_context: ResolvedVc>, ) -> Vc> { Vc::upcast( ModuleChunkItem { @@ -262,14 +267,14 @@ impl ResolveOrigin for ModuleCssAsset { #[turbo_tasks::function] fn asset_context(&self) -> Vc> { - self.asset_context + *self.asset_context } } #[turbo_tasks::value] struct ModuleChunkItem { - module: Vc, - chunking_context: Vc>, + module: ResolvedVc, + chunking_context: ResolvedVc>, } #[turbo_tasks::value_impl] @@ -286,7 +291,7 @@ impl ChunkItem for ModuleChunkItem { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - Vc::upcast(self.chunking_context) + Vc::upcast(*self.chunking_context) } #[turbo_tasks::function] @@ -298,7 +303,7 @@ impl ChunkItem for ModuleChunkItem { #[turbo_tasks::function] fn module(&self) -> Vc> { - Vc::upcast(self.module) + Vc::upcast(*self.module) } } @@ -306,7 +311,7 @@ impl ChunkItem for ModuleChunkItem { impl EcmascriptChunkItem for ModuleChunkItem { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - self.chunking_context + *self.chunking_context } #[turbo_tasks::function] @@ -327,8 +332,8 @@ impl EcmascriptChunkItem for ModuleChunkItem { let Some(resolved_module) = &*resolved_module else { CssModuleComposesIssue { - severity: IssueSeverity::Error.cell(), - source: self.module.ident(), + severity: IssueSeverity::Error.resolved_cell(), + source: self.module.ident().to_resolved().await?, message: formatdoc! { r#" Module {from} referenced in `composes: ... from {from};` can't be resolved. @@ -344,8 +349,8 @@ impl EcmascriptChunkItem for ModuleChunkItem { .await? else { CssModuleComposesIssue { - severity: IssueSeverity::Error.cell(), - source: self.module.ident(), + severity: IssueSeverity::Error.resolved_cell(), + source: self.module.ident().to_resolved().await?, message: formatdoc! { r#" Module {from} referenced in `composes: ... from {from};` is not a CSS module. @@ -363,7 +368,7 @@ impl EcmascriptChunkItem for ModuleChunkItem { ResolvedVc::upcast(css_module); let module_id = placeable - .as_chunk_item(Vc::upcast(self.chunking_context)) + .as_chunk_item(Vc::upcast(*self.chunking_context)) .id() .await?; let module_id = StringifyJs(&*module_id); @@ -423,8 +428,8 @@ fn generate_minimal_source_map(filename: String, source: String) -> Vc, - source: Vc, + severity: ResolvedVc, + source: ResolvedVc, message: RcStr, } @@ -432,7 +437,7 @@ struct CssModuleComposesIssue { impl Issue for CssModuleComposesIssue { #[turbo_tasks::function] fn severity(&self) -> Vc { - self.severity + *self.severity } #[turbo_tasks::function] diff --git a/turbopack/crates/turbopack-css/src/process.rs b/turbopack/crates/turbopack-css/src/process.rs index 8c2b3b88b3623..7233bd1dddb31 100644 --- a/turbopack/crates/turbopack-css/src/process.rs +++ b/turbopack/crates/turbopack-css/src/process.rs @@ -19,7 +19,7 @@ use swc_core::{ }; use tracing::Instrument; use turbo_rcstr::RcStr; -use turbo_tasks::{FxIndexMap, ValueToString, Vc}; +use turbo_tasks::{FxIndexMap, ResolvedVc, ValueToString, Vc}; use turbo_tasks_fs::{FileContent, FileSystemPath}; use turbopack_core::{ asset::{Asset, AssetContent}, @@ -118,14 +118,14 @@ pub struct UnresolvedUrlReferences(pub Vec<(String, Vc)>); #[turbo_tasks::value(shared, serialization = "none", eq = "manual", cell = "new")] pub enum ParseCssResult { Ok { - code: Vc, + code: ResolvedVc, #[turbo_tasks(trace_ignore)] stylesheet: StyleSheetLike<'static, 'static>, - references: Vc, + references: ResolvedVc, - url_references: Vc, + url_references: ResolvedVc, #[turbo_tasks(trace_ignore)] options: ParserOptions<'static, 'static>, @@ -137,11 +137,11 @@ pub enum ParseCssResult { #[turbo_tasks::value(shared, serialization = "none", eq = "manual", cell = "new")] pub enum CssWithPlaceholderResult { Ok { - parse_result: Vc, + parse_result: ResolvedVc, - references: Vc, + references: ResolvedVc, - url_references: Vc, + url_references: ResolvedVc, #[turbo_tasks(trace_ignore)] exports: Option>, @@ -162,7 +162,7 @@ pub enum FinalCssResult { #[turbo_tasks(trace_ignore)] exports: Option, - source_map: Vc, + source_map: ResolvedVc, }, Unparseable, NotFound, @@ -176,7 +176,7 @@ impl PartialEq for FinalCssResult { #[turbo_tasks::function] pub async fn process_css_with_placeholder( - parse_result: Vc, + parse_result: ResolvedVc, ) -> Result> { let result = parse_result.await?; @@ -265,7 +265,7 @@ pub async fn finalize_css( Ok(FinalCssResult::Ok { output_code: result.code, exports: result.exports, - source_map: srcmap.unwrap().cell(), + source_map: srcmap.unwrap().resolved_cell(), } .into()) } @@ -458,10 +458,10 @@ async fn process_content( analyze_references(&mut stylesheet, source, origin, import_context)?; Ok(ParseCssResult::Ok { - code: content_vc, + code: content_vc.to_resolved().await?, stylesheet, - references: Vc::cell(references), - url_references: Vc::cell(url_references), + references: ResolvedVc::cell(references), + url_references: ResolvedVc::cell(url_references), options: config, } .cell()) diff --git a/turbopack/crates/turbopack-css/src/references/compose.rs b/turbopack/crates/turbopack-css/src/references/compose.rs index 360ae2d5238b4..6e2ccdccb7cc3 100644 --- a/turbopack/crates/turbopack-css/src/references/compose.rs +++ b/turbopack/crates/turbopack-css/src/references/compose.rs @@ -1,6 +1,6 @@ use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{Value, ValueToString, Vc}; +use turbo_tasks::{ResolvedVc, Value, ValueToString, Vc}; use turbopack_core::{ chunk::ChunkableModuleReference, reference::ModuleReference, @@ -14,15 +14,18 @@ use crate::references::css_resolve; #[turbo_tasks::value] #[derive(Hash, Debug)] pub struct CssModuleComposeReference { - pub origin: Vc>, - pub request: Vc, + pub origin: ResolvedVc>, + pub request: ResolvedVc, } #[turbo_tasks::value_impl] impl CssModuleComposeReference { /// Creates a new [`CssModuleComposeReference`]. #[turbo_tasks::function] - pub fn new(origin: Vc>, request: Vc) -> Vc { + pub fn new( + origin: ResolvedVc>, + request: ResolvedVc, + ) -> Vc { Self::cell(CssModuleComposeReference { origin, request }) } } @@ -32,8 +35,8 @@ impl ModuleReference for CssModuleComposeReference { #[turbo_tasks::function] fn resolve_reference(&self) -> Vc { css_resolve( - self.origin, - self.request, + *self.origin, + *self.request, Value::new(CssReferenceSubType::Compose), // TODO: add real issue source, currently impossible because `CssClassName` doesn't // contain the source span diff --git a/turbopack/crates/turbopack-css/src/references/import.rs b/turbopack/crates/turbopack-css/src/references/import.rs index 5ecb363fba4e3..f59ecaa524135 100644 --- a/turbopack/crates/turbopack-css/src/references/import.rs +++ b/turbopack/crates/turbopack-css/src/references/import.rs @@ -5,7 +5,7 @@ use lightningcss::{ traits::ToCss, }; use turbo_rcstr::RcStr; -use turbo_tasks::{Value, ValueToString, Vc}; +use turbo_tasks::{ResolvedVc, Value, ValueToString, Vc}; use turbopack_core::{ chunk::{ChunkableModuleReference, ChunkingContext}, issue::IssueSource, @@ -83,22 +83,22 @@ impl ImportAttributes { #[turbo_tasks::value] #[derive(Hash, Debug)] pub struct ImportAssetReference { - pub origin: Vc>, - pub request: Vc, - pub attributes: Vc, - pub import_context: Vc, - pub issue_source: Vc, + pub origin: ResolvedVc>, + pub request: ResolvedVc, + pub attributes: ResolvedVc, + pub import_context: ResolvedVc, + pub issue_source: ResolvedVc, } #[turbo_tasks::value_impl] impl ImportAssetReference { #[turbo_tasks::function] pub fn new( - origin: Vc>, - request: Vc, - attributes: Vc, - import_context: Vc, - issue_source: Vc, + origin: ResolvedVc>, + request: ResolvedVc, + attributes: ResolvedVc, + import_context: ResolvedVc, + issue_source: ResolvedVc, ) -> Vc { Self::cell(ImportAssetReference { origin, @@ -121,10 +121,10 @@ impl ModuleReference for ImportAssetReference { }; Ok(css_resolve( - self.origin, - self.request, + *self.origin, + *self.request, Value::new(CssReferenceSubType::AtImport(Some(import_context))), - Some(self.issue_source), + Some(*self.issue_source), )) } } @@ -154,7 +154,7 @@ impl CodeGenerateable for ImportAssetReference { .. } = &*this.request.await? { - imports.push(CssImport::External(Vc::cell( + imports.push(CssImport::External(ResolvedVc::cell( format!("{}{}", protocol, remainder).into(), ))) } diff --git a/turbopack/crates/turbopack-css/src/references/url.rs b/turbopack/crates/turbopack-css/src/references/url.rs index f2ce855e11ec7..aa0b5d8a0598d 100644 --- a/turbopack/crates/turbopack-css/src/references/url.rs +++ b/turbopack/crates/turbopack-css/src/references/url.rs @@ -32,18 +32,18 @@ pub enum ReferencedAsset { #[turbo_tasks::value] #[derive(Hash, Debug)] pub struct UrlAssetReference { - pub origin: Vc>, - pub request: Vc, - pub issue_source: Vc, + pub origin: ResolvedVc>, + pub request: ResolvedVc, + pub issue_source: ResolvedVc, } #[turbo_tasks::value_impl] impl UrlAssetReference { #[turbo_tasks::function] pub fn new( - origin: Vc>, - request: Vc, - issue_source: Vc, + origin: ResolvedVc>, + request: ResolvedVc, + issue_source: ResolvedVc, ) -> Vc { Self::cell(UrlAssetReference { origin, @@ -86,10 +86,10 @@ impl ModuleReference for UrlAssetReference { #[turbo_tasks::function] fn resolve_reference(&self) -> Vc { url_resolve( - self.origin, - self.request, + *self.origin, + *self.request, Value::new(ReferenceType::Url(UrlReferenceSubType::CssUrl)), - Some(self.issue_source), + Some(*self.issue_source), false, ) } From e4646d635466735613a58a12870654b49e78db56 Mon Sep 17 00:00:00 2001 From: Jude Gao Date: Mon, 25 Nov 2024 16:05:00 -0500 Subject: [PATCH 28/82] Revert change to ReactRefreshRequire test (#73186) See https://github.com/vercel/next.js/pull/73105#discussion_r1857278637 --- .../acceptance-app/ReactRefreshRequire.test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/development/acceptance-app/ReactRefreshRequire.test.ts b/test/development/acceptance-app/ReactRefreshRequire.test.ts index f621780fb103b..16b1e1121d708 100644 --- a/test/development/acceptance-app/ReactRefreshRequire.test.ts +++ b/test/development/acceptance-app/ReactRefreshRequire.test.ts @@ -270,9 +270,11 @@ describe('ReactRefreshRequire app', () => { 'leaf.js', `log.push('init LeafV3'); export default {};` ) - expect((await session.evaluate(() => (window as any).log)).sort()).toEqual( - ['init LeafV3', 'init MiddleAV1', 'init MiddleBV1'].sort() - ) + expect(await session.evaluate(() => (window as any).log)).toEqual([ + 'init LeafV3', + 'init MiddleAV1', + 'init MiddleBV1', + ]) // Now edit MiddleB. It should accept and re-run alone. await session.evaluate(() => ((window as any).log = [])) From e0eed7d7f6c87451f2780f57be63351bb454e46d Mon Sep 17 00:00:00 2001 From: Benjamin Woodruff Date: Mon, 25 Nov 2024 13:14:39 -0800 Subject: [PATCH 29/82] chore(CI): Remove sysroot override for macos arm64 (#73188) This is extracted from #72513. This override appears to break the build for rocksdb. It doesn't seem like there's any good reason for us to do this. It looks like we used to do a cross-build for macos arm64 (#28138), which would explain the need to override the sysroot, but we don't do that anymore. We don't do this override for x86-64 builds (even though that one _is_ a cross-build? The napi cli probably does the right thing for us...). Manually triggered `build-and-deploy` CI job: https://github.com/vercel/next.js/actions/runs/12018322261 --- .github/workflows/build_and_deploy.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 4abeb5e686014..3339ccfc9594c 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -146,10 +146,6 @@ jobs: # --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default # TODO: we should add the relevant envs later to to switch to strict mode build: | - export CC=$(xcrun -f clang); - export CXX=$(xcrun -f clang++); - SYSROOT=$(xcrun --sdk macosx --show-sdk-path); - export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && corepack enable turbo run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-apple-darwin strip -x packages/next-swc/native/next-swc.*.node From 43566f178372d9ded3302f0108ffcac107dfde4e Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Mon, 25 Nov 2024 23:24:46 +0000 Subject: [PATCH 30/82] v15.0.4-canary.28 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 ++++++------ packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 24 ++++++++++---------- 17 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lerna.json b/lerna.json index a75f71ed6057e..6dd6eca05ed4b 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.4-canary.27" + "version": "15.0.4-canary.28" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index cc72a36fb6386..f2c644861d811 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 1b78beee999c6..220ebb44541a8 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/api-reference/config/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.4-canary.27", + "@next/eslint-plugin-next": "15.0.4-canary.28", "@rushstack/eslint-patch": "^1.10.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 1556142ba9dee..1c165648e2ef8 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 2c03e58320bae..4cfe16dbc4ed6 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 6a21632e6473c..4a07ca7ec7822 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index f048a1ed4b9d3..ef8fe489c75cc 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 289754c415820..efa15a66b60a0 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 8ba6c42ca66c9..77665de83ceed 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 69b14091ea21c..a229c3568f0ab 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index 54351b952b82c..1c8a5d890aee2 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 645debc7f83ab..79fbd222a1451 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 87a45a175a4b9..b4c5bee648382 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 7c6a39481d060..3b307f39ee139 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -97,7 +97,7 @@ ] }, "dependencies": { - "@next/env": "15.0.4-canary.27", + "@next/env": "15.0.4-canary.28", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.13", "busboy": "1.6.0", @@ -161,11 +161,11 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/font": "15.0.4-canary.27", - "@next/polyfill-module": "15.0.4-canary.27", - "@next/polyfill-nomodule": "15.0.4-canary.27", - "@next/react-refresh-utils": "15.0.4-canary.27", - "@next/swc": "15.0.4-canary.27", + "@next/font": "15.0.4-canary.28", + "@next/polyfill-module": "15.0.4-canary.28", + "@next/polyfill-nomodule": "15.0.4-canary.28", + "@next/react-refresh-utils": "15.0.4-canary.28", + "@next/swc": "15.0.4-canary.28", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.9.2-nightly-20241111.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 747513e495e9f..5f4888db3b76b 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index a94abd52f1f36..3db846e94afcd 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.4-canary.27", + "version": "15.0.4-canary.28", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.4-canary.27", + "next": "15.0.4-canary.28", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "5.6.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03d76878e2ea2..c6fc896950603 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -795,7 +795,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.10.3 @@ -859,7 +859,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -869,7 +869,7 @@ importers: version: 0.5.13 babel-plugin-react-compiler: specifier: '*' - version: 19.0.0-beta-0dec889-20241115 + version: 19.0.0-beta-df7b47d-20241124 busboy: specifier: 1.6.0 version: 1.6.0 @@ -987,19 +987,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../font '@next/polyfill-module': - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1633,7 +1633,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.4-canary.27 + specifier: 15.0.4-canary.28 version: link:../next outdent: specifier: 0.8.0 @@ -6301,8 +6301,8 @@ packages: babel-plugin-react-compiler@0.0.0-experimental-c23de8d-20240515: resolution: {integrity: sha512-0XN2gmpT55QtAz5n7d5g91y1AuO9tRhWBaLgCRyc4ExHrlr7+LfxW+YTb3mOwxngkkiggwM8HyYsaEK9MqhnlQ==} - babel-plugin-react-compiler@19.0.0-beta-0dec889-20241115: - resolution: {integrity: sha512-sB912UbBt/vYl+6w40VO+LzWVnAt1Ty/XCDKs2qT5Fopljm+WpJNHVVkNESsX0IjU3sM5T5KvN31uuPpraUi7A==} + babel-plugin-react-compiler@19.0.0-beta-df7b47d-20241124: + resolution: {integrity: sha512-93iSASR20HNsotcOTQ+KPL0zpgfRFVWL86AtXpmHp995HuMVnC9femd8Winr3GxkPEh8lEOyaw3nqY4q2HUm5w==} babel-plugin-transform-async-to-promises@0.8.15: resolution: {integrity: sha512-fDXP68ZqcinZO2WCiimCL9zhGjGXOnn3D33zvbh+yheZ/qOrNVVDDIBtAaM3Faz8TRvQzHiRKsu3hfrBAhEncQ==} @@ -21276,7 +21276,7 @@ snapshots: zod: 3.23.8 zod-validation-error: 2.1.0(zod@3.23.8) - babel-plugin-react-compiler@19.0.0-beta-0dec889-20241115: + babel-plugin-react-compiler@19.0.0-beta-df7b47d-20241124: dependencies: '@babel/types': 7.22.5 From 90d6ef4841736778ab217a15f5b7bfc2d75ead36 Mon Sep 17 00:00:00 2001 From: Hyungji <84058944+hyungjikim@users.noreply.github.com> Date: Tue, 26 Nov 2024 08:49:13 +0900 Subject: [PATCH 31/82] (example) using `await` params when dynamic routing (#72896) ### Adding or Updating Examples Hi, Team. Updating example to await params as it is now used asynchronously. Co-authored-by: JJ Kasper --- examples/dynamic-routing/app/post/[id]/[comment]/page.tsx | 7 ++++--- examples/dynamic-routing/app/post/[id]/page.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/dynamic-routing/app/post/[id]/[comment]/page.tsx b/examples/dynamic-routing/app/post/[id]/[comment]/page.tsx index d2f812afdf8a8..90244baf55bf6 100644 --- a/examples/dynamic-routing/app/post/[id]/[comment]/page.tsx +++ b/examples/dynamic-routing/app/post/[id]/[comment]/page.tsx @@ -1,13 +1,14 @@ import Header from "../../../_components/header"; type Props = { - params: { + params: Promise<{ id: string; comment: string; - }; + }>; }; -export default function CommentPage({ params }: Props) { +export default async function CommentPage(props: Props) { + const params = await props.params; return ( <>
diff --git a/examples/dynamic-routing/app/post/[id]/page.tsx b/examples/dynamic-routing/app/post/[id]/page.tsx index 78bc03ba056e6..b94f882bf0aa5 100644 --- a/examples/dynamic-routing/app/post/[id]/page.tsx +++ b/examples/dynamic-routing/app/post/[id]/page.tsx @@ -2,12 +2,13 @@ import Link from "next/link"; import Header from "../../_components/header"; type Props = { - params: { + params: Promise<{ id: string; - }; + }>; }; -export default function PostPage({ params }: Props) { +export default async function PostPage(props: Props) { + const params = await props.params; return ( <>
From 7e87edd241e932b3531f9dda4fff10440cfe0ef2 Mon Sep 17 00:00:00 2001 From: Hyungji <84058944+hyungjikim@users.noreply.github.com> Date: Tue, 26 Nov 2024 08:50:32 +0900 Subject: [PATCH 32/82] docs: Improve Accuracy and Type Safety on Data Fetching Examples (#73122) Hi, Team. Updated Reusing data across multiple functions examples on data fetching documentation to improve type safety and accuracy. ### Summary of Changes 1. Added Async Params 2. Fixed Dynamic Route Example Path - Corrected the path structure for dynamic routes to reflect actual usage as `app/page.tsx` cannot be used to access dynamic routed paths. 3. Improved Type Safety in `generateStaticParams` - Type mismatch: `generateStaticParams` expects string parameter, but examples used `post.id` which of type is number, causing both build time and client run time failures. image image 4. Replaced let variable with const variable - Prevent accidental reassignment as it is not needed --------- Co-authored-by: JJ Kasper --- .../02-data-fetching/01-fetching.mdx | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx b/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx index e29531d80c1b8..42b04aa154c26 100644 --- a/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx +++ b/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx @@ -271,7 +271,7 @@ If you are using `fetch`, requests can be [memoized](/docs/app/building-your-app > > - In previous versions of Next.js, using `fetch` would have a default `cache` value of `force-cache`. This changed in version 15, to a default of `cache: no-store`. -```tsx filename="app/page.tsx" switcher +```tsx filename="app/blog/[id]/page.tsx" switcher import { notFound } from 'next/navigation' interface Post { @@ -281,21 +281,21 @@ interface Post { } async function getPost(id: string) { - let res = await fetch(`https://api.vercel.app/blog/${id}`, { + const res = await fetch(`https://api.vercel.app/blog/${id}`, { cache: 'force-cache', }) - let post: Post = await res.json() + const post: Post = await res.json() if (!post) notFound() return post } export async function generateStaticParams() { - let posts = await fetch('https://api.vercel.app/blog', { + const posts = await fetch('https://api.vercel.app/blog', { cache: 'force-cache', }).then((res) => res.json()) return posts.map((post: Post) => ({ - id: post.id, + id: String(post.id), })) } @@ -304,7 +304,8 @@ export async function generateMetadata({ }: { params: Promise<{ id: string }> }) { - let post = await getPost(params.id) + const { id } = await params + const post = await getPost(id) return { title: post.title, @@ -316,7 +317,8 @@ export default async function Page({ }: { params: Promise<{ id: string }> }) { - let post = await getPost(params.id) + const { id } = await params + const post = await getPost(id) return (
@@ -327,28 +329,29 @@ export default async function Page({ } ``` -```jsx filename="app/page.js" switcher +```jsx filename="app/blog/[id]/page.js" switcher import { notFound } from 'next/navigation' async function getPost(id) { - let res = await fetch(`https://api.vercel.app/blog/${id}`) - let post = await res.json() + const res = await fetch(`https://api.vercel.app/blog/${id}`) + const post = await res.json() if (!post) notFound() return post } export async function generateStaticParams() { - let posts = await fetch('https://api.vercel.app/blog').then((res) => + const posts = await fetch('https://api.vercel.app/blog').then((res) => res.json() ) return posts.map((post) => ({ - id: post.id, + id: String(post.id), })) } export async function generateMetadata({ params }) { - let post = await getPost(params.id) + const { id } = await params + const post = await getPost(id) return { title: post.title, @@ -356,7 +359,8 @@ export async function generateMetadata({ params }) { } export default async function Page({ params }) { - let post = await getPost(params.id) + const { id } = await params + const post = await getPost(id) return (
From a2f4b93b71e7eee65be52347eba526bf3c1a5778 Mon Sep 17 00:00:00 2001 From: Jude Gao Date: Mon, 25 Nov 2024 19:54:38 -0500 Subject: [PATCH 33/82] Do not inline CSS in RSC payload for dynamic client nav (#73182) --- .../server/app-render/render-css-resource.tsx | 2 +- .../e2e/app-dir/app-inline-css/app/a/page.tsx | 11 ++++++ .../app-dir/app-inline-css/app/a/styles.css | 3 ++ .../e2e/app-dir/app-inline-css/app/b/page.tsx | 11 ++++++ .../e2e/app-dir/app-inline-css/app/layout.tsx | 18 ++++++++- test/e2e/app-dir/app-inline-css/index.test.ts | 38 ++++++++++++++++++- 6 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 test/e2e/app-dir/app-inline-css/app/a/page.tsx create mode 100644 test/e2e/app-dir/app-inline-css/app/a/styles.css create mode 100644 test/e2e/app-dir/app-inline-css/app/b/page.tsx diff --git a/packages/next/src/server/app-render/render-css-resource.tsx b/packages/next/src/server/app-render/render-css-resource.tsx index 9ed009fa6c991..54cbf14ea9887 100644 --- a/packages/next/src/server/app-render/render-css-resource.tsx +++ b/packages/next/src/server/app-render/render-css-resource.tsx @@ -36,7 +36,7 @@ export function renderCssResource( entryCssFile.path )}${getAssetQueryString(ctx, true)}` - if (entryCssFile.inlined) { + if (entryCssFile.inlined && !ctx.parsedRequestHeaders.isRSCRequest) { return ( -
- ); -} diff --git a/examples/with-styled-jsx-scss/tsconfig.json b/examples/with-styled-jsx-scss/tsconfig.json deleted file mode 100644 index b8d597880a1ae..0000000000000 --- a/examples/with-styled-jsx-scss/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": false, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} From 9cbc4d881d4696a4f8b06d5102c2601dd83996bc Mon Sep 17 00:00:00 2001 From: PapatMayuri <40386398+PapatMayuri@users.noreply.github.com> Date: Wed, 27 Nov 2024 03:49:47 +0530 Subject: [PATCH 48/82] Updated the example of with-styled-jsx-plugins to utilize the App Router (#70663) This PR updates the with-styled-jsx-plugins example for using the App Router. Here are the changes that have been made: - I renamed the "pages" folder and moved it to the "app" folder. - Added the layout.TSX file as part of the App Router. - Updated the package.json file. CC: @samcx --------- Co-authored-by: qed42 Co-authored-by: Sam Ko --- examples/with-styled-jsx-plugins/.babelrc | 12 ------- examples/with-styled-jsx-plugins/.gitignore | 36 ------------------- examples/with-styled-jsx-plugins/README.md | 33 ----------------- .../with-styled-jsx-plugins/next-env.d.ts | 5 --- examples/with-styled-jsx-plugins/package.json | 29 --------------- .../with-styled-jsx-plugins/pages/index.tsx | 26 -------------- .../with-styled-jsx-plugins/tsconfig.json | 20 ----------- 7 files changed, 161 deletions(-) delete mode 100644 examples/with-styled-jsx-plugins/.babelrc delete mode 100644 examples/with-styled-jsx-plugins/.gitignore delete mode 100644 examples/with-styled-jsx-plugins/README.md delete mode 100644 examples/with-styled-jsx-plugins/next-env.d.ts delete mode 100644 examples/with-styled-jsx-plugins/package.json delete mode 100644 examples/with-styled-jsx-plugins/pages/index.tsx delete mode 100644 examples/with-styled-jsx-plugins/tsconfig.json diff --git a/examples/with-styled-jsx-plugins/.babelrc b/examples/with-styled-jsx-plugins/.babelrc deleted file mode 100644 index e3ffd2aa231b7..0000000000000 --- a/examples/with-styled-jsx-plugins/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "next/babel", - { - "styled-jsx": { - "plugins": ["styled-jsx-plugin-postcss"] - } - } - ] - ] -} diff --git a/examples/with-styled-jsx-plugins/.gitignore b/examples/with-styled-jsx-plugins/.gitignore deleted file mode 100644 index fd3dbb571a12a..0000000000000 --- a/examples/with-styled-jsx-plugins/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/examples/with-styled-jsx-plugins/README.md b/examples/with-styled-jsx-plugins/README.md deleted file mode 100644 index 3e4ab6c0dc01a..0000000000000 --- a/examples/with-styled-jsx-plugins/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# With styled-jsx plugins - -Next.js ships with [styled-jsx](https://github.com/vercel/styled-jsx) allowing you -to write scope styled components with full css support. This is important for -the modularity and code size of your bundles and also for the learning curve of the framework. If you know css you can write styled-jsx right away. - -This example shows how to configure styled-jsx to use external plugins to modify the output. Using this you can use PostCSS, SASS (SCSS), LESS, or any other pre-processor with styled-jsx. You can define plugins in `.babelrc`. In this case PostCSS was used as an example. PostCSS plugins are defined in `package.json`. - -More details about how plugins work can be found in the [styled-jsx readme](https://github.com/vercel/styled-jsx#css-preprocessing-via-plugins) - -## Deploy your own - -Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example): - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-styled-jsx-plugins&project-name=with-styled-jsx-plugins&repository-name=with-styled-jsx-plugins) - -## How to use - -Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example: - -```bash -npx create-next-app --example with-styled-jsx-plugins with-styled-jsx-plugins-app -``` - -```bash -yarn create next-app --example with-styled-jsx-plugins with-styled-jsx-plugins-app -``` - -```bash -pnpm create next-app --example with-styled-jsx-plugins with-styled-jsx-plugins-app -``` - -Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). diff --git a/examples/with-styled-jsx-plugins/next-env.d.ts b/examples/with-styled-jsx-plugins/next-env.d.ts deleted file mode 100644 index 52e831b434248..0000000000000 --- a/examples/with-styled-jsx-plugins/next-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. diff --git a/examples/with-styled-jsx-plugins/package.json b/examples/with-styled-jsx-plugins/package.json deleted file mode 100644 index cc0dc072c4162..0000000000000 --- a/examples/with-styled-jsx-plugins/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "private": true, - "scripts": { - "dev": "next", - "build": "next build", - "start": "next start" - }, - "dependencies": { - "lost": "^9.0.1", - "next": "latest", - "postcss": "^8.4.19", - "postcss-nested": "^6.0.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "styled-jsx-plugin-postcss": "^4.0.1" - }, - "postcss": { - "plugins": { - "lost": {}, - "postcss-nested": {} - } - }, - "devDependencies": { - "@types/node": "^18.11.9", - "@types/react": "^18.0.25", - "@types/react-dom": "^18.0.9", - "typescript": "^4.9.3" - } -} diff --git a/examples/with-styled-jsx-plugins/pages/index.tsx b/examples/with-styled-jsx-plugins/pages/index.tsx deleted file mode 100644 index d6dbaa240442d..0000000000000 --- a/examples/with-styled-jsx-plugins/pages/index.tsx +++ /dev/null @@ -1,26 +0,0 @@ -export default function Home() { - return ( -
-

Hello World

- -
- ); -} diff --git a/examples/with-styled-jsx-plugins/tsconfig.json b/examples/with-styled-jsx-plugins/tsconfig.json deleted file mode 100644 index b8d597880a1ae..0000000000000 --- a/examples/with-styled-jsx-plugins/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": false, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} From 661f3fbd2e0c0d8a1097d2a60d890bc3af798194 Mon Sep 17 00:00:00 2001 From: PapatMayuri <40386398+PapatMayuri@users.noreply.github.com> Date: Wed, 27 Nov 2024 03:57:14 +0530 Subject: [PATCH 49/82] Updated the example of with-unstated to utilize the App Router. (#73211) This PR updates the with-unstated example for using the App Router. Here are the changes that have been made: - Renamed the "pages" folder to the "app" folder. - Added the layout.tsx file as part of the App Router. - Moved the components folder inside app folder. - Updated the package.json file. - Added hooks for counter and clock. CC: @samcx --------- Co-authored-by: samcx --- examples/with-unstated/.gitignore | 36 -------------------- examples/with-unstated/README.md | 29 ---------------- examples/with-unstated/components/Clock.js | 31 ----------------- examples/with-unstated/components/Counter.js | 16 --------- examples/with-unstated/containers/clock.js | 18 ---------- examples/with-unstated/containers/counter.js | 13 ------- examples/with-unstated/package.json | 14 -------- examples/with-unstated/pages/about.js | 23 ------------- examples/with-unstated/pages/index.js | 23 ------------- 9 files changed, 203 deletions(-) delete mode 100644 examples/with-unstated/.gitignore delete mode 100644 examples/with-unstated/README.md delete mode 100644 examples/with-unstated/components/Clock.js delete mode 100644 examples/with-unstated/components/Counter.js delete mode 100644 examples/with-unstated/containers/clock.js delete mode 100644 examples/with-unstated/containers/counter.js delete mode 100644 examples/with-unstated/package.json delete mode 100644 examples/with-unstated/pages/about.js delete mode 100644 examples/with-unstated/pages/index.js diff --git a/examples/with-unstated/.gitignore b/examples/with-unstated/.gitignore deleted file mode 100644 index fd3dbb571a12a..0000000000000 --- a/examples/with-unstated/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts diff --git a/examples/with-unstated/README.md b/examples/with-unstated/README.md deleted file mode 100644 index 20d489aa5fdeb..0000000000000 --- a/examples/with-unstated/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Unstated example - -This example shows how to integrate [Unstated Next](https://github.com/jamiebuilds/unstated-next) with Next.js. - -There are two pages, `/` and `/about`, both render a counter and a timer, the state is saved for the current page and reset when switching to a different page. To keep a shared state between pages you can add the state providers to `pages/_app.js` instead of using the page. - -## Deploy your own - -Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-unstated) - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-unstated&project-name=with-unstated&repository-name=with-unstated) - -## How to use - -Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example: - -```bash -npx create-next-app --example with-unstated with-unstated-app -``` - -```bash -yarn create next-app --example with-unstated with-unstated-app -``` - -```bash -pnpm create next-app --example with-unstated with-unstated-app -``` - -Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). diff --git a/examples/with-unstated/components/Clock.js b/examples/with-unstated/components/Clock.js deleted file mode 100644 index 546a9a3ed6103..0000000000000 --- a/examples/with-unstated/components/Clock.js +++ /dev/null @@ -1,31 +0,0 @@ -import ClockContainer from "../containers/clock"; - -const pad = (n) => (n < 10 ? `0${n}` : n); - -const format = (t) => - `${pad(t.getUTCHours())}:${pad(t.getUTCMinutes())}:${pad(t.getUTCSeconds())}`; - -export default function Clock() { - const clock = ClockContainer.useContainer(); - - return ( -
- {format(new Date(clock.lastUpdate))} - -
- ); -} diff --git a/examples/with-unstated/components/Counter.js b/examples/with-unstated/components/Counter.js deleted file mode 100644 index 3f4071b934f9e..0000000000000 --- a/examples/with-unstated/components/Counter.js +++ /dev/null @@ -1,16 +0,0 @@ -import CounterContainer from "../containers/counter"; - -export default function Counter() { - const counter = CounterContainer.useContainer(); - - return ( -
-

- Count: {counter.count} -

- - - -
- ); -} diff --git a/examples/with-unstated/containers/clock.js b/examples/with-unstated/containers/clock.js deleted file mode 100644 index b56a14a557b2e..0000000000000 --- a/examples/with-unstated/containers/clock.js +++ /dev/null @@ -1,18 +0,0 @@ -import { useState, useEffect } from "react"; -import { createContainer } from "unstated-next"; - -function useClock() { - const [data, setData] = useState({ lastUpdate: 0, light: false }); - - useEffect(() => { - let interval = setInterval(() => { - setData({ lastUpdate: Date.now(), light: !data.light }); - }, 1000); - - return () => clearInterval(interval); - }, [data.light]); - - return data; -} - -export default createContainer(useClock); diff --git a/examples/with-unstated/containers/counter.js b/examples/with-unstated/containers/counter.js deleted file mode 100644 index 6bacf9c2f38dd..0000000000000 --- a/examples/with-unstated/containers/counter.js +++ /dev/null @@ -1,13 +0,0 @@ -import { useState } from "react"; -import { createContainer } from "unstated-next"; - -function useCounter() { - const [count, setCount] = useState(0); - const decrement = () => setCount(count - 1); - const increment = () => setCount(count + 1); - const reset = () => setCount(0); - - return { count, decrement, increment, reset }; -} - -export default createContainer(useCounter); diff --git a/examples/with-unstated/package.json b/examples/with-unstated/package.json deleted file mode 100644 index 9e1f0f8ca6b91..0000000000000 --- a/examples/with-unstated/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "private": true, - "scripts": { - "dev": "next", - "build": "next build", - "start": "next start" - }, - "dependencies": { - "next": "latest", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "unstated-next": "1.1.0" - } -} diff --git a/examples/with-unstated/pages/about.js b/examples/with-unstated/pages/about.js deleted file mode 100644 index 7a6330c0ddf63..0000000000000 --- a/examples/with-unstated/pages/about.js +++ /dev/null @@ -1,23 +0,0 @@ -import Link from "next/link"; -import ClockContainer from "../containers/clock"; -import CounterContainer from "../containers/counter"; -import Clock from "../components/Clock"; -import Counter from "../components/Counter"; - -export default function Index() { - return ( - - -
- go to Index -
-
-
- - -
-
-
-
- ); -} diff --git a/examples/with-unstated/pages/index.js b/examples/with-unstated/pages/index.js deleted file mode 100644 index 43c39814607ef..0000000000000 --- a/examples/with-unstated/pages/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import Link from "next/link"; -import ClockContainer from "../containers/clock"; -import CounterContainer from "../containers/counter"; -import Clock from "../components/Clock"; -import Counter from "../components/Counter"; - -export default function Index() { - return ( - - -
- go to About -
-
-
- - -
-
-
-
- ); -} From ac686ff170ca94b50cdf176ea9047cc35f4e21e4 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Tue, 26 Nov 2024 23:24:40 +0000 Subject: [PATCH 50/82] v15.0.4-canary.29 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 ++-- packages/eslint-plugin-next/package.json | 2 +- packages/font/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/package.json | 14 +++++++------- packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 16 ++++++++-------- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 6dd6eca05ed4b..5e4f12627a95e 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.4-canary.28" + "version": "15.0.4-canary.29" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index f2c644861d811..4fd8100b4795d 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 220ebb44541a8..53239c4facac9 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/api-reference/config/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.4-canary.28", + "@next/eslint-plugin-next": "15.0.4-canary.29", "@rushstack/eslint-patch": "^1.10.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 1c165648e2ef8..f981f236f45a8 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "description": "ESLint plugin for Next.js.", "main": "dist/index.js", "license": "MIT", diff --git a/packages/font/package.json b/packages/font/package.json index 4cfe16dbc4ed6..97233bd8008d0 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/font" diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 4a07ca7ec7822..4a00ce49b263c 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index ef8fe489c75cc..7d018cf6e6f6f 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index efa15a66b60a0..5c9b21394078a 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 77665de83ceed..68adb2a891414 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index a229c3568f0ab..62b15dcbae962 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index 1c8a5d890aee2..d31d3a82e1b00 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 79fbd222a1451..c5add05062604 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index b4c5bee648382..cdab4c5b77fae 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 3b307f39ee139..3e1fa522ada72 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -97,7 +97,7 @@ ] }, "dependencies": { - "@next/env": "15.0.4-canary.28", + "@next/env": "15.0.4-canary.29", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.13", "busboy": "1.6.0", @@ -161,11 +161,11 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/font": "15.0.4-canary.28", - "@next/polyfill-module": "15.0.4-canary.28", - "@next/polyfill-nomodule": "15.0.4-canary.28", - "@next/react-refresh-utils": "15.0.4-canary.28", - "@next/swc": "15.0.4-canary.28", + "@next/font": "15.0.4-canary.29", + "@next/polyfill-module": "15.0.4-canary.29", + "@next/polyfill-nomodule": "15.0.4-canary.29", + "@next/react-refresh-utils": "15.0.4-canary.29", + "@next/swc": "15.0.4-canary.29", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.9.2-nightly-20241111.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 5f4888db3b76b..69589b5414b14 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 3db846e94afcd..85f55c97f944c 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.4-canary.28", + "version": "15.0.4-canary.29", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.4-canary.28", + "next": "15.0.4-canary.29", "outdent": "0.8.0", "prettier": "2.5.1", "typescript": "5.6.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6fc896950603..e11f0fabe81d0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -795,7 +795,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.10.3 @@ -859,7 +859,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -987,19 +987,19 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/font': - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../font '@next/polyfill-module': - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1633,7 +1633,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.4-canary.28 + specifier: 15.0.4-canary.29 version: link:../next outdent: specifier: 0.8.0 From fc64a11228684999422b79b964ffa1a210784d6d Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:28:48 -0800 Subject: [PATCH 51/82] refactor: remove isStandaloneMode context from metadata resolver (#73224) This removes a check that appears to be redundant: we only want to warn about the fallback behavior when deployed in an environment where the env vars needed to detect proper fallback values (eg, not deployed to Vercel) aren't available. Since this check is already captured, we don't need both. The rationale for explicitly logging in standalone mode (even in dev) is that `standalone` mode won't ever be deployed to Vercel. But it's equally possible for you to build a Next.js app and not deploy it to Vercel. At best, this was reducing some additional console noise. But at worst, you're deploying an app that will serve a `localhost` URL in production. If you're using a relative URL without a metadataBase, it seems worth explicitly calling out as early as possible that we're going to fill in a fallback for you. Ultimately we should surface this information regardless of env in devtools. But since warning is the default, in #73066 I've updated it to only warn in dev when explicitly passing a relative og URL, rather than always making it warn when using the `opengraph-image` convention. --- .../src/lib/metadata/metadata-context.tsx | 1 - .../src/lib/metadata/resolve-metadata.test.ts | 1 - .../resolvers/resolve-opengraph.test.ts | 8 +-- .../metadata/resolvers/resolve-opengraph.ts | 40 ++++++-------- .../metadata/resolvers/resolve-url.test.ts | 2 - .../next/src/lib/metadata/types/resolvers.ts | 1 - .../app-dir/metadata-warnings/index.test.ts | 53 +++++-------------- .../metadata-warnings/standalone.test.ts | 2 - 8 files changed, 31 insertions(+), 77 deletions(-) delete mode 100644 test/e2e/app-dir/metadata-warnings/standalone.test.ts diff --git a/packages/next/src/lib/metadata/metadata-context.tsx b/packages/next/src/lib/metadata/metadata-context.tsx index fbbfd38881aaf..7bb7f9f0ac328 100644 --- a/packages/next/src/lib/metadata/metadata-context.tsx +++ b/packages/next/src/lib/metadata/metadata-context.tsx @@ -10,7 +10,6 @@ export function createMetadataContext( return { pathname, trailingSlash: renderOpts.trailingSlash, - isStandaloneMode: renderOpts.nextConfigOutput === 'standalone', } } diff --git a/packages/next/src/lib/metadata/resolve-metadata.test.ts b/packages/next/src/lib/metadata/resolve-metadata.test.ts index 5acf5cc0b250e..456976c2e4002 100644 --- a/packages/next/src/lib/metadata/resolve-metadata.test.ts +++ b/packages/next/src/lib/metadata/resolve-metadata.test.ts @@ -17,7 +17,6 @@ function accumulateMetadata(metadataItems: MetadataItems) { return originAccumulateMetadata(fullMetadataItems, { pathname: '/test', trailingSlash: false, - isStandaloneMode: false, }) } diff --git a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts index 4ee811c093875..e5d232a31c50c 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts @@ -7,7 +7,7 @@ describe('resolveImages', () => { it(`should resolve images`, () => { const images = [image1, { url: image2, alt: 'Image2' }] - expect(resolveImages(images, null, false)).toEqual([ + expect(resolveImages(images, null)).toEqual([ { url: new URL(image1) }, { url: new URL(image2), alt: 'Image2' }, ]) @@ -16,7 +16,7 @@ describe('resolveImages', () => { it('should not mutate passed images', () => { const images = [image1, { url: image2, alt: 'Image2' }] - resolveImages(images, null, false) + resolveImages(images, null) expect(images).toEqual([image1, { url: image2, alt: 'Image2' }]) }) @@ -44,7 +44,7 @@ describe('resolveOpenGraph', () => { // pass authors as empty string { type: 'article', authors: '' }, null, - { isStandaloneMode: false, trailingSlash: false, pathname: '' }, + { trailingSlash: false, pathname: '' }, '' ) ).toEqual({ @@ -63,7 +63,7 @@ describe('resolveOpenGraph', () => { resolveOpenGraph( { type: 'article', authors: null }, null, - { isStandaloneMode: false, trailingSlash: false, pathname: '' }, + { trailingSlash: false, pathname: '' }, '' ) ).toEqual({ diff --git a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts index d671e45093ad6..ccfffaa28c0e1 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts @@ -42,8 +42,7 @@ const OgTypeFields = { function resolveAndValidateImage( item: FlattenArray, metadataBase: NonNullable, - isMetadataBaseMissing: boolean, - isStandaloneMode: boolean + isMetadataBaseMissing: boolean ) { if (!item) return undefined const isItemUrl = isStringOrURL(item) @@ -58,10 +57,11 @@ function resolveAndValidateImage( // detect in the build environment if the deployment is a Vercel deployment or not. // // x-ref: https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables - const isNonVercelDeployment = - !process.env.VERCEL && process.env.NODE_ENV === 'production' - // Validate url in self-host standalone mode or non-Vercel deployment - if (isStandaloneMode || isNonVercelDeployment) { + const isNonVercelDeployment = !process.env.VERCEL + // When not deployed to Vercel, we aren't able to determine a fallback value for `metadataBase` + // since it's derived from injected environment variables. For self-hosted setups, we want to warn + // about this since the only fallback we'll be able to generate is `localhost`. + if (isNonVercelDeployment) { validateResolvedImageUrl(inputUrl, metadataBase, isMetadataBaseMissing) } @@ -78,18 +78,15 @@ function resolveAndValidateImage( export function resolveImages( images: Twitter['images'], - metadataBase: ResolvedMetadataBase, - isStandaloneMode: boolean + metadataBase: ResolvedMetadataBase ): NonNullable['images'] export function resolveImages( images: OpenGraph['images'], - metadataBase: ResolvedMetadataBase, - isStandaloneMode: boolean + metadataBase: ResolvedMetadataBase ): NonNullable['images'] export function resolveImages( images: OpenGraph['images'] | Twitter['images'], - metadataBase: ResolvedMetadataBase, - isStandaloneMode: boolean + metadataBase: ResolvedMetadataBase ): | NonNullable['images'] | NonNullable['images'] { @@ -103,8 +100,7 @@ export function resolveImages( const resolvedItem = resolveAndValidateImage( item, fallbackMetadataBase, - isMetadataBaseMissing, - isStandaloneMode + isMetadataBaseMissing ) if (!resolvedItem) continue @@ -164,11 +160,7 @@ export const resolveOpenGraph: FieldResolverExtraArgs< ;(target as any)[key] = value ? resolveArray(value) : null } } - target.images = resolveImages( - og.images, - metadataBase, - metadataContext.isStandaloneMode - ) + target.images = resolveImages(og.images, metadataBase) } const resolved = { @@ -199,7 +191,9 @@ const TwitterBasicInfoKeys = [ export const resolveTwitter: FieldResolverExtraArgs< 'twitter', [ResolvedMetadataBase, MetadataContext, string | null] -> = (twitter, metadataBase, metadataContext, titleTemplate) => { + // TODO: metadataContext is not currently in use here, but will be added back + // in a subsequent PR +> = (twitter, metadataBase, _metadataContext, titleTemplate) => { if (!twitter) return null let card = 'card' in twitter ? twitter.card : undefined const resolved = { @@ -210,11 +204,7 @@ export const resolveTwitter: FieldResolverExtraArgs< resolved[infoKey] = twitter[infoKey] || null } - resolved.images = resolveImages( - twitter.images, - metadataBase, - metadataContext.isStandaloneMode - ) + resolved.images = resolveImages(twitter.images, metadataBase) card = card || (resolved.images?.length ? 'summary_large_image' : 'summary') resolved.card = card diff --git a/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts b/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts index d70c7bc5dc81a..4a92cd5b18e64 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts @@ -53,7 +53,6 @@ describe('resolveAbsoluteUrlWithPathname', () => { const opts = { trailingSlash: false, pathname: '/', - isStandaloneMode: false, } const resolver = (url: string | URL) => resolveAbsoluteUrlWithPathname(url, metadataBase, opts) @@ -69,7 +68,6 @@ describe('resolveAbsoluteUrlWithPathname', () => { const opts = { trailingSlash: true, pathname: '/', - isStandaloneMode: false, } const resolver = (url: string | URL) => resolveAbsoluteUrlWithPathname(url, metadataBase, opts) diff --git a/packages/next/src/lib/metadata/types/resolvers.ts b/packages/next/src/lib/metadata/types/resolvers.ts index 2ba2cf3182881..15094b6248b76 100644 --- a/packages/next/src/lib/metadata/types/resolvers.ts +++ b/packages/next/src/lib/metadata/types/resolvers.ts @@ -16,5 +16,4 @@ export type FieldResolverExtraArgs< export type MetadataContext = { pathname: string trailingSlash: boolean - isStandaloneMode: boolean } diff --git a/test/e2e/app-dir/metadata-warnings/index.test.ts b/test/e2e/app-dir/metadata-warnings/index.test.ts index 8062f34875d5d..3982f2dfe139c 100644 --- a/test/e2e/app-dir/metadata-warnings/index.test.ts +++ b/test/e2e/app-dir/metadata-warnings/index.test.ts @@ -4,7 +4,7 @@ const METADATA_BASE_WARN_STRING = 'metadataBase property in metadata export is not set for resolving social open graph or twitter images,' describe('app dir - metadata missing metadataBase', () => { - const { next, isNextDev, isNextDeploy, skipped } = nextTestSetup({ + const { next, isNextDev, skipped } = nextTestSetup({ files: __dirname, skipDeployment: true, }) @@ -13,21 +13,6 @@ describe('app dir - metadata missing metadataBase', () => { return } - if (process.env.TEST_STANDALONE === '1') { - beforeAll(async () => { - await next.stop() - await next.patchFile( - 'next.config.js', - ` - module.exports = { - output: 'standalone', - } - ` - ) - await next.start() - }) - } - // If it's start mode, we get the whole logs since they're from build process. // If it's development mode, we get the logs after request function getCliOutput(logStartPosition: number) { @@ -43,33 +28,19 @@ describe('app dir - metadata missing metadataBase', () => { }) } - if (process.env.TEST_STANDALONE === '1') { - // Standalone mode should always show the warning - it('should fallback to localhost if metadataBase is missing for absolute urls resolving', async () => { - const logStartPosition = next.cliOutput.length - await next.fetch('/og-image-convention') - const output = getCliOutput(logStartPosition) + it('should show warning in vercel deployment output in default build output mode', async () => { + const logStartPosition = next.cliOutput.length + await next.fetch('/og-image-convention') + const output = getCliOutput(logStartPosition) + // TODO: This is currently broken and will be addressed in a follow-up PR. We + // currently warn even for metadata that conforms to the `opengraph-image` convention. + if (false) { + expect(output).not.toInclude(METADATA_BASE_WARN_STRING) + } else { expect(output).toInclude(METADATA_BASE_WARN_STRING) - expect(output).toMatch(/using "http:\/\/localhost:\d+/) - expect(output).toInclude( - '. See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase' - ) - }) - } else { - // Default output mode - it('should show warning in vercel deployment output in default build output mode', async () => { - const logStartPosition = next.cliOutput.length - await next.fetch('/og-image-convention') - const output = getCliOutput(logStartPosition) - - if (isNextDeploy || isNextDev) { - expect(output).not.toInclude(METADATA_BASE_WARN_STRING) - } else { - expect(output).toInclude(METADATA_BASE_WARN_STRING) - } - }) - } + } + }) it('should warn for unsupported metadata properties', async () => { const logStartPosition = next.cliOutput.length diff --git a/test/e2e/app-dir/metadata-warnings/standalone.test.ts b/test/e2e/app-dir/metadata-warnings/standalone.test.ts deleted file mode 100644 index 237e8fad24265..0000000000000 --- a/test/e2e/app-dir/metadata-warnings/standalone.test.ts +++ /dev/null @@ -1,2 +0,0 @@ -process.env.TEST_STANDALONE = '1' -require('./index.test') From 00c875f58d9274b1984761438cafba9c9eea25cb Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:32:41 -0800 Subject: [PATCH 52/82] refactor: remove indirection in metadata image resolution (#73225) This refactors some unnecessary indirection that made it trickier for me to understand the flow of ogImage resolution. Specifically: - `getSocialImageFallbackMetadataBase` was taking in `metadataBase` and then inverting it and returning `isMetadataBaseMissing` which is circular. It was also being called higher up in the stack than it needed to be resulting in args being passed through intermediary functions that didn't need it - `validateResolvedImageUrl` was removed in favor of grabbing the fallback and warning appropriately in `resolveAndValidateImage`. This makes it more obvious that when we're warning about using the fallback, we should actually use the fallback, which I've done in #73066 --- .../metadata/resolvers/resolve-opengraph.ts | 44 +++++++------------ .../metadata/resolvers/resolve-url.test.ts | 2 +- .../src/lib/metadata/resolvers/resolve-url.ts | 13 ++---- 3 files changed, 22 insertions(+), 37 deletions(-) diff --git a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts index ccfffaa28c0e1..c641cb214d0f1 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts @@ -41,14 +41,15 @@ const OgTypeFields = { function resolveAndValidateImage( item: FlattenArray, - metadataBase: NonNullable, - isMetadataBaseMissing: boolean + metadataBase: ResolvedMetadataBase ) { if (!item) return undefined const isItemUrl = isStringOrURL(item) const inputUrl = isItemUrl ? item : item.url if (!inputUrl) return undefined + const fallbackMetadataBase = getSocialImageFallbackMetadataBase(metadataBase) + // process.env.VERCEL is set to "1" when System Environment Variables are // exposed. When exposed, validation is not necessary since we are falling back to // process.env.VERCEL_PROJECT_PRODUCTION_URL, process.env.VERCEL_BRANCH_URL, or @@ -62,9 +63,21 @@ function resolveAndValidateImage( // since it's derived from injected environment variables. For self-hosted setups, we want to warn // about this since the only fallback we'll be able to generate is `localhost`. if (isNonVercelDeployment) { - validateResolvedImageUrl(inputUrl, metadataBase, isMetadataBaseMissing) + if ( + typeof inputUrl === 'string' && + !isFullStringUrl(inputUrl) && + !metadataBase + ) { + warnOnce( + `metadataBase property in metadata export is not set for resolving social open graph or twitter images, using "${fallbackMetadataBase.origin}". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase` + ) + } } + // This is technically a bug. We shouldn't always be overriding the user-provided metadataBase with the fallback. + // But to match existing behavior, this keeps the logic in place, and it will be addressed in a follow-up PR. + metadataBase = fallbackMetadataBase + return isItemUrl ? { url: resolveUrl(inputUrl, metadataBase), @@ -93,15 +106,9 @@ export function resolveImages( const resolvedImages = resolveAsArrayOrUndefined(images) if (!resolvedImages) return resolvedImages - const { isMetadataBaseMissing, fallbackMetadataBase } = - getSocialImageFallbackMetadataBase(metadataBase) const nonNullableImages = [] for (const item of resolvedImages) { - const resolvedItem = resolveAndValidateImage( - item, - fallbackMetadataBase, - isMetadataBaseMissing - ) + const resolvedItem = resolveAndValidateImage(item, metadataBase) if (!resolvedItem) continue nonNullableImages.push(resolvedItem) @@ -126,23 +133,6 @@ function getFieldsByOgType(ogType: OpenGraphType | undefined) { return ogTypeToFields[ogType].concat(OgTypeFields.basic) } -function validateResolvedImageUrl( - inputUrl: string | URL, - fallbackMetadataBase: NonNullable, - isMetadataBaseMissing: boolean -): void { - // Only warn on the image url that needs to be resolved with metadataBase - if ( - typeof inputUrl === 'string' && - !isFullStringUrl(inputUrl) && - isMetadataBaseMissing - ) { - warnOnce( - `metadataBase property in metadata export is not set for resolving social open graph or twitter images, using "${fallbackMetadataBase.origin}". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase` - ) - } -} - export const resolveOpenGraph: FieldResolverExtraArgs< 'openGraph', [ResolvedMetadataBase, MetadataContext, string | null] diff --git a/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts b/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts index 4a92cd5b18e64..1de0c3b8aba96 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts @@ -126,7 +126,7 @@ describe('getSocialImageFallbackMetadataBase', () => { describe('fallbackMetadataBase when metadataBase is not present', () => { let originalEnv: NodeJS.ProcessEnv function getSocialImageFallbackMetadataBaseHelper(): string { - return getSocialImageFallbackMetadataBase(null).fallbackMetadataBase.href + return getSocialImageFallbackMetadataBase(null).href } beforeEach(() => { diff --git a/packages/next/src/lib/metadata/resolvers/resolve-url.ts b/packages/next/src/lib/metadata/resolvers/resolve-url.ts index 6b4a25bebf3e9..6648da643229e 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-url.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-url.ts @@ -21,11 +21,9 @@ function getProductionDeploymentUrl(): URL | undefined { // For deployment url for metadata routes, prefer to use the deployment url if possible // as these routes are unique to the deployments url. -export function getSocialImageFallbackMetadataBase(metadataBase: URL | null): { - fallbackMetadataBase: URL - isMetadataBaseMissing: boolean -} { - const isMetadataBaseMissing = !metadataBase +export function getSocialImageFallbackMetadataBase( + metadataBase: URL | null +): URL { const defaultMetadataBase = createLocalMetadataBase() const previewDeploymentUrl = getPreviewDeploymentUrl() const productionDeploymentUrl = getProductionDeploymentUrl() @@ -42,10 +40,7 @@ export function getSocialImageFallbackMetadataBase(metadataBase: URL | null): { : metadataBase || productionDeploymentUrl || defaultMetadataBase } - return { - fallbackMetadataBase, - isMetadataBaseMissing, - } + return fallbackMetadataBase } function resolveUrl(url: null | undefined, metadataBase: URL | null): null From 564794df56e421d6d4c2575b466a8be3a96dd39a Mon Sep 17 00:00:00 2001 From: Zack Tanner <1939140+ztanner@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:36:37 -0800 Subject: [PATCH 53/82] fix: metadataBase should take precedence when resolving relative ogImages (#73066) When resolving opengraph / twitter images, we currently ignore the configured `metadataBase` value, which goes against the [documentation](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#default-value) and doesn't seem correct, since an explicit `metadataBase` should be preferred over a fallback. This updates the handling to ensure an explicit `metadataBase` takes priority over the implicit path discovery. The one remaining special case here is for the "static metadata" case, aka the `opengraph-image` convention. We'll continue to prefer the fallback `metadataBase` in preview Vercel deploys & locally. Fixes #66957 Closes NDX-260 --- .../src/lib/metadata/metadata-context.tsx | 1 + .../src/lib/metadata/resolve-metadata.test.ts | 1 + .../next/src/lib/metadata/resolve-metadata.ts | 4 +- .../resolvers/resolve-opengraph.test.ts | 16 +++- .../metadata/resolvers/resolve-opengraph.ts | 83 +++++++++++++------ .../metadata/resolvers/resolve-url.test.ts | 6 +- .../src/lib/metadata/resolvers/resolve-url.ts | 12 ++- .../next/src/lib/metadata/types/resolvers.ts | 1 + .../app/relative-url-og/page.js | 9 ++ .../app-dir/metadata-warnings/index.test.ts | 12 ++- .../app/metadata-base/opengraph/page.tsx | 10 +++ test/e2e/app-dir/metadata/metadata.test.ts | 9 ++ 12 files changed, 123 insertions(+), 41 deletions(-) create mode 100644 test/e2e/app-dir/metadata-warnings/app/relative-url-og/page.js create mode 100644 test/e2e/app-dir/metadata/app/metadata-base/opengraph/page.tsx diff --git a/packages/next/src/lib/metadata/metadata-context.tsx b/packages/next/src/lib/metadata/metadata-context.tsx index 7bb7f9f0ac328..e22d7fe9b0ba3 100644 --- a/packages/next/src/lib/metadata/metadata-context.tsx +++ b/packages/next/src/lib/metadata/metadata-context.tsx @@ -10,6 +10,7 @@ export function createMetadataContext( return { pathname, trailingSlash: renderOpts.trailingSlash, + isStaticMetadataRouteFile: false, } } diff --git a/packages/next/src/lib/metadata/resolve-metadata.test.ts b/packages/next/src/lib/metadata/resolve-metadata.test.ts index 456976c2e4002..52e04615d66fa 100644 --- a/packages/next/src/lib/metadata/resolve-metadata.test.ts +++ b/packages/next/src/lib/metadata/resolve-metadata.test.ts @@ -17,6 +17,7 @@ function accumulateMetadata(metadataItems: MetadataItems) { return originAccumulateMetadata(fullMetadataItems, { pathname: '/test', trailingSlash: false, + isStaticMetadataRouteFile: false, }) } diff --git a/packages/next/src/lib/metadata/resolve-metadata.ts b/packages/next/src/lib/metadata/resolve-metadata.ts index 84f4184c47053..11e03472560c2 100644 --- a/packages/next/src/lib/metadata/resolve-metadata.ts +++ b/packages/next/src/lib/metadata/resolve-metadata.ts @@ -131,7 +131,7 @@ function mergeStaticMetadata( const resolvedTwitter = resolveTwitter( { ...target.twitter, images: twitter } as Twitter, target.metadataBase, - metadataContext, + { ...metadataContext, isStaticMetadataRouteFile: true }, titleTemplates.twitter ) target.twitter = resolvedTwitter @@ -142,7 +142,7 @@ function mergeStaticMetadata( const resolvedOpenGraph = resolveOpenGraph( { ...target.openGraph, images: openGraph } as OpenGraph, target.metadataBase, - metadataContext, + { ...metadataContext, isStaticMetadataRouteFile: true }, titleTemplates.openGraph ) target.openGraph = resolvedOpenGraph diff --git a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts index e5d232a31c50c..bc75c77d452b0 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.test.ts @@ -7,7 +7,7 @@ describe('resolveImages', () => { it(`should resolve images`, () => { const images = [image1, { url: image2, alt: 'Image2' }] - expect(resolveImages(images, null)).toEqual([ + expect(resolveImages(images, null, false)).toEqual([ { url: new URL(image1) }, { url: new URL(image2), alt: 'Image2' }, ]) @@ -16,7 +16,7 @@ describe('resolveImages', () => { it('should not mutate passed images', () => { const images = [image1, { url: image2, alt: 'Image2' }] - resolveImages(images, null) + resolveImages(images, null, false) expect(images).toEqual([image1, { url: image2, alt: 'Image2' }]) }) @@ -44,7 +44,11 @@ describe('resolveOpenGraph', () => { // pass authors as empty string { type: 'article', authors: '' }, null, - { trailingSlash: false, pathname: '' }, + { + trailingSlash: false, + pathname: '', + isStaticMetadataRouteFile: false, + }, '' ) ).toEqual({ @@ -63,7 +67,11 @@ describe('resolveOpenGraph', () => { resolveOpenGraph( { type: 'article', authors: null }, null, - { trailingSlash: false, pathname: '' }, + { + trailingSlash: false, + pathname: '', + isStaticMetadataRouteFile: false, + }, '' ) ).toEqual({ diff --git a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts index c641cb214d0f1..f915bf399990c 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts @@ -11,7 +11,7 @@ import type { import type { ResolvedTwitterMetadata, Twitter } from '../types/twitter-types' import { resolveArray, resolveAsArrayOrUndefined } from '../generate/utils' import { - getSocialImageFallbackMetadataBase, + getSocialImageMetadataBaseFallback, isStringOrURL, resolveUrl, resolveAbsoluteUrlWithPathname, @@ -41,15 +41,14 @@ const OgTypeFields = { function resolveAndValidateImage( item: FlattenArray, - metadataBase: ResolvedMetadataBase + metadataBase: ResolvedMetadataBase, + isStaticMetadataRouteFile: boolean | undefined ) { if (!item) return undefined const isItemUrl = isStringOrURL(item) const inputUrl = isItemUrl ? item : item.url if (!inputUrl) return undefined - const fallbackMetadataBase = getSocialImageFallbackMetadataBase(metadataBase) - // process.env.VERCEL is set to "1" when System Environment Variables are // exposed. When exposed, validation is not necessary since we are falling back to // process.env.VERCEL_PROJECT_PRODUCTION_URL, process.env.VERCEL_BRANCH_URL, or @@ -58,25 +57,42 @@ function resolveAndValidateImage( // detect in the build environment if the deployment is a Vercel deployment or not. // // x-ref: https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables - const isNonVercelDeployment = !process.env.VERCEL - // When not deployed to Vercel, we aren't able to determine a fallback value for `metadataBase` - // since it's derived from injected environment variables. For self-hosted setups, we want to warn - // about this since the only fallback we'll be able to generate is `localhost`. - if (isNonVercelDeployment) { - if ( - typeof inputUrl === 'string' && - !isFullStringUrl(inputUrl) && - !metadataBase - ) { + const isUsingVercelSystemEnvironmentVariables = Boolean(process.env.VERCEL) + + const isRelativeUrl = + typeof inputUrl === 'string' && !isFullStringUrl(inputUrl) + + // When no explicit metadataBase is specified by the user, we'll override it with the fallback metadata + // under the following conditions: + // - The provided URL is relative (ie ./og-image). + // - The image is statically generated by Next.js (such as the special `opengraph-image` route) + // In both cases, we want to ensure that across all environments, the ogImage is a fully qualified URL. + // In the `opengraph-image` case, since the user isn't explicitly passing a relative path, this ensures + // the ogImage will be properly discovered across different environments without the user needing to + // have a bunch of `process.env` checks when defining their `metadataBase`. + if (isRelativeUrl && (!metadataBase || isStaticMetadataRouteFile)) { + const fallbackMetadataBase = + getSocialImageMetadataBaseFallback(metadataBase) + + // When not using Vercel environment variables for URL injection, we aren't able to determine + // a fallback value for `metadataBase`. For self-hosted setups, we want to warn + // about this since the only fallback we'll be able to generate is `localhost`. + // In development, we'll only warn for relative metadata that isn't part of the static + // metadata conventions (eg `opengraph-image`), as otherwise it's currently very noisy + // for common cases. Eventually we should remove this warning all together in favor of + // devtools. + const shouldWarn = + !isUsingVercelSystemEnvironmentVariables && + (process.env.NODE_ENV === 'production' || !isStaticMetadataRouteFile) + + if (shouldWarn) { warnOnce( `metadataBase property in metadata export is not set for resolving social open graph or twitter images, using "${fallbackMetadataBase.origin}". See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase` ) } - } - // This is technically a bug. We shouldn't always be overriding the user-provided metadataBase with the fallback. - // But to match existing behavior, this keeps the logic in place, and it will be addressed in a follow-up PR. - metadataBase = fallbackMetadataBase + metadataBase = fallbackMetadataBase + } return isItemUrl ? { @@ -91,15 +107,18 @@ function resolveAndValidateImage( export function resolveImages( images: Twitter['images'], - metadataBase: ResolvedMetadataBase + metadataBase: ResolvedMetadataBase, + isStaticMetadataRouteFile: boolean ): NonNullable['images'] export function resolveImages( images: OpenGraph['images'], - metadataBase: ResolvedMetadataBase + metadataBase: ResolvedMetadataBase, + isStaticMetadataRouteFile: boolean ): NonNullable['images'] export function resolveImages( images: OpenGraph['images'] | Twitter['images'], - metadataBase: ResolvedMetadataBase + metadataBase: ResolvedMetadataBase, + isStaticMetadataRouteFile: boolean ): | NonNullable['images'] | NonNullable['images'] { @@ -108,7 +127,11 @@ export function resolveImages( const nonNullableImages = [] for (const item of resolvedImages) { - const resolvedItem = resolveAndValidateImage(item, metadataBase) + const resolvedItem = resolveAndValidateImage( + item, + metadataBase, + isStaticMetadataRouteFile + ) if (!resolvedItem) continue nonNullableImages.push(resolvedItem) @@ -150,7 +173,11 @@ export const resolveOpenGraph: FieldResolverExtraArgs< ;(target as any)[key] = value ? resolveArray(value) : null } } - target.images = resolveImages(og.images, metadataBase) + target.images = resolveImages( + og.images, + metadataBase, + metadataContext.isStaticMetadataRouteFile + ) } const resolved = { @@ -181,9 +208,7 @@ const TwitterBasicInfoKeys = [ export const resolveTwitter: FieldResolverExtraArgs< 'twitter', [ResolvedMetadataBase, MetadataContext, string | null] - // TODO: metadataContext is not currently in use here, but will be added back - // in a subsequent PR -> = (twitter, metadataBase, _metadataContext, titleTemplate) => { +> = (twitter, metadataBase, metadataContext, titleTemplate) => { if (!twitter) return null let card = 'card' in twitter ? twitter.card : undefined const resolved = { @@ -194,7 +219,11 @@ export const resolveTwitter: FieldResolverExtraArgs< resolved[infoKey] = twitter[infoKey] || null } - resolved.images = resolveImages(twitter.images, metadataBase) + resolved.images = resolveImages( + twitter.images, + metadataBase, + metadataContext.isStaticMetadataRouteFile + ) card = card || (resolved.images?.length ? 'summary_large_image' : 'summary') resolved.card = card diff --git a/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts b/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts index 1de0c3b8aba96..1a83e1ddf10e1 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-url.test.ts @@ -1,7 +1,7 @@ import { resolveUrl, resolveAbsoluteUrlWithPathname, - getSocialImageFallbackMetadataBase, + getSocialImageMetadataBaseFallback, } from './resolve-url' // required to be resolved as URL with resolveUrl() @@ -53,6 +53,7 @@ describe('resolveAbsoluteUrlWithPathname', () => { const opts = { trailingSlash: false, pathname: '/', + isStaticMetadataRouteFile: false, } const resolver = (url: string | URL) => resolveAbsoluteUrlWithPathname(url, metadataBase, opts) @@ -68,6 +69,7 @@ describe('resolveAbsoluteUrlWithPathname', () => { const opts = { trailingSlash: true, pathname: '/', + isStaticMetadataRouteFile: false, } const resolver = (url: string | URL) => resolveAbsoluteUrlWithPathname(url, metadataBase, opts) @@ -126,7 +128,7 @@ describe('getSocialImageFallbackMetadataBase', () => { describe('fallbackMetadataBase when metadataBase is not present', () => { let originalEnv: NodeJS.ProcessEnv function getSocialImageFallbackMetadataBaseHelper(): string { - return getSocialImageFallbackMetadataBase(null).href + return getSocialImageMetadataBaseFallback(null).href } beforeEach(() => { diff --git a/packages/next/src/lib/metadata/resolvers/resolve-url.ts b/packages/next/src/lib/metadata/resolvers/resolve-url.ts index 6648da643229e..32c20c90291b4 100644 --- a/packages/next/src/lib/metadata/resolvers/resolve-url.ts +++ b/packages/next/src/lib/metadata/resolvers/resolve-url.ts @@ -19,9 +19,15 @@ function getProductionDeploymentUrl(): URL | undefined { return origin ? new URL(`https://${origin}`) : undefined } -// For deployment url for metadata routes, prefer to use the deployment url if possible -// as these routes are unique to the deployments url. -export function getSocialImageFallbackMetadataBase( +/** + * Given an optional user-provided metadataBase, this determines what the metadataBase should + * fallback to. Specifically: + * - In dev, it should always be localhost + * - In Vercel preview builds, it should be the preview build ID + * - In start, it should be the user-provided metadataBase value. Otherwise, + * it'll fall back to the Vercel production deployment, and localhost as a last resort. + */ +export function getSocialImageMetadataBaseFallback( metadataBase: URL | null ): URL { const defaultMetadataBase = createLocalMetadataBase() diff --git a/packages/next/src/lib/metadata/types/resolvers.ts b/packages/next/src/lib/metadata/types/resolvers.ts index 15094b6248b76..c77d68d576ffc 100644 --- a/packages/next/src/lib/metadata/types/resolvers.ts +++ b/packages/next/src/lib/metadata/types/resolvers.ts @@ -16,4 +16,5 @@ export type FieldResolverExtraArgs< export type MetadataContext = { pathname: string trailingSlash: boolean + isStaticMetadataRouteFile: boolean } diff --git a/test/e2e/app-dir/metadata-warnings/app/relative-url-og/page.js b/test/e2e/app-dir/metadata-warnings/app/relative-url-og/page.js new file mode 100644 index 0000000000000..36ded85283298 --- /dev/null +++ b/test/e2e/app-dir/metadata-warnings/app/relative-url-og/page.js @@ -0,0 +1,9 @@ +export default function Page() { + return
Hello World
+} + +export const metadata = { + openGraph: { + images: '/og-image.png', + }, +} diff --git a/test/e2e/app-dir/metadata-warnings/index.test.ts b/test/e2e/app-dir/metadata-warnings/index.test.ts index 3982f2dfe139c..0d58c881e58d3 100644 --- a/test/e2e/app-dir/metadata-warnings/index.test.ts +++ b/test/e2e/app-dir/metadata-warnings/index.test.ts @@ -33,15 +33,21 @@ describe('app dir - metadata missing metadataBase', () => { await next.fetch('/og-image-convention') const output = getCliOutput(logStartPosition) - // TODO: This is currently broken and will be addressed in a follow-up PR. We - // currently warn even for metadata that conforms to the `opengraph-image` convention. - if (false) { + if (isNextDev) { expect(output).not.toInclude(METADATA_BASE_WARN_STRING) } else { expect(output).toInclude(METADATA_BASE_WARN_STRING) } }) + it('should warn metadataBase is missing and a relative URL is used', async () => { + const logStartPosition = next.cliOutput.length + await next.fetch('/relative-url-og') + const output = getCliOutput(logStartPosition) + + expect(output).toInclude(METADATA_BASE_WARN_STRING) + }) + it('should warn for unsupported metadata properties', async () => { const logStartPosition = next.cliOutput.length await next.fetch('/unsupported-metadata') diff --git a/test/e2e/app-dir/metadata/app/metadata-base/opengraph/page.tsx b/test/e2e/app-dir/metadata/app/metadata-base/opengraph/page.tsx new file mode 100644 index 0000000000000..eca7b1712f7a7 --- /dev/null +++ b/test/e2e/app-dir/metadata/app/metadata-base/opengraph/page.tsx @@ -0,0 +1,10 @@ +export default function Page() { + return 'metadata base opengraph page' +} + +export const metadata = { + metadataBase: new URL('https://acme.com'), + openGraph: { + images: '/og-image.png', + }, +} diff --git a/test/e2e/app-dir/metadata/metadata.test.ts b/test/e2e/app-dir/metadata/metadata.test.ts index 6c60c43647b6a..2dcc2a472300f 100644 --- a/test/e2e/app-dir/metadata/metadata.test.ts +++ b/test/e2e/app-dir/metadata/metadata.test.ts @@ -440,6 +440,15 @@ describe('app dir - metadata', () => { expect(favicon).toMatch('/favicon.ico') expect(icons).toEqual(['https://custom-icon-1.png']) }) + + it('metadataBase should override fallback base for resolving OG images', async () => { + const browser = await next.browser('/metadata-base/opengraph') + const matchMultiDom = createMultiDomMatcher(browser) + + await matchMultiDom('meta', 'property', 'content', { + 'og:image': 'https://acme.com/og-image.png', + }) + }) }) describe('icons', () => { From e220b0d4233bbef18c4e234b10fd3376deabb41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 27 Nov 2024 18:50:24 +0900 Subject: [PATCH 54/82] perf(turbopack): Use `ResolvedVc` for `turbopack-dev-server` (#73195) ### What? Use `ResolvedVc` instead of `Vc` for struct fields in `turbopack-dev-server` ### Why? ### How? --- turbopack/crates/turbopack-cli/src/dev/mod.rs | 27 ++++++++----- .../turbopack-cli/src/dev/web_entry_source.rs | 2 +- .../crates/turbopack-dev-server/src/html.rs | 10 ++--- .../src/introspect/mod.rs | 26 +++++++----- .../src/source/asset_graph.rs | 32 ++++++++------- .../src/source/combined.rs | 23 ++++++----- .../src/source/conditional.rs | 37 +++++++++-------- .../src/source/issue_context.rs | 39 +++++++++--------- .../src/source/lazy_instantiated.rs | 4 +- .../turbopack-dev-server/src/source/mod.rs | 26 ++++++------ .../src/source/resolve.rs | 2 +- .../src/source/route_tree.rs | 34 ++++++++-------- .../turbopack-dev-server/src/source/router.rs | 40 ++++++++++--------- .../src/source/static_assets.rs | 22 +++++----- .../src/source/wrapping_source.rs | 24 ++++++----- .../turbopack-dev-server/src/update/stream.rs | 8 ++-- .../src/render/node_api_source.rs | 2 +- .../src/render/rendered_source.rs | 6 +-- 18 files changed, 197 insertions(+), 167 deletions(-) diff --git a/turbopack/crates/turbopack-cli/src/dev/mod.rs b/turbopack/crates/turbopack-cli/src/dev/mod.rs index 9d92107093c0e..00b4c1a90ae0c 100644 --- a/turbopack/crates/turbopack-cli/src/dev/mod.rs +++ b/turbopack/crates/turbopack-cli/src/dev/mod.rs @@ -14,7 +14,7 @@ use owo_colors::OwoColorize; use turbo_rcstr::RcStr; use turbo_tasks::{ util::{FormatBytes, FormatDuration}, - TransientInstance, TurboTasks, UpdateInfo, Value, Vc, + ResolvedVc, TransientInstance, TurboTasks, UpdateInfo, Value, Vc, }; use turbo_tasks_fs::FileSystem; use turbo_tasks_malloc::TurboMalloc; @@ -301,23 +301,28 @@ async fn source( eager_compile, NodeEnv::Development.cell(), browserslist_query, + ) + .to_resolved() + .await?; + let static_source = ResolvedVc::upcast( + StaticAssetsContentSource::new(Default::default(), project_path.join("public".into())) + .to_resolved() + .await?, ); - let static_source = Vc::upcast(StaticAssetsContentSource::new( - Default::default(), - project_path.join("public".into()), - )); - let main_source = CombinedContentSource::new(vec![static_source, web_source]); - let introspect = Vc::upcast( + let main_source = CombinedContentSource::new(vec![static_source, web_source]) + .to_resolved() + .await?; + let introspect = ResolvedVc::upcast( IntrospectionSource { - roots: HashSet::from([Vc::upcast(main_source)]), + roots: HashSet::from([ResolvedVc::upcast(main_source)]), } - .cell(), + .resolved_cell(), ); - let main_source = Vc::upcast(main_source); + let main_source = ResolvedVc::upcast(main_source); Ok(Vc::upcast(PrefixedRouterContentSource::new( Default::default(), vec![("__turbopack__".into(), introspect)], - main_source, + *main_source, ))) } diff --git a/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs b/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs index 0dfcce7d295d0..a105030c24a62 100644 --- a/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs +++ b/turbopack/crates/turbopack-cli/src/dev/web_entry_source.rs @@ -157,7 +157,7 @@ pub async fn create_web_entry_source( .await?; let entry_asset = Vc::upcast(DevHtmlAsset::new( - server_root.join("index.html".into()), + server_root.join("index.html".into()).to_resolved().await?, entries, )); diff --git a/turbopack/crates/turbopack-dev-server/src/html.rs b/turbopack/crates/turbopack-dev-server/src/html.rs index 3688a31c6e256..321908a222da6 100644 --- a/turbopack/crates/turbopack-dev-server/src/html.rs +++ b/turbopack/crates/turbopack-dev-server/src/html.rs @@ -30,7 +30,7 @@ type DevHtmlEntry = ( #[turbo_tasks::value(shared)] #[derive(Clone)] pub struct DevHtmlAsset { - path: Vc, + path: ResolvedVc, entries: Vec, body: Option, } @@ -44,7 +44,7 @@ fn dev_html_chunk_reference_description() -> Vc { impl OutputAsset for DevHtmlAsset { #[turbo_tasks::function] fn ident(&self) -> Vc { - AssetIdent::from_path(self.path) + AssetIdent::from_path(*self.path) } #[turbo_tasks::function] @@ -68,7 +68,7 @@ impl Asset for DevHtmlAsset { impl DevHtmlAsset { /// Create a new dev HTML asset. - pub fn new(path: Vc, entries: Vec) -> Vc { + pub fn new(path: ResolvedVc, entries: Vec) -> Vc { DevHtmlAsset { path, entries, @@ -79,7 +79,7 @@ impl DevHtmlAsset { /// Create a new dev HTML asset. pub fn new_with_body( - path: Vc, + path: ResolvedVc, entries: Vec, body: RcStr, ) -> Vc { @@ -95,7 +95,7 @@ impl DevHtmlAsset { #[turbo_tasks::value_impl] impl DevHtmlAsset { #[turbo_tasks::function] - pub async fn with_path(self: Vc, path: Vc) -> Result> { + pub async fn with_path(self: Vc, path: ResolvedVc) -> Result> { let mut html: DevHtmlAsset = self.await?.clone_value(); html.path = path; Ok(html.cell()) diff --git a/turbopack/crates/turbopack-dev-server/src/introspect/mod.rs b/turbopack/crates/turbopack-dev-server/src/introspect/mod.rs index e675d44fae666..e69b0104aee4f 100644 --- a/turbopack/crates/turbopack-dev-server/src/introspect/mod.rs +++ b/turbopack/crates/turbopack-dev-server/src/introspect/mod.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, collections::HashSet, fmt::Display}; use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{ReadRef, TryJoinIterExt, Vc}; +use turbo_tasks::{ReadRef, ResolvedVc, TryJoinIterExt, Vc}; use turbo_tasks_fs::{json::parse_json_with_source_context, File}; use turbopack_core::{ asset::AssetContent, @@ -18,7 +18,7 @@ use crate::source::{ #[turbo_tasks::value(shared)] pub struct IntrospectionSource { - pub roots: HashSet>>, + pub roots: HashSet>>, } #[turbo_tasks::value_impl] @@ -36,7 +36,7 @@ impl Introspectable for IntrospectionSource { #[turbo_tasks::function] fn children(&self) -> Vc { let name = Vc::cell("root".into()); - Vc::cell(self.roots.iter().map(|root| (name, *root)).collect()) + Vc::cell(self.roots.iter().map(|root| (name, **root)).collect()) } } @@ -76,12 +76,16 @@ impl Display for HtmlStringEscaped { #[turbo_tasks::value_impl] impl ContentSource for IntrospectionSource { #[turbo_tasks::function] - fn get_routes(self: Vc) -> Vc { - Vc::::cell(vec![ - RouteTree::new_route(Vec::new(), RouteType::Exact, Vc::upcast(self)), - RouteTree::new_route(Vec::new(), RouteType::CatchAll, Vc::upcast(self)), + async fn get_routes(self: Vc) -> Result> { + Ok(Vc::::cell(vec![ + RouteTree::new_route(Vec::new(), RouteType::Exact, Vc::upcast(self)) + .to_resolved() + .await?, + RouteTree::new_route(Vec::new(), RouteType::CatchAll, Vc::upcast(self)) + .to_resolved() + .await?, ]) - .merge() + .merge()) } } @@ -89,7 +93,7 @@ impl ContentSource for IntrospectionSource { impl GetContentSourceContent for IntrospectionSource { #[turbo_tasks::function] async fn get( - self: Vc, + self: ResolvedVc, path: RcStr, _data: turbo_tasks::Value, ) -> Result> { @@ -100,12 +104,12 @@ impl GetContentSourceContent for IntrospectionSource { if roots.len() == 1 { *roots.iter().next().unwrap() } else { - Vc::upcast(self) + ResolvedVc::upcast(self) } } else { parse_json_with_source_context(path)? }; - let internal_ty = Vc::debug_identifier(introspectable).await?; + let internal_ty = Vc::debug_identifier(*introspectable).await?; fn str_or_err(s: &Result>) -> Cow<'_, str> { s.as_ref().map_or_else( |e| Cow::<'_, str>::Owned(format!("ERROR: {:?}", e)), diff --git a/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs b/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs index cd257fb8d30e7..a032862795d0e 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/asset_graph.rs @@ -29,8 +29,8 @@ type ExpandedState = State>; #[turbo_tasks::value(serialization = "none", eq = "manual", cell = "new")] pub struct AssetGraphContentSource { - root_path: Vc, - root_assets: Vc, + root_path: ResolvedVc, + root_assets: ResolvedVc, expanded: Option, } @@ -39,12 +39,12 @@ impl AssetGraphContentSource { /// Serves all assets references by root_asset. #[turbo_tasks::function] pub fn new_eager( - root_path: Vc, + root_path: ResolvedVc, root_asset: ResolvedVc>, ) -> Vc { Self::cell(AssetGraphContentSource { root_path, - root_assets: Vc::cell(fxindexset! { root_asset }), + root_assets: ResolvedVc::cell(fxindexset! { root_asset }), expanded: None, }) } @@ -53,12 +53,12 @@ impl AssetGraphContentSource { /// asset when it has served its content before. #[turbo_tasks::function] pub fn new_lazy( - root_path: Vc, + root_path: ResolvedVc, root_asset: ResolvedVc>, ) -> Vc { Self::cell(AssetGraphContentSource { root_path, - root_assets: Vc::cell(fxindexset! { root_asset }), + root_assets: ResolvedVc::cell(fxindexset! { root_asset }), expanded: Some(State::new(HashSet::new())), }) } @@ -66,8 +66,8 @@ impl AssetGraphContentSource { /// Serves all assets references by all root_assets. #[turbo_tasks::function] pub fn new_eager_multiple( - root_path: Vc, - root_assets: Vc, + root_path: ResolvedVc, + root_assets: ResolvedVc, ) -> Vc { Self::cell(AssetGraphContentSource { root_path, @@ -80,8 +80,8 @@ impl AssetGraphContentSource { /// of an asset when it has served its content before. #[turbo_tasks::function] pub fn new_lazy_multiple( - root_path: Vc, - root_assets: Vc, + root_path: ResolvedVc, + root_assets: ResolvedVc, ) -> Vc { Self::cell(AssetGraphContentSource { root_path, @@ -230,25 +230,27 @@ impl ContentSource for AssetGraphContentSource { )), ) }) - .collect(); + .map(|v| async move { v.to_resolved().await }) + .try_join() + .await?; Ok(Vc::::cell(routes).merge()) } } #[turbo_tasks::value] struct AssetGraphGetContentSourceContent { - source: Vc, + source: ResolvedVc, path: RcStr, - asset: Vc>, + asset: ResolvedVc>, } #[turbo_tasks::value_impl] impl AssetGraphGetContentSourceContent { #[turbo_tasks::function] pub fn new( - source: Vc, + source: ResolvedVc, path: RcStr, - asset: Vc>, + asset: ResolvedVc>, ) -> Vc { Self::cell(AssetGraphGetContentSourceContent { source, diff --git a/turbopack/crates/turbopack-dev-server/src/source/combined.rs b/turbopack/crates/turbopack-dev-server/src/source/combined.rs index 4ae58f8834e50..a3409d858c8ad 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/combined.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/combined.rs @@ -1,6 +1,6 @@ use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{TryJoinIterExt, Vc}; +use turbo_tasks::{ResolvedVc, TryJoinIterExt, Vc}; use turbopack_core::introspect::{Introspectable, IntrospectableChildren}; use super::{ @@ -15,11 +15,11 @@ use crate::source::ContentSources; /// not a [ContentSourceContent::NotFound]) will be returned. #[turbo_tasks::value(shared)] pub struct CombinedContentSource { - pub sources: Vec>>, + pub sources: Vec>>, } impl CombinedContentSource { - pub fn new(sources: Vec>>) -> Vc { + pub fn new(sources: Vec>>) -> Vc { CombinedContentSource { sources }.cell() } } @@ -27,9 +27,14 @@ impl CombinedContentSource { #[turbo_tasks::value_impl] impl ContentSource for CombinedContentSource { #[turbo_tasks::function] - fn get_routes(&self) -> Vc { - let all_routes = self.sources.iter().map(|s| s.get_routes()).collect(); - Vc::::cell(all_routes).merge() + async fn get_routes(&self) -> Result> { + let all_routes = self + .sources + .iter() + .map(|s| async move { s.get_routes().to_resolved().await }) + .try_join() + .await?; + Ok(Vc::::cell(all_routes).merge()) } #[turbo_tasks::function] @@ -53,7 +58,7 @@ impl Introspectable for CombinedContentSource { .map(|&source| async move { Ok( if let Some(source) = - Vc::try_resolve_sidecast::>(source).await? + ResolvedVc::try_sidecast::>(source).await? { Some(source.title().await?) } else { @@ -86,13 +91,13 @@ impl Introspectable for CombinedContentSource { .iter() .copied() .map(|s| async move { - Ok(Vc::try_resolve_sidecast::>(s).await?) + Ok(ResolvedVc::try_sidecast::>(s).await?) }) .try_join() .await? .into_iter() .flatten() - .map(|i| (source, i)) + .map(|i| (source, *i)) .collect(), )) } diff --git a/turbopack/crates/turbopack-dev-server/src/source/conditional.rs b/turbopack/crates/turbopack-dev-server/src/source/conditional.rs index 26b64bf7884a4..400705bad41bb 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/conditional.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/conditional.rs @@ -1,6 +1,6 @@ use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{Completion, State, Value, Vc}; +use turbo_tasks::{Completion, ResolvedVc, State, Value, Vc}; use turbopack_core::introspect::{Introspectable, IntrospectableChildren}; use super::{ @@ -23,8 +23,8 @@ use crate::source::{ContentSourceContent, ContentSources}; /// served once. #[turbo_tasks::value(serialization = "none", eq = "manual", cell = "new")] pub struct ConditionalContentSource { - activator: Vc>, - action: Vc>, + activator: ResolvedVc>, + action: ResolvedVc>, activated: State, } @@ -32,8 +32,8 @@ pub struct ConditionalContentSource { impl ConditionalContentSource { #[turbo_tasks::function] pub fn new( - activator: Vc>, - action: Vc>, + activator: ResolvedVc>, + action: ResolvedVc>, ) -> Vc { ConditionalContentSource { activator, @@ -47,15 +47,18 @@ impl ConditionalContentSource { #[turbo_tasks::value_impl] impl ContentSource for ConditionalContentSource { #[turbo_tasks::function] - async fn get_routes(self: Vc) -> Result> { + async fn get_routes(self: ResolvedVc) -> Result> { let this = self.await?; Ok(if !*this.activated.get() { this.activator.get_routes().map_routes(Vc::upcast( ConditionalContentSourceMapper { source: self }.cell(), )) } else { - Vc::::cell(vec![this.activator.get_routes(), this.action.get_routes()]) - .merge() + Vc::::cell(vec![ + this.activator.get_routes().to_resolved().await?, + this.action.get_routes().to_resolved().await?, + ]) + .merge() }) } @@ -67,7 +70,7 @@ impl ContentSource for ConditionalContentSource { #[turbo_tasks::value] struct ConditionalContentSourceMapper { - source: Vc, + source: ResolvedVc, } #[turbo_tasks::value_impl] @@ -75,7 +78,7 @@ impl MapGetContentSourceContent for ConditionalContentSourceMapper { #[turbo_tasks::function] fn map_get_content( &self, - get_content: Vc>, + get_content: ResolvedVc>, ) -> Vc> { Vc::upcast( ActivateOnGetContentSource { @@ -124,7 +127,7 @@ impl Introspectable for ConditionalContentSource { #[turbo_tasks::function] async fn title(&self) -> Result> { if let Some(activator) = - Vc::try_resolve_sidecast::>(self.activator).await? + ResolvedVc::try_sidecast::>(self.activator).await? { Ok(activator.title()) } else { @@ -136,12 +139,12 @@ impl Introspectable for ConditionalContentSource { async fn children(&self) -> Result> { Ok(Vc::cell( [ - Vc::try_resolve_sidecast::>(self.activator) + ResolvedVc::try_sidecast::>(self.activator) .await? - .map(|i| (activator_key(), i)), - Vc::try_resolve_sidecast::>(self.action) + .map(|i| (activator_key(), *i)), + ResolvedVc::try_sidecast::>(self.action) .await? - .map(|i| (action_key(), i)), + .map(|i| (action_key(), *i)), ] .into_iter() .flatten() @@ -152,8 +155,8 @@ impl Introspectable for ConditionalContentSource { #[turbo_tasks::value(serialization = "none", eq = "manual", cell = "new")] struct ActivateOnGetContentSource { - source: Vc, - get_content: Vc>, + source: ResolvedVc, + get_content: ResolvedVc>, } #[turbo_tasks::value_impl] diff --git a/turbopack/crates/turbopack-dev-server/src/source/issue_context.rs b/turbopack/crates/turbopack-dev-server/src/source/issue_context.rs index 23ea78abe0628..4fbcbbc0d4e96 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/issue_context.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/issue_context.rs @@ -1,6 +1,6 @@ use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{Value, Vc}; +use turbo_tasks::{ResolvedVc, Value, Vc}; use turbo_tasks_fs::FileSystemPath; use turbopack_core::{ introspect::{Introspectable, IntrospectableChildren}, @@ -15,18 +15,18 @@ use super::{ #[turbo_tasks::value] pub struct IssueFilePathContentSource { - file_path: Option>, + file_path: Option>, description: RcStr, - source: Vc>, + source: ResolvedVc>, } #[turbo_tasks::value_impl] impl IssueFilePathContentSource { #[turbo_tasks::function] pub fn new_file_path( - file_path: Vc, + file_path: ResolvedVc, description: RcStr, - source: Vc>, + source: ResolvedVc>, ) -> Vc { IssueFilePathContentSource { file_path: Some(file_path), @@ -37,7 +37,10 @@ impl IssueFilePathContentSource { } #[turbo_tasks::function] - pub fn new_description(description: RcStr, source: Vc>) -> Vc { + pub fn new_description( + description: RcStr, + source: ResolvedVc>, + ) -> Vc { IssueFilePathContentSource { file_path: None, description, @@ -50,12 +53,12 @@ impl IssueFilePathContentSource { #[turbo_tasks::value_impl] impl ContentSource for IssueFilePathContentSource { #[turbo_tasks::function] - async fn get_routes(self: Vc) -> Result> { + async fn get_routes(self: ResolvedVc) -> Result> { let this = self.await?; let routes = this .source .get_routes() - .issue_file_path(this.file_path, &*this.description) + .issue_file_path(this.file_path.map(|v| *v), &*this.description) .await?; Ok(routes.map_routes(Vc::upcast( IssueContextContentSourceMapper { source: self }.cell(), @@ -70,7 +73,7 @@ impl ContentSource for IssueFilePathContentSource { #[turbo_tasks::value] struct IssueContextContentSourceMapper { - source: Vc, + source: ResolvedVc, } #[turbo_tasks::value_impl] @@ -78,7 +81,7 @@ impl MapGetContentSourceContent for IssueContextContentSourceMapper { #[turbo_tasks::function] fn map_get_content( &self, - get_content: Vc>, + get_content: ResolvedVc>, ) -> Vc> { Vc::upcast( IssueContextGetContentSourceContent { @@ -92,8 +95,8 @@ impl MapGetContentSourceContent for IssueContextContentSourceMapper { #[turbo_tasks::value] struct IssueContextGetContentSourceContent { - get_content: Vc>, - source: Vc, + get_content: ResolvedVc>, + source: ResolvedVc, } #[turbo_tasks::value_impl] @@ -104,7 +107,7 @@ impl GetContentSourceContent for IssueContextGetContentSourceContent { let result = self .get_content .vary() - .issue_file_path(source.file_path, &*source.description) + .issue_file_path(source.file_path.map(|v| *v), &*source.description) .await?; Ok(result) } @@ -119,7 +122,7 @@ impl GetContentSourceContent for IssueContextGetContentSourceContent { let result = self .get_content .get(path, data) - .issue_file_path(source.file_path, &*source.description) + .issue_file_path(source.file_path.map(|v| *v), &*source.description) .await?; Ok(result) } @@ -131,7 +134,7 @@ impl Introspectable for IssueFilePathContentSource { async fn ty(&self) -> Result> { Ok( if let Some(source) = - Vc::try_resolve_sidecast::>(self.source).await? + ResolvedVc::try_sidecast::>(self.source).await? { source.ty() } else { @@ -144,7 +147,7 @@ impl Introspectable for IssueFilePathContentSource { async fn title(&self) -> Result> { Ok( if let Some(source) = - Vc::try_resolve_sidecast::>(self.source).await? + ResolvedVc::try_sidecast::>(self.source).await? { let title = source.title().await?; Vc::cell(format!("{}: {}", self.description, title).into()) @@ -158,7 +161,7 @@ impl Introspectable for IssueFilePathContentSource { async fn details(&self) -> Result> { Ok( if let Some(source) = - Vc::try_resolve_sidecast::>(self.source).await? + ResolvedVc::try_sidecast::>(self.source).await? { source.details() } else { @@ -171,7 +174,7 @@ impl Introspectable for IssueFilePathContentSource { async fn children(&self) -> Result> { Ok( if let Some(source) = - Vc::try_resolve_sidecast::>(self.source).await? + ResolvedVc::try_sidecast::>(self.source).await? { source.children() } else { diff --git a/turbopack/crates/turbopack-dev-server/src/source/lazy_instantiated.rs b/turbopack/crates/turbopack-dev-server/src/source/lazy_instantiated.rs index 22ec8c51fa0cf..78de3a4331e86 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/lazy_instantiated.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/lazy_instantiated.rs @@ -1,6 +1,6 @@ use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::Vc; +use turbo_tasks::{ResolvedVc, Vc}; use turbopack_core::introspect::{Introspectable, IntrospectableChildren}; use super::{route_tree::RouteTree, ContentSource}; @@ -17,7 +17,7 @@ pub trait GetContentSource { /// actually used. #[turbo_tasks::value(shared)] pub struct LazyInstantiatedContentSource { - pub get_source: Vc>, + pub get_source: ResolvedVc>, } #[turbo_tasks::value_impl] diff --git a/turbopack/crates/turbopack-dev-server/src/source/mod.rs b/turbopack/crates/turbopack-dev-server/src/source/mod.rs index 670cdd3301ec1..18b7cb0c90676 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/mod.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/mod.rs @@ -75,13 +75,13 @@ pub trait GetContentSourceContent { } #[turbo_tasks::value(transparent)] -pub struct GetContentSourceContents(Vec>>); +pub struct GetContentSourceContents(Vec>>); #[turbo_tasks::value] pub struct StaticContent { - pub content: Vc>, + pub content: ResolvedVc>, pub status_code: u16, - pub headers: Vc, + pub headers: ResolvedVc, } #[turbo_tasks::value(shared)] @@ -119,18 +119,18 @@ impl GetContentSourceContent for ContentSourceContent { #[turbo_tasks::value_impl] impl ContentSourceContent { #[turbo_tasks::function] - pub fn static_content( + pub async fn static_content( content: ResolvedVc>, - ) -> Vc { - ContentSourceContent::Static( + ) -> Result> { + Ok(ContentSourceContent::Static( StaticContent { - content: *content, + content, status_code: 200, - headers: HeaderList::empty(), + headers: HeaderList::empty().to_resolved().await?, } .resolved_cell(), ) - .cell() + .cell()) } #[turbo_tasks::function] @@ -141,9 +141,9 @@ impl ContentSourceContent { ) -> Vc { ContentSourceContent::Static( StaticContent { - content: *content, + content, status_code, - headers: *headers, + headers, } .resolved_cell(), ) @@ -200,7 +200,7 @@ pub struct ContentSourceData { /// requested. pub raw_headers: Option>, /// Request body, if requested. - pub body: Option>, + pub body: Option>, /// See [ContentSourceDataVary::cache_buster]. pub cache_buster: u64, } @@ -443,7 +443,7 @@ where } #[turbo_tasks::value(transparent)] -pub struct ContentSources(Vec>>); +pub struct ContentSources(Vec>>); #[turbo_tasks::value_impl] impl ContentSources { diff --git a/turbopack/crates/turbopack-dev-server/src/source/resolve.rs b/turbopack/crates/turbopack-dev-server/src/source/resolve.rs index 33c0ee65f4f99..fa79fd00683d7 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/resolve.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/resolve.rs @@ -146,7 +146,7 @@ async fn request_to_data( data.original_url = Some(original_request.uri.to_string().into()); } if vary.body { - data.body = Some(request.body.clone().into()); + data.body = Some(request.body.clone().resolved_cell()); } if vary.raw_query { data.raw_query = Some(request.uri.query().unwrap_or("").into()); diff --git a/turbopack/crates/turbopack-dev-server/src/source/route_tree.rs b/turbopack/crates/turbopack-dev-server/src/source/route_tree.rs index 9d1bb93b18122..7837f137cea6e 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/route_tree.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/route_tree.rs @@ -41,7 +41,7 @@ impl BaseSegment { /// lead to creating new tasks over and over. A celled list leads to task reuse /// and faster operation. #[turbo_tasks::value(transparent)] -pub struct RouteTrees(Vec>); +pub struct RouteTrees(Vec>); #[turbo_tasks::value_impl] impl RouteTrees { @@ -53,7 +53,7 @@ impl RouteTrees { return Ok(RouteTree::default().cell()); } if trees.len() == 1 { - return Ok(*trees.iter().next().unwrap()); + return Ok(**trees.iter().next().unwrap()); } // Find common base @@ -81,7 +81,7 @@ impl RouteTrees { if tree_values[i].base.len() > common_base { tree.with_base_len(common_base) } else { - *tree + **tree } }) .collect::>(); @@ -101,12 +101,12 @@ impl RouteTrees { #[derive(Default, Clone, Debug)] pub struct RouteTree { base: Vec, - sources: Vec>>, - static_segments: FxIndexMap>, + sources: Vec>>, + static_segments: FxIndexMap>, dynamic_segments: Vec>, - catch_all_sources: Vec>>, - fallback_sources: Vec>>, - not_found_sources: Vec>>, + catch_all_sources: Vec>>, + fallback_sources: Vec>>, + not_found_sources: Vec>>, } impl RouteTree { @@ -114,7 +114,7 @@ impl RouteTree { pub fn new_route_ref( base_segments: Vec, route_type: RouteType, - source: Vc>, + source: ResolvedVc>, ) -> Self { match route_type { RouteType::Exact => Self { @@ -172,7 +172,7 @@ impl RouteTree { if value.len() == 1 { value.into_iter().next().unwrap() } else { - Vc::::cell(value).merge().resolve().await? + Vc::::cell(value).merge().to_resolved().await? }, )) }) @@ -250,7 +250,7 @@ impl RouteTree { pub fn new_route( base_segments: Vec, route_type: RouteType, - source: Vc>, + source: ResolvedVc>, ) -> Vc { RouteTree::new_route_ref(base_segments, route_type, source).cell() } @@ -335,7 +335,7 @@ impl RouteTree { match selector_segment { BaseSegment::Static(value) => Ok(RouteTree { base, - static_segments: fxindexmap! { value => inner.cell() }, + static_segments: fxindexmap! { value => inner.resolved_cell() }, ..Default::default() } .cell()), @@ -370,19 +370,19 @@ impl RouteTree { } = &mut this; for s in sources.iter_mut() { - *s = mapper.map_get_content(*s); + *s = mapper.map_get_content(**s).to_resolved().await?; } for s in catch_all_sources.iter_mut() { - *s = mapper.map_get_content(*s); + *s = mapper.map_get_content(**s).to_resolved().await?; } for s in fallback_sources.iter_mut() { - *s = mapper.map_get_content(*s); + *s = mapper.map_get_content(**s).to_resolved().await?; } for s in not_found_sources.iter_mut() { - *s = mapper.map_get_content(*s); + *s = mapper.map_get_content(**s).to_resolved().await?; } for r in static_segments.values_mut() { - *r = r.map_routes(mapper); + *r = r.map_routes(mapper).to_resolved().await?; } for r in dynamic_segments.iter_mut() { *r = r.map_routes(mapper).to_resolved().await?; diff --git a/turbopack/crates/turbopack-dev-server/src/source/router.rs b/turbopack/crates/turbopack-dev-server/src/source/router.rs index 80fe13c5ce17a..59b586c3d51e5 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/router.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/router.rs @@ -2,7 +2,7 @@ use std::iter::once; use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{TryJoinIterExt, Value, Vc}; +use turbo_tasks::{ResolvedVc, TryJoinIterExt, Value, Vc}; use turbopack_core::introspect::{Introspectable, IntrospectableChildren}; use super::{ @@ -19,18 +19,18 @@ use crate::source::{route_tree::MapGetContentSourceContent, ContentSources}; /// other subpaths, including if the request path does not include the prefix. #[turbo_tasks::value(shared)] pub struct PrefixedRouterContentSource { - pub prefix: Vc, - pub routes: Vec<(RcStr, Vc>)>, - pub fallback: Vc>, + pub prefix: ResolvedVc, + pub routes: Vec<(RcStr, ResolvedVc>)>, + pub fallback: ResolvedVc>, } #[turbo_tasks::value_impl] impl PrefixedRouterContentSource { #[turbo_tasks::function] pub fn new( - prefix: Vc, - routes: Vec<(RcStr, Vc>)>, - fallback: Vc>, + prefix: ResolvedVc, + routes: Vec<(RcStr, ResolvedVc>)>, + fallback: ResolvedVc>, ) -> Vc { PrefixedRouterContentSource { prefix, @@ -42,8 +42,8 @@ impl PrefixedRouterContentSource { } fn get_children( - routes: &[(RcStr, Vc>)], - fallback: &Vc>, + routes: &[(RcStr, ResolvedVc>)], + fallback: &ResolvedVc>, ) -> Vc { Vc::cell( routes @@ -55,8 +55,8 @@ fn get_children( } async fn get_introspection_children( - routes: &[(RcStr, Vc>)], - fallback: &Vc>, + routes: &[(RcStr, ResolvedVc>)], + fallback: &ResolvedVc>, ) -> Result> { Ok(Vc::cell( routes @@ -64,9 +64,9 @@ async fn get_introspection_children( .cloned() .chain(std::iter::once((RcStr::default(), *fallback))) .map(|(path, source)| async move { - Ok(Vc::try_resolve_sidecast::>(source) + Ok(ResolvedVc::try_sidecast::>(source) .await? - .map(|i| (Vc::cell(path), i))) + .map(|i| (Vc::cell(path), *i))) }) .try_join() .await? @@ -108,7 +108,9 @@ impl ContentSource for PrefixedRouterContentSource { Ok(Vc::::cell( inner_trees .chain(once(self.fallback.get_routes())) - .collect(), + .map(|v| async move { v.to_resolved().await }) + .try_join() + .await?, ) .merge()) } @@ -121,7 +123,7 @@ impl ContentSource for PrefixedRouterContentSource { #[turbo_tasks::value] struct PrefixedRouterContentSourceMapper { - prefix: Vc, + prefix: ResolvedVc, path: RcStr, } @@ -129,8 +131,8 @@ struct PrefixedRouterContentSourceMapper { impl MapGetContentSourceContent for PrefixedRouterContentSourceMapper { #[turbo_tasks::function] fn map_get_content( - self: Vc, - get_content: Vc>, + self: ResolvedVc, + get_content: ResolvedVc>, ) -> Vc> { Vc::upcast( PrefixedRouterGetContentSourceContent { @@ -144,8 +146,8 @@ impl MapGetContentSourceContent for PrefixedRouterContentSourceMapper { #[turbo_tasks::value] struct PrefixedRouterGetContentSourceContent { - mapper: Vc, - get_content: Vc>, + mapper: ResolvedVc, + get_content: ResolvedVc>, } #[turbo_tasks::value_impl] diff --git a/turbopack/crates/turbopack-dev-server/src/source/static_assets.rs b/turbopack/crates/turbopack-dev-server/src/source/static_assets.rs index 443b35fd81c3e..5e90c6c183a69 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/static_assets.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/static_assets.rs @@ -1,6 +1,6 @@ use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{Value, Vc}; +use turbo_tasks::{ResolvedVc, TryJoinIterExt, Value, Vc}; use turbo_tasks_fs::{DirectoryContent, DirectoryEntry, FileSystemPath}; use turbopack_core::{ asset::Asset, @@ -16,8 +16,8 @@ use super::{ #[turbo_tasks::value(shared)] pub struct StaticAssetsContentSource { - pub prefix: Vc, - pub dir: Vc, + pub prefix: ResolvedVc, + pub dir: ResolvedVc, } #[turbo_tasks::value_impl] @@ -30,8 +30,8 @@ impl StaticAssetsContentSource { #[turbo_tasks::function] pub async fn with_prefix( - prefix: Vc, - dir: Vc, + prefix: ResolvedVc, + dir: ResolvedVc, ) -> Result> { if cfg!(debug_assertions) { let prefix_string = prefix.await?; @@ -66,7 +66,9 @@ async fn get_routes_from_directory(dir: Vc) -> Result None, }) - .collect(); + .map(|v| async move { v.to_resolved().await }) + .try_join() + .await?; Ok(Vc::::cell(routes).merge()) } @@ -76,19 +78,19 @@ impl ContentSource for StaticAssetsContentSource { async fn get_routes(&self) -> Result> { let prefix = self.prefix.await?; let prefix = BaseSegment::from_static_pathname(prefix.as_str()).collect::>(); - Ok(get_routes_from_directory(self.dir).with_prepended_base(prefix)) + Ok(get_routes_from_directory(*self.dir).with_prepended_base(prefix)) } } #[turbo_tasks::value] struct StaticAssetsContentSourceItem { - path: Vc, + path: ResolvedVc, } #[turbo_tasks::value_impl] impl StaticAssetsContentSourceItem { #[turbo_tasks::function] - pub fn new(path: Vc) -> Vc { + pub fn new(path: ResolvedVc) -> Vc { StaticAssetsContentSourceItem { path }.cell() } } @@ -97,7 +99,7 @@ impl StaticAssetsContentSourceItem { impl GetContentSourceContent for StaticAssetsContentSourceItem { #[turbo_tasks::function] fn get(&self, _path: RcStr, _data: Value) -> Vc { - let content = Vc::upcast::>(FileSource::new(self.path)).content(); + let content = Vc::upcast::>(FileSource::new(*self.path)).content(); ContentSourceContent::static_content(content.versioned()) } } diff --git a/turbopack/crates/turbopack-dev-server/src/source/wrapping_source.rs b/turbopack/crates/turbopack-dev-server/src/source/wrapping_source.rs index e32c4d6ba733f..19e128a86ce40 100644 --- a/turbopack/crates/turbopack-dev-server/src/source/wrapping_source.rs +++ b/turbopack/crates/turbopack-dev-server/src/source/wrapping_source.rs @@ -1,6 +1,6 @@ use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{Value, Vc}; +use turbo_tasks::{ResolvedVc, TryJoinIterExt, Value, Vc}; use super::{ ContentSourceContent, ContentSourceData, ContentSourceDataVary, GetContentSourceContent, @@ -25,16 +25,16 @@ pub trait ContentSourceProcessor { #[turbo_tasks::value] pub struct WrappedGetContentSourceContent { - inner: Vc>, - processor: Vc>, + inner: ResolvedVc>, + processor: ResolvedVc>, } #[turbo_tasks::value_impl] impl WrappedGetContentSourceContent { #[turbo_tasks::function] pub fn new( - inner: Vc>, - processor: Vc>, + inner: ResolvedVc>, + processor: ResolvedVc>, ) -> Vc { WrappedGetContentSourceContent { inner, processor }.cell() } @@ -68,12 +68,16 @@ impl GetContentSourceContent for WrappedGetContentSourceContent { .await? .iter() .map(|s| { - Vc::upcast(WrappedGetContentSourceContent::new( - *s, - self.processor, - )) + Vc::upcast::>( + WrappedGetContentSourceContent::new( + **s, + *self.processor, + ), + ) }) - .collect(), + .map(|v| async move { v.to_resolved().await }) + .try_join() + .await?, ), }, }, diff --git a/turbopack/crates/turbopack-dev-server/src/update/stream.rs b/turbopack/crates/turbopack-dev-server/src/update/stream.rs index 165236598b953..b7a2594333b91 100644 --- a/turbopack/crates/turbopack-dev-server/src/update/stream.rs +++ b/turbopack/crates/turbopack-dev-server/src/update/stream.rs @@ -6,7 +6,7 @@ use tokio::sync::mpsc::Sender; use tokio_stream::wrappers::ReceiverStream; use tracing::Instrument; use turbo_rcstr::RcStr; -use turbo_tasks::{IntoTraitRef, ReadRef, TransientInstance, Vc}; +use turbo_tasks::{IntoTraitRef, ReadRef, ResolvedVc, TransientInstance, Vc}; use turbo_tasks_fs::{FileSystem, FileSystemPath}; use turbopack_core::{ error::PrettyPrintError, @@ -58,7 +58,7 @@ async fn get_update_stream_item( FatalStreamIssue { resource, description: StyledString::Text(format!("{}", PrettyPrintError(&e)).into()) - .cell(), + .resolved_cell(), } .cell() .into_plain(OptionIssueProcessingPathItems::none()) @@ -282,7 +282,7 @@ pub enum UpdateStreamItem { #[turbo_tasks::value(serialization = "none")] struct FatalStreamIssue { - description: Vc, + description: ResolvedVc, resource: RcStr, } @@ -310,6 +310,6 @@ impl Issue for FatalStreamIssue { #[turbo_tasks::function] fn description(&self) -> Vc { - Vc::cell(Some(self.description)) + Vc::cell(Some(*self.description)) } } diff --git a/turbopack/crates/turbopack-node/src/render/node_api_source.rs b/turbopack/crates/turbopack-node/src/render/node_api_source.rs index 1ef5dd0cacbca..06377f26e9003 100644 --- a/turbopack/crates/turbopack-node/src/render/node_api_source.rs +++ b/turbopack/crates/turbopack-node/src/render/node_api_source.rs @@ -150,7 +150,7 @@ impl GetContentSourceContent for NodeApiContentSource { data: Some(self.render_data.await?), } .cell(), - *body, + **body, self.debug, ) .to_resolved() diff --git a/turbopack/crates/turbopack-node/src/render/rendered_source.rs b/turbopack/crates/turbopack-node/src/render/rendered_source.rs index b05ce9d12abfd..8aaad3a3617dc 100644 --- a/turbopack/crates/turbopack-node/src/render/rendered_source.rs +++ b/turbopack/crates/turbopack-node/src/render/rendered_source.rs @@ -68,12 +68,12 @@ pub fn create_node_rendered_source( render_data, debug, } - .cell(); + .resolved_cell(); Vc::upcast(ConditionalContentSource::new( - Vc::upcast(source), + Vc::upcast(*source), Vc::upcast( LazyInstantiatedContentSource { - get_source: Vc::upcast(source), + get_source: ResolvedVc::upcast(source), } .cell(), ), From 12368471c3556a2ceb0aaf5031f1102d166ccfce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 27 Nov 2024 18:51:17 +0900 Subject: [PATCH 55/82] perf(turbopack): Use `ResolvedVc` for `turbo-tasks-fetch` (#73201) ### What? Use `ResolvedVc` instead of `Vc` for struct fields in `turbopack-tasks-fetch`. ### Why? ### How? --- crates/next-core/src/next_font/google/mod.rs | 2 +- turbopack/crates/turbo-tasks-fetch/src/lib.rs | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/next-core/src/next_font/google/mod.rs b/crates/next-core/src/next_font/google/mod.rs index d03b701d100db..8b4c0312fdc51 100644 --- a/crates/next-core/src/next_font/google/mod.rs +++ b/crates/next-core/src/next_font/google/mod.rs @@ -627,7 +627,7 @@ async fn fetch_from_google_fonts( .await?; Ok(match &*result { - Ok(r) => Some(r.await?.body), + Ok(r) => Some(*r.await?.body), Err(err) => { // Inform the user of the failure to retreive the stylesheet / font, but don't // propagate this error. We don't want e.g. offline connections to prevent page diff --git a/turbopack/crates/turbo-tasks-fetch/src/lib.rs b/turbopack/crates/turbo-tasks-fetch/src/lib.rs index abd87aecc65b7..353252c4f90d6 100644 --- a/turbopack/crates/turbo-tasks-fetch/src/lib.rs +++ b/turbopack/crates/turbo-tasks-fetch/src/lib.rs @@ -16,13 +16,13 @@ pub fn register() { } #[turbo_tasks::value(transparent)] -pub struct FetchResult(Result, Vc>); +pub struct FetchResult(Result, ResolvedVc>); #[turbo_tasks::value(shared)] #[derive(Debug)] pub struct HttpResponse { pub status: u16, - pub body: Vc, + pub body: ResolvedVc, } #[turbo_tasks::value(shared)] @@ -80,14 +80,14 @@ pub async fn fetch( Ok(Vc::cell(Ok(HttpResponse { status, - body: HttpResponseBody::cell(HttpResponseBody(body)), + body: HttpResponseBody::resolved_cell(HttpResponseBody(body)), } - .cell()))) + .resolved_cell()))) } Err(err) => { mark_session_dependent(); Ok(Vc::cell(Err( - FetchError::from_reqwest_error(&err, url).cell() + FetchError::from_reqwest_error(&err, url).resolved_cell() ))) } } @@ -105,8 +105,8 @@ pub enum FetchErrorKind { #[turbo_tasks::value(shared)] pub struct FetchError { pub url: ResolvedVc, - pub kind: Vc, - pub detail: Vc, + pub kind: ResolvedVc, + pub detail: ResolvedVc, } impl FetchError { @@ -122,9 +122,9 @@ impl FetchError { }; FetchError { - detail: StyledString::Text(error.to_string().into()).cell(), + detail: StyledString::Text(error.to_string().into()).resolved_cell(), url: ResolvedVc::cell(url.into()), - kind: kind.into(), + kind: kind.resolved_cell(), } } } @@ -141,7 +141,7 @@ impl FetchError { Ok(FetchIssue { issue_context, severity, - url: *this.url, + url: this.url, kind: this.kind, detail: this.detail, } @@ -153,9 +153,9 @@ impl FetchError { pub struct FetchIssue { pub issue_context: ResolvedVc, pub severity: ResolvedVc, - pub url: Vc, - pub kind: Vc, - pub detail: Vc, + pub url: ResolvedVc, + pub kind: ResolvedVc, + pub detail: ResolvedVc, } #[turbo_tasks::value_impl] @@ -208,6 +208,6 @@ impl Issue for FetchIssue { #[turbo_tasks::function] fn detail(&self) -> Vc { - Vc::cell(Some(self.detail)) + Vc::cell(Some(*self.detail)) } } From 6ef912dc9350e789babbd2b5f0eef2e84b2a885f Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Wed, 27 Nov 2024 12:56:47 +0100 Subject: [PATCH 56/82] port turbopack-node to ResolvedVc (#73082) Does what it says on the tin. One struct seems to be trivially used in a trait which requires it to be a Vc so I left it with a comment. @bgw perhaps we can set up some lint + disabling comment for all the cases in this doc? Would be handy to ensure we are continuing to follow the heuristic in the future also. --- .../crates/turbopack-node/src/evaluate.rs | 8 +++--- .../crates/turbopack-node/src/node_entry.rs | 2 ++ .../turbopack-node/src/transforms/postcss.rs | 5 +++- .../turbopack-node/src/transforms/webpack.rs | 28 +++++++++++-------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/turbopack/crates/turbopack-node/src/evaluate.rs b/turbopack/crates/turbopack-node/src/evaluate.rs index ff8fcceb485b4..ce875b2f6478e 100644 --- a/turbopack/crates/turbopack-node/src/evaluate.rs +++ b/turbopack/crates/turbopack-node/src/evaluate.rs @@ -295,7 +295,7 @@ pub trait EvaluateContext { fn keep_alive(&self) -> bool { false } - fn args(&self) -> &[Vc]; + fn args(&self) -> &[ResolvedVc]; fn cwd(&self) -> Vc; async fn emit_error(&self, error: StructuredError, pool: &NodeJsPool) -> Result<()>; async fn info( @@ -370,7 +370,7 @@ pub fn evaluate( asset_context: ResolvedVc>, chunking_context: ResolvedVc>, runtime_entries: Option>, - args: Vec>, + args: Vec>, additional_invalidation: ResolvedVc, debug: bool, ) -> Vc { @@ -551,7 +551,7 @@ struct BasicEvaluateContext { asset_context: ResolvedVc>, chunking_context: ResolvedVc>, runtime_entries: Option>, - args: Vec>, + args: Vec>, additional_invalidation: ResolvedVc, debug: bool, } @@ -580,7 +580,7 @@ impl EvaluateContext for BasicEvaluateContext { ) } - fn args(&self) -> &[Vc] { + fn args(&self) -> &[ResolvedVc] { &self.args } diff --git a/turbopack/crates/turbopack-node/src/node_entry.rs b/turbopack/crates/turbopack-node/src/node_entry.rs index 155fdc4a142ea..71399a221cc40 100644 --- a/turbopack/crates/turbopack-node/src/node_entry.rs +++ b/turbopack/crates/turbopack-node/src/node_entry.rs @@ -16,6 +16,8 @@ pub struct NodeRenderingEntry { pub project_dir: ResolvedVc, } +// TODO(ResolvedVc): this struct seems to be trivially used in this trait which returns a Vc +// so perhaps it should remain a Vc? #[turbo_tasks::value(transparent)] pub struct NodeRenderingEntries(Vec>); diff --git a/turbopack/crates/turbopack-node/src/transforms/postcss.rs b/turbopack/crates/turbopack-node/src/transforms/postcss.rs index 8c00cd68a0d88..ab73222c1dc96 100644 --- a/turbopack/crates/turbopack-node/src/transforms/postcss.rs +++ b/turbopack/crates/turbopack-node/src/transforms/postcss.rs @@ -511,7 +511,10 @@ impl PostCssTransformedAsset { asset_context: evaluate_context, chunking_context: *chunking_context, resolve_options_context: None, - args: vec![Vc::cell(content.into()), Vc::cell(css_path.into())], + args: vec![ + ResolvedVc::cell(content.into()), + ResolvedVc::cell(css_path.into()), + ], additional_invalidation: config_changed, }) .await?; diff --git a/turbopack/crates/turbopack-node/src/transforms/webpack.rs b/turbopack/crates/turbopack-node/src/transforms/webpack.rs index b4c72d0913a48..5107b0d3ec8b2 100644 --- a/turbopack/crates/turbopack-node/src/transforms/webpack.rs +++ b/turbopack/crates/turbopack-node/src/transforms/webpack.rs @@ -3,6 +3,7 @@ use std::mem::take; use anyhow::{bail, Context, Result}; use async_trait::async_trait; use either::Either; +use futures::future::try_join_all; use serde::{Deserialize, Serialize}; use serde_json::{json, Value as JsonValue}; use serde_with::serde_as; @@ -172,7 +173,7 @@ impl GenerateSourceMap for WebpackLoadersProcessedAsset { struct ProcessWebpackLoadersResult { content: ResolvedVc, source_map: Option>, - assets: Vec>, + assets: Vec>, } #[turbo_tasks::function] @@ -242,11 +243,11 @@ impl WebpackLoadersProcessedAsset { chunking_context, resolve_options_context: Some(transform.resolve_options_context), args: vec![ - Vc::cell(content.into()), + ResolvedVc::cell(content.into()), // We need to pass the query string to the loader - Vc::cell(resource_path.to_string().into()), - Vc::cell(this.source.ident().query().await?.to_string().into()), - Vc::cell(json!(*loaders)), + ResolvedVc::cell(resource_path.to_string().into()), + ResolvedVc::cell(this.source.ident().query().await?.to_string().into()), + ResolvedVc::cell(json!(*loaders)), ], additional_invalidation: Completion::immutable().to_resolved().await?, }) @@ -278,11 +279,14 @@ impl WebpackLoadersProcessedAsset { Either::Left(str) => File::from(str), Either::Right(bytes) => File::from(bytes.binary), }; - let assets = emitted_assets_to_virtual_sources(processed.assets) - .await? - .into_iter() - .map(|asset| *asset) - .collect(); + let assets = try_join_all( + emitted_assets_to_virtual_sources(processed.assets) + .await? + .into_iter() + .map(|v| v.to_resolved()), + ) + .await?; + let content = AssetContent::File(FileContent::Content(file).resolved_cell()).resolved_cell(); Ok(ProcessWebpackLoadersResult { @@ -397,7 +401,7 @@ pub struct WebpackLoaderContext { pub asset_context: ResolvedVc>, pub chunking_context: ResolvedVc>, pub resolve_options_context: Option>, - pub args: Vec>, + pub args: Vec>, pub additional_invalidation: ResolvedVc, } @@ -425,7 +429,7 @@ impl EvaluateContext for WebpackLoaderContext { ) } - fn args(&self) -> &[Vc] { + fn args(&self) -> &[ResolvedVc] { &self.args } From 9e1e8a5b1f8ba904ed9b996144f378650502a51c Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Wed, 27 Nov 2024 13:15:50 +0100 Subject: [PATCH 57/82] port turbopack-static to ResolvedVc (#73084) --- .../crates/turbopack-core/src/chunk/mod.rs | 4 +- .../crates/turbopack-static/src/fixed.rs | 13 +++-- turbopack/crates/turbopack-static/src/lib.rs | 51 +++++++++++-------- .../turbopack-static/src/output_asset.rs | 10 ++-- 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/turbopack/crates/turbopack-core/src/chunk/mod.rs b/turbopack/crates/turbopack-core/src/chunk/mod.rs index f52d9e8d463f2..bd475b520630d 100644 --- a/turbopack/crates/turbopack-core/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-core/src/chunk/mod.rs @@ -91,8 +91,8 @@ pub struct ModuleIds(Vec>); #[turbo_tasks::value_trait] pub trait ChunkableModule: Module + Asset { fn as_chunk_item( - self: Vc, - chunking_context: Vc>, + self: ResolvedVc, + chunking_context: ResolvedVc>, ) -> Vc>; } diff --git a/turbopack/crates/turbopack-static/src/fixed.rs b/turbopack/crates/turbopack-static/src/fixed.rs index e99f0111b01d2..8ba5a5001fe21 100644 --- a/turbopack/crates/turbopack-static/src/fixed.rs +++ b/turbopack/crates/turbopack-static/src/fixed.rs @@ -1,4 +1,4 @@ -use turbo_tasks::Vc; +use turbo_tasks::{ResolvedVc, Vc}; use turbo_tasks_fs::FileSystemPath; use turbopack_core::{ asset::{Asset, AssetContent}, @@ -11,14 +11,17 @@ use turbopack_core::{ /// content hashing to generate a long term cacheable URL. #[turbo_tasks::value] pub struct FixedStaticAsset { - output_path: Vc, - source: Vc>, + output_path: ResolvedVc, + source: ResolvedVc>, } #[turbo_tasks::value_impl] impl FixedStaticAsset { #[turbo_tasks::function] - pub fn new(output_path: Vc, source: Vc>) -> Vc { + pub fn new( + output_path: ResolvedVc, + source: ResolvedVc>, + ) -> Vc { FixedStaticAsset { output_path, source, @@ -31,7 +34,7 @@ impl FixedStaticAsset { impl OutputAsset for FixedStaticAsset { #[turbo_tasks::function] fn ident(&self) -> Vc { - AssetIdent::from_path(self.output_path) + AssetIdent::from_path(*self.output_path) } } diff --git a/turbopack/crates/turbopack-static/src/lib.rs b/turbopack/crates/turbopack-static/src/lib.rs index 355d85385ac2d..47e2521e085a1 100644 --- a/turbopack/crates/turbopack-static/src/lib.rs +++ b/turbopack/crates/turbopack-static/src/lib.rs @@ -17,7 +17,7 @@ pub mod output_asset; use anyhow::Result; use turbo_rcstr::RcStr; -use turbo_tasks::{ValueToString, Vc}; +use turbo_tasks::{ResolvedVc, ValueToString, Vc}; use turbopack_core::{ asset::{Asset, AssetContent}, chunk::{ChunkItem, ChunkType, ChunkableModule, ChunkingContext}, @@ -47,14 +47,17 @@ fn modifier() -> Vc { #[turbo_tasks::value] #[derive(Clone)] pub struct StaticModuleAsset { - pub source: Vc>, - pub asset_context: Vc>, + pub source: ResolvedVc>, + pub asset_context: ResolvedVc>, } #[turbo_tasks::value_impl] impl StaticModuleAsset { #[turbo_tasks::function] - pub fn new(source: Vc>, asset_context: Vc>) -> Vc { + pub fn new( + source: ResolvedVc>, + asset_context: ResolvedVc>, + ) -> Vc { Self::cell(StaticModuleAsset { source, asset_context, @@ -62,8 +65,11 @@ impl StaticModuleAsset { } #[turbo_tasks::function] - fn static_asset(&self, chunking_context: Vc>) -> Vc { - StaticAsset::new(chunking_context, self.source) + async fn static_asset( + &self, + chunking_context: ResolvedVc>, + ) -> Vc { + StaticAsset::new(*chunking_context, *self.source) } } @@ -89,15 +95,18 @@ impl Asset for StaticModuleAsset { #[turbo_tasks::value_impl] impl ChunkableModule for StaticModuleAsset { #[turbo_tasks::function] - fn as_chunk_item( - self: Vc, - chunking_context: Vc>, - ) -> Vc> { - Vc::upcast(ModuleChunkItem::cell(ModuleChunkItem { + async fn as_chunk_item( + self: ResolvedVc, + chunking_context: ResolvedVc>, + ) -> Result>> { + Ok(Vc::upcast(ModuleChunkItem::cell(ModuleChunkItem { module: self, chunking_context, - static_asset: self.static_asset(Vc::upcast(chunking_context)), - })) + static_asset: self + .static_asset(*ResolvedVc::upcast(chunking_context)) + .to_resolved() + .await?, + }))) } } @@ -111,9 +120,9 @@ impl EcmascriptChunkPlaceable for StaticModuleAsset { #[turbo_tasks::value] struct ModuleChunkItem { - module: Vc, - chunking_context: Vc>, - static_asset: Vc, + module: ResolvedVc, + chunking_context: ResolvedVc>, + static_asset: ResolvedVc, } #[turbo_tasks::value_impl] @@ -126,7 +135,7 @@ impl ChunkItem for ModuleChunkItem { #[turbo_tasks::function] async fn references(&self) -> Result> { Ok(Vc::cell(vec![Vc::upcast(SingleOutputAssetReference::new( - Vc::upcast(self.static_asset), + *ResolvedVc::upcast(self.static_asset), Vc::cell( format!( "static(url) {}", @@ -139,7 +148,7 @@ impl ChunkItem for ModuleChunkItem { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - Vc::upcast(self.chunking_context) + *ResolvedVc::upcast(self.chunking_context) } #[turbo_tasks::function] @@ -151,7 +160,7 @@ impl ChunkItem for ModuleChunkItem { #[turbo_tasks::function] fn module(&self) -> Vc> { - Vc::upcast(self.module) + *ResolvedVc::upcast(self.module) } } @@ -159,7 +168,7 @@ impl ChunkItem for ModuleChunkItem { impl EcmascriptChunkItem for ModuleChunkItem { #[turbo_tasks::function] fn chunking_context(&self) -> Vc> { - self.chunking_context + *self.chunking_context } #[turbo_tasks::function] @@ -185,7 +194,7 @@ impl EcmascriptChunkItem for ModuleChunkItem { impl CssEmbed for ModuleChunkItem { #[turbo_tasks::function] fn embedded_asset(&self) -> Vc> { - Vc::upcast(self.static_asset) + *ResolvedVc::upcast(self.static_asset) } } diff --git a/turbopack/crates/turbopack-static/src/output_asset.rs b/turbopack/crates/turbopack-static/src/output_asset.rs index 1f7a2effd71ea..cd6f86f46dfd6 100644 --- a/turbopack/crates/turbopack-static/src/output_asset.rs +++ b/turbopack/crates/turbopack-static/src/output_asset.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use turbo_tasks::Vc; +use turbo_tasks::{ResolvedVc, Vc}; use turbo_tasks_fs::FileContent; use turbopack_core::{ asset::{Asset, AssetContent}, @@ -10,16 +10,16 @@ use turbopack_core::{ }; #[turbo_tasks::value] pub struct StaticAsset { - chunking_context: Vc>, - source: Vc>, + chunking_context: ResolvedVc>, + source: ResolvedVc>, } #[turbo_tasks::value_impl] impl StaticAsset { #[turbo_tasks::function] pub fn new( - chunking_context: Vc>, - source: Vc>, + chunking_context: ResolvedVc>, + source: ResolvedVc>, ) -> Vc { Self::cell(StaticAsset { chunking_context, From 7d8bf383cf058503170029d4b78d613b22c21aba Mon Sep 17 00:00:00 2001 From: Janka Uryga Date: Wed, 27 Nov 2024 14:01:57 +0100 Subject: [PATCH 58/82] feat(after): unflag unstable_after internals (#73190) this PR changes `after`-related code to unconditionally set everything up even if `experimental.after` is disabled, because we want to be able to re-use some of the `after` machinery for instrumentation-related things. --- packages/next/src/build/utils.ts | 8 ++++ .../loaders/next-edge-ssr-loader/render.ts | 6 +-- .../src/server/after/after-context.test.ts | 39 +++++-------------- .../next/src/server/after/after-context.ts | 19 +++++---- packages/next/src/server/after/after.ts | 2 +- .../app-render/work-async-storage.external.ts | 2 +- .../src/server/async-storage/work-store.ts | 18 +++++---- .../next/src/server/base-http/web.test.ts | 8 +--- packages/next/src/server/base-http/web.ts | 17 +++----- packages/next/src/server/base-server.ts | 2 +- packages/next/src/server/web/adapter.ts | 19 +++------ .../server/web/edge-route-module-wrapper.ts | 15 ++----- 12 files changed, 58 insertions(+), 97 deletions(-) diff --git a/packages/next/src/build/utils.ts b/packages/next/src/build/utils.ts index 09e1d12923fa0..126a3b61095d5 100644 --- a/packages/next/src/build/utils.ts +++ b/packages/next/src/build/utils.ts @@ -100,6 +100,7 @@ import type { AppSegmentConfig } from './segment-config/app/app-segment-config' import type { AppSegment } from './segment-config/app/app-segments' import { collectSegments } from './segment-config/app/app-segments' import { createIncrementalCache } from '../export/helpers/create-incremental-cache' +import { InvariantError } from '../shared/lib/invariant-error' export type ROUTER_TYPE = 'pages' | 'app' @@ -1316,6 +1317,13 @@ export async function buildAppStaticPaths({ dynamicIO, authInterrupts, }, + waitUntil: undefined, + onClose: () => { + throw new InvariantError( + 'unexpected onClose call in buildAppStaticPaths' + ) + }, + onAfterTaskError: undefined, buildId, }, }) diff --git a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts index 09b278954fe30..5d60f000f2148 100644 --- a/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts +++ b/packages/next/src/build/webpack/loaders/next-edge-ssr-loader/render.ts @@ -154,11 +154,7 @@ export function getRender({ event?: NextFetchEvent ) { const extendedReq = new WebNextRequest(request) - const extendedRes = new WebNextResponse( - undefined, - // tracking onClose adds overhead, so only do it if `experimental.after` is on. - !!process.env.__NEXT_AFTER - ) + const extendedRes = new WebNextResponse(undefined) handler(extendedReq, extendedRes) const result = await extendedRes.toResponse() diff --git a/packages/next/src/server/after/after-context.test.ts b/packages/next/src/server/after/after-context.test.ts index 8378075072d72..993cfa5511871 100644 --- a/packages/next/src/server/after/after-context.test.ts +++ b/packages/next/src/server/after/after-context.test.ts @@ -53,6 +53,7 @@ describe('AfterContext', () => { }) const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, @@ -120,6 +121,7 @@ describe('AfterContext', () => { }) const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, @@ -168,6 +170,7 @@ describe('AfterContext', () => { }) const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, @@ -259,6 +262,7 @@ describe('AfterContext', () => { }) const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, @@ -319,6 +323,7 @@ describe('AfterContext', () => { }) const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, @@ -359,6 +364,7 @@ describe('AfterContext', () => { const onTaskError = jest.fn() const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError, @@ -422,6 +428,7 @@ describe('AfterContext', () => { const onClose = jest.fn() const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, @@ -445,36 +452,6 @@ describe('AfterContext', () => { expect(afterCallback1).not.toHaveBeenCalled() }) - it('throws from after() if onClose is not provided', async () => { - const waitUntilPromises: Promise[] = [] - const waitUntil = jest.fn((promise) => waitUntilPromises.push(promise)) - - const onClose = undefined - - const afterContext = new AfterContext({ - waitUntil, - onClose, - onTaskError: undefined, - }) - - const workStore = createMockWorkStore(afterContext) - - const run = createRun(afterContext, workStore) - - // ================================== - - const afterCallback1 = jest.fn() - - expect(() => - run(() => { - after(afterCallback1) - }) - ).toThrow(/Missing `onClose` implementation/) - - expect(waitUntil).not.toHaveBeenCalled() - expect(afterCallback1).not.toHaveBeenCalled() - }) - it('does NOT shadow workAsyncStorage within after callbacks', async () => { const waitUntil = jest.fn() @@ -484,6 +461,7 @@ describe('AfterContext', () => { }) const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, @@ -529,6 +507,7 @@ describe('AfterContext', () => { }) const afterContext = new AfterContext({ + isEnabled: true, waitUntil, onClose, onTaskError: undefined, diff --git a/packages/next/src/server/after/after-context.ts b/packages/next/src/server/after/after-context.ts index 43c277c9d639a..e464daf37c75e 100644 --- a/packages/next/src/server/after/after-context.ts +++ b/packages/next/src/server/after/after-context.ts @@ -12,24 +12,32 @@ import { } from '../app-render/work-unit-async-storage.external' export type AfterContextOpts = { + isEnabled: boolean waitUntil: RequestLifecycleOpts['waitUntil'] | undefined - onClose: RequestLifecycleOpts['onClose'] | undefined + onClose: RequestLifecycleOpts['onClose'] onTaskError: RequestLifecycleOpts['onAfterTaskError'] | undefined } export class AfterContext { private waitUntil: RequestLifecycleOpts['waitUntil'] | undefined - private onClose: RequestLifecycleOpts['onClose'] | undefined + private onClose: RequestLifecycleOpts['onClose'] private onTaskError: RequestLifecycleOpts['onAfterTaskError'] | undefined + public readonly isEnabled: boolean private runCallbacksOnClosePromise: Promise | undefined private callbackQueue: PromiseQueue private workUnitStores = new Set() - constructor({ waitUntil, onClose, onTaskError }: AfterContextOpts) { + constructor({ + waitUntil, + onClose, + onTaskError, + isEnabled, + }: AfterContextOpts) { this.waitUntil = waitUntil this.onClose = onClose this.onTaskError = onTaskError + this.isEnabled = isEnabled this.callbackQueue = new PromiseQueue() this.callbackQueue.pause() @@ -56,11 +64,6 @@ export class AfterContext { if (!this.waitUntil) { errorWaitUntilNotAvailable() } - if (!this.onClose) { - throw new InvariantError( - 'unstable_after: Missing `onClose` implementation' - ) - } const workUnitStore = workUnitAsyncStorage.getStore() if (!workUnitStore) { diff --git a/packages/next/src/server/after/after.ts b/packages/next/src/server/after/after.ts index 76bccd4958d80..ece552e79c7d9 100644 --- a/packages/next/src/server/after/after.ts +++ b/packages/next/src/server/after/after.ts @@ -17,7 +17,7 @@ export function unstable_after(task: AfterTask): void { } const { afterContext } = workStore - if (!afterContext) { + if (!afterContext.isEnabled) { throw new Error( '`unstable_after` must be explicitly enabled by setting `experimental.after: true` in your next.config.js.' ) diff --git a/packages/next/src/server/app-render/work-async-storage.external.ts b/packages/next/src/server/app-render/work-async-storage.external.ts index 17efa63b0c184..322ff6eac0595 100644 --- a/packages/next/src/server/app-render/work-async-storage.external.ts +++ b/packages/next/src/server/app-render/work-async-storage.external.ts @@ -45,7 +45,7 @@ export interface WorkStore { dynamicShouldError?: boolean pendingRevalidates?: Record> pendingRevalidateWrites?: Array> // This is like pendingRevalidates but isn't used for deduping. - readonly afterContext: AfterContext | undefined + readonly afterContext: AfterContext dynamicUsageDescription?: string dynamicUsageStack?: string diff --git a/packages/next/src/server/async-storage/work-store.ts b/packages/next/src/server/async-storage/work-store.ts index 770ab976c8c69..c133a515ca44d 100644 --- a/packages/next/src/server/async-storage/work-store.ts +++ b/packages/next/src/server/async-storage/work-store.ts @@ -62,7 +62,7 @@ export type WorkStoreContext = { | 'isDebugDynamicAccesses' | 'buildId' > & - Partial & + RequestLifecycleOpts & Partial> } @@ -128,14 +128,16 @@ export function createWorkStore({ } function createAfterContext( - renderOpts: Partial & { + renderOpts: RequestLifecycleOpts & { experimental: Pick } -): AfterContext | undefined { - const isAfterEnabled = renderOpts?.experimental?.after ?? false - if (!isAfterEnabled) { - return undefined - } +): AfterContext { + const isEnabled = renderOpts?.experimental?.after ?? false const { waitUntil, onClose, onAfterTaskError } = renderOpts - return new AfterContext({ waitUntil, onClose, onTaskError: onAfterTaskError }) + return new AfterContext({ + waitUntil, + isEnabled, + onClose, + onTaskError: onAfterTaskError, + }) } diff --git a/packages/next/src/server/base-http/web.test.ts b/packages/next/src/server/base-http/web.test.ts index d5f00ea8f454e..a5b2241c217eb 100644 --- a/packages/next/src/server/base-http/web.test.ts +++ b/packages/next/src/server/base-http/web.test.ts @@ -1,10 +1,6 @@ import { WebNextResponse } from './web' describe('WebNextResponse onClose', () => { - it("doesn't track onClose unless enabled", () => { - const webNextResponse = new WebNextResponse(undefined, false).body('abcdef') - expect(() => webNextResponse.onClose(() => {})).toThrow() - }) it('stream body', async () => { const cb = jest.fn() const ts = new TransformStream({ @@ -13,7 +9,7 @@ describe('WebNextResponse onClose', () => { }, }) - const webNextResponse = new WebNextResponse(ts, true) + const webNextResponse = new WebNextResponse(ts) webNextResponse.onClose(cb) webNextResponse.send() expect(cb).toHaveBeenCalledTimes(0) @@ -34,7 +30,7 @@ describe('WebNextResponse onClose', () => { it('string body', async () => { const cb = jest.fn() - const webNextResponse = new WebNextResponse(undefined, true).body('abcdef') + const webNextResponse = new WebNextResponse(undefined).body('abcdef') webNextResponse.onClose(cb) webNextResponse.send() expect(cb).toHaveBeenCalledTimes(0) diff --git a/packages/next/src/server/base-http/web.ts b/packages/next/src/server/base-http/web.ts index cec89999bfa0a..b65a447535bbb 100644 --- a/packages/next/src/server/base-http/web.ts +++ b/packages/next/src/server/base-http/web.ts @@ -44,10 +44,7 @@ export class WebNextResponse extends BaseNextResponse { public statusCode: number | undefined public statusMessage: string | undefined - constructor( - public transformStream = new TransformStream(), - private trackOnClose = false - ) { + constructor(public transformStream = new TransformStream()) { super(transformStream.writable) } @@ -113,10 +110,11 @@ export class WebNextResponse extends BaseNextResponse { let bodyInit: BodyInit = body + // if the response is streaming, onClose() can still be called after this point. const canAddListenersLater = typeof bodyInit !== 'string' - const shouldTrackBody = - this.trackOnClose && - (canAddListenersLater ? true : this.closeController.listeners > 0) + const shouldTrackBody = canAddListenersLater + ? true + : this.closeController.listeners > 0 if (shouldTrackBody) { bodyInit = trackBodyConsumed(body, () => { @@ -132,11 +130,6 @@ export class WebNextResponse extends BaseNextResponse { } public onClose(callback: () => void) { - if (!this.trackOnClose) { - throw new InvariantError( - 'Cannot call onClose on a WebNextResponse initialized with `trackOnClose = false`' - ) - } if (this.closeController.isClosed) { throw new InvariantError( 'Cannot call onClose on a WebNextResponse that is already closed' diff --git a/packages/next/src/server/base-server.ts b/packages/next/src/server/base-server.ts index 932ef6192022d..cef90e89cb07c 100644 --- a/packages/next/src/server/base-server.ts +++ b/packages/next/src/server/base-server.ts @@ -265,7 +265,7 @@ export type LoadedRenderOpts = RenderOpts & export type RequestLifecycleOpts = { waitUntil: ((promise: Promise) => void) | undefined - onClose: ((callback: () => void) => void) | undefined + onClose: (callback: () => void) => void onAfterTaskError: ((error: unknown) => void) | undefined } diff --git a/packages/next/src/server/web/adapter.ts b/packages/next/src/server/web/adapter.ts index 1916462c58528..045ae4354ed02 100644 --- a/packages/next/src/server/web/adapter.ts +++ b/packages/next/src/server/web/adapter.ts @@ -16,10 +16,7 @@ import { FLIGHT_HEADERS } from '../../client/components/app-router-headers' import { ensureInstrumentationRegistered } from './globals' import { createRequestStoreForAPI } from '../async-storage/request-store' import { workUnitAsyncStorage } from '../app-render/work-unit-async-storage.external' -import { - createWorkStore, - type WorkStoreContext, -} from '../async-storage/work-store' +import { createWorkStore } from '../async-storage/work-store' import { workAsyncStorage } from '../app-render/work-async-storage.external' import { NEXT_ROUTER_PREFETCH_HEADER } from '../../client/components/app-router-headers' import { getTracer } from '../lib/trace/tracer' @@ -229,13 +226,8 @@ export async function adapter( params.request.nextConfig?.experimental?.after ?? !!process.env.__NEXT_AFTER - let waitUntil: WorkStoreContext['renderOpts']['waitUntil'] = undefined - let closeController: CloseController | undefined = undefined - - if (isAfterEnabled) { - waitUntil = event.waitUntil.bind(event) - closeController = new CloseController() - } + const waitUntil = event.waitUntil.bind(event) + const closeController = new CloseController() return getTracer().trace( MiddlewareSpan.execute, @@ -277,9 +269,8 @@ export async function adapter( buildId: buildId ?? '', supportsDynamicResponse: true, waitUntil, - onClose: closeController - ? closeController.onClose.bind(closeController) - : undefined, + onClose: closeController.onClose.bind(closeController), + onAfterTaskError: undefined, }, requestEndedState: { ended: false }, isPrefetchRequest: request.headers.has( diff --git a/packages/next/src/server/web/edge-route-module-wrapper.ts b/packages/next/src/server/web/edge-route-module-wrapper.ts index 081f9e21e2873..d5c16926d7e6f 100644 --- a/packages/next/src/server/web/edge-route-module-wrapper.ts +++ b/packages/next/src/server/web/edge-route-module-wrapper.ts @@ -13,7 +13,6 @@ import type { NextFetchEvent } from './spec-extension/fetch-event' import { internal_getCurrentFunctionWaitUntil } from './internal-edge-wait-until' import { getUtils } from '../server-utils' import { searchParamsToUrlQuery } from '../../shared/lib/router/utils/querystring' -import type { RequestLifecycleOpts } from '../base-server' import { CloseController, trackStreamConsumed } from './web-on-close' import { getEdgePreviewProps } from './get-edge-preview-props' import type { NextConfigComplete } from '../config-shared' @@ -88,13 +87,8 @@ export class EdgeRouteModuleWrapper { const isAfterEnabled = !!process.env.__NEXT_AFTER - let waitUntil: RequestLifecycleOpts['waitUntil'] = undefined - let closeController: CloseController | undefined - - if (isAfterEnabled) { - waitUntil = evt.waitUntil.bind(evt) - closeController = new CloseController() - } + const waitUntil = evt.waitUntil.bind(evt) + const closeController = new CloseController() const previewProps = getEdgePreviewProps() @@ -112,9 +106,8 @@ export class EdgeRouteModuleWrapper { renderOpts: { supportsDynamicResponse: true, waitUntil, - onClose: closeController - ? closeController.onClose.bind(closeController) - : undefined, + onClose: closeController.onClose.bind(closeController), + onAfterTaskError: undefined, experimental: { after: isAfterEnabled, dynamicIO: !!process.env.__NEXT_DYNAMIC_IO, From e81d4da9ec9486a8b46d36ec80bf8ddea1958305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 27 Nov 2024 22:42:27 +0900 Subject: [PATCH 59/82] perf(turbopack): Use `ResolvedVc` for `next-api`, part 1 (#73234) ### What? Use `ResolvedVc` instead of `Vc` for struct fields in `next-api`, but split into multiple PRs. ### Why? To reduce scope of changes of each PRs so I can debug HMR failures. ### How? --- crates/next-api/src/app.rs | 34 +++++++++++++++----------- crates/next-api/src/instrumentation.rs | 22 ++++++++--------- crates/next-api/src/middleware.rs | 22 ++++++++--------- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/crates/next-api/src/app.rs b/crates/next-api/src/app.rs index cf3f5c0aa4a00..5cf4e741b377b 100644 --- a/crates/next-api/src/app.rs +++ b/crates/next-api/src/app.rs @@ -665,7 +665,7 @@ impl AppProject { #[turbo_tasks::function] pub fn app_entry_point_to_route( - app_project: Vc, + app_project: ResolvedVc, entrypoint: AppEntrypoint, ) -> Vc { match entrypoint { @@ -769,7 +769,7 @@ enum AppEndpointType { #[turbo_tasks::value] struct AppEndpoint { ty: AppEndpointType, - app_project: Vc, + app_project: ResolvedVc, page: AppPage, } @@ -1168,7 +1168,9 @@ impl AppEndpoint { let app_entry_chunks_ref = app_entry_chunks.await?; server_assets.extend(app_entry_chunks_ref.iter().copied()); - let client_assets = OutputAssets::new(client_assets.iter().map(|asset| **asset).collect()); + let client_assets = OutputAssets::new(client_assets.iter().map(|asset| **asset).collect()) + .to_resolved() + .await?; // these references are important for turbotrace let mut client_reference_manifest = None; @@ -1207,7 +1209,7 @@ impl AppEndpoint { &app_entry.original_name, &app_entry.original_name, &app_entry.original_name, - client_assets, + *client_assets, true, ) .await?; @@ -1335,8 +1337,10 @@ impl AppEndpoint { } AppEndpointOutput::Edge { - files: *app_entry_chunks, - server_assets: Vc::cell(server_assets.iter().cloned().collect::>()), + files: app_entry_chunks.to_resolved().await?, + server_assets: ResolvedVc::cell( + server_assets.iter().cloned().collect::>(), + ), client_assets, } } @@ -1411,7 +1415,9 @@ impl AppEndpoint { AppEndpointOutput::NodeJs { rsc_chunk, - server_assets: Vc::cell(server_assets.iter().cloned().collect::>()), + server_assets: ResolvedVc::cell( + server_assets.iter().cloned().collect::>(), + ), client_assets, } } @@ -1708,13 +1714,13 @@ impl Endpoint for AppEndpoint { enum AppEndpointOutput { NodeJs { rsc_chunk: ResolvedVc>, - server_assets: Vc, - client_assets: Vc, + server_assets: ResolvedVc, + client_assets: ResolvedVc, }, Edge { - files: Vc, - server_assets: Vc, - client_assets: Vc, + files: ResolvedVc, + server_assets: ResolvedVc, + client_assets: ResolvedVc, }, } @@ -1737,7 +1743,7 @@ impl AppEndpointOutput { pub fn server_assets(&self) -> Vc { match *self { AppEndpointOutput::NodeJs { server_assets, .. } - | AppEndpointOutput::Edge { server_assets, .. } => server_assets, + | AppEndpointOutput::Edge { server_assets, .. } => *server_assets, } } @@ -1745,7 +1751,7 @@ impl AppEndpointOutput { pub fn client_assets(&self) -> Vc { match *self { AppEndpointOutput::NodeJs { client_assets, .. } - | AppEndpointOutput::Edge { client_assets, .. } => client_assets, + | AppEndpointOutput::Edge { client_assets, .. } => *client_assets, } } } diff --git a/crates/next-api/src/instrumentation.rs b/crates/next-api/src/instrumentation.rs index ef76071d2ea76..93f518c31d299 100644 --- a/crates/next-api/src/instrumentation.rs +++ b/crates/next-api/src/instrumentation.rs @@ -35,9 +35,9 @@ use crate::{ #[turbo_tasks::value] pub struct InstrumentationEndpoint { - project: Vc, - asset_context: Vc>, - source: Vc>, + project: ResolvedVc, + asset_context: ResolvedVc>, + source: ResolvedVc>, is_edge: bool, app_dir: Option>, @@ -48,9 +48,9 @@ pub struct InstrumentationEndpoint { impl InstrumentationEndpoint { #[turbo_tasks::function] pub fn new( - project: Vc, - asset_context: Vc>, - source: Vc>, + project: ResolvedVc, + asset_context: ResolvedVc>, + source: ResolvedVc>, is_edge: bool, app_dir: Option>, ecmascript_client_reference_transition_name: Option>, @@ -71,7 +71,7 @@ impl InstrumentationEndpoint { let userland_module = self .asset_context .process( - self.source, + *self.source, Value::new(ReferenceType::Entry(EntryReferenceSubType::Instrumentation)), ) .module() @@ -79,7 +79,7 @@ impl InstrumentationEndpoint { .await?; let edge_entry_module = wrap_edge_entry( - self.asset_context, + *self.asset_context, self.project.project_path(), *userland_module, "instrumentation".into(), @@ -117,7 +117,7 @@ impl InstrumentationEndpoint { }), this.project.next_mode(), ) - .resolve_entries(this.asset_context) + .resolve_entries(*this.asset_context) .await? .clone_value(); @@ -169,7 +169,7 @@ impl InstrumentationEndpoint { }), this.project.next_mode(), ) - .resolve_entries(this.asset_context), + .resolve_entries(*this.asset_context), OutputAssets::empty(), Value::new(AvailabilityInfo::Root), ) @@ -225,7 +225,7 @@ impl InstrumentationEndpoint { let mut output_assets = vec![chunk]; if this.project.next_mode().await?.is_production() { output_assets.push(ResolvedVc::upcast( - NftJsonAsset::new(this.project, *chunk, vec![]) + NftJsonAsset::new(*this.project, *chunk, vec![]) .to_resolved() .await?, )); diff --git a/crates/next-api/src/middleware.rs b/crates/next-api/src/middleware.rs index 2d700046c94bd..dba4813259836 100644 --- a/crates/next-api/src/middleware.rs +++ b/crates/next-api/src/middleware.rs @@ -36,9 +36,9 @@ use crate::{ #[turbo_tasks::value] pub struct MiddlewareEndpoint { - project: Vc, - asset_context: Vc>, - source: Vc>, + project: ResolvedVc, + asset_context: ResolvedVc>, + source: ResolvedVc>, app_dir: Option>, ecmascript_client_reference_transition_name: Option>, } @@ -47,9 +47,9 @@ pub struct MiddlewareEndpoint { impl MiddlewareEndpoint { #[turbo_tasks::function] pub fn new( - project: Vc, - asset_context: Vc>, - source: Vc>, + project: ResolvedVc, + asset_context: ResolvedVc>, + source: ResolvedVc>, app_dir: Option>, ecmascript_client_reference_transition_name: Option>, ) -> Vc { @@ -68,19 +68,19 @@ impl MiddlewareEndpoint { let userland_module = self .asset_context .process( - self.source, + *self.source, Value::new(ReferenceType::Entry(EntryReferenceSubType::Middleware)), ) .module(); let module = get_middleware_module( - self.asset_context, + *self.asset_context, self.project.project_path(), userland_module, ); let module = wrap_edge_entry( - self.asset_context, + *self.asset_context, self.project.project_path(), module, "middleware".into(), @@ -96,7 +96,7 @@ impl MiddlewareEndpoint { }), self.project.next_mode(), ) - .resolve_entries(self.asset_context) + .resolve_entries(*self.asset_context) .await? .clone_value(); @@ -261,7 +261,7 @@ impl MiddlewareEndpoint { fn userland_module(&self) -> Vc> { self.asset_context .process( - self.source, + *self.source, Value::new(ReferenceType::Entry(EntryReferenceSubType::Middleware)), ) .module() From 7af6e07586d7c8cb7962682507aded219ec6bca6 Mon Sep 17 00:00:00 2001 From: Janka Uryga Date: Wed, 27 Nov 2024 14:54:49 +0100 Subject: [PATCH 60/82] feat(after): allow using unstable_after in generateStaticParams (#73217) Allows using `unstable_after` in `generateStaticParams`. definitely niche, but since we're now allowing `after` to be used during build, i see no reason not to. Also fixes an issue where we didn't pass `experimental.after` into the context used for `generateStaticParams`, so if `after` was called, it'd always say that you have to enable `experimental.after` even if you already did. --- packages/next/src/build/index.ts | 3 + packages/next/src/build/utils.ts | 23 ++++--- .../next/src/server/after/after-context.ts | 7 +- .../next/src/server/dev/next-dev-server.ts | 1 + .../src/server/dev/static-paths-worker.ts | 2 + .../app/callback/[myParam]/page.tsx | 18 +++++ .../app/layout.tsx | 10 +++ .../index.test.ts | 41 ++++++++++++ .../next.config.js | 6 ++ .../generate-static-params-error/utils/log.js | 16 +++++ .../generate-static-params/app/layout.tsx | 10 +++ .../app/one/[myParam]/page.tsx | 15 +++++ .../app/two/[myParam]/page.tsx | 15 +++++ .../generate-static-params/index.test.ts | 67 +++++++++++++++++++ .../generate-static-params/next.config.js | 6 ++ .../generate-static-params/utils/log.js | 16 +++++ 16 files changed, 242 insertions(+), 14 deletions(-) create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/callback/[myParam]/page.tsx create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/layout.tsx create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params-error/index.test.ts create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params-error/next.config.js create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params-error/utils/log.js create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params/app/layout.tsx create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params/app/one/[myParam]/page.tsx create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params/app/two/[myParam]/page.tsx create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params/index.test.ts create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params/next.config.js create mode 100644 test/e2e/app-dir/next-after-app-static/generate-static-params/utils/log.js diff --git a/packages/next/src/build/index.ts b/packages/next/src/build/index.ts index 2533f50a21efe..c5446fdd5b7c5 100644 --- a/packages/next/src/build/index.ts +++ b/packages/next/src/build/index.ts @@ -1270,6 +1270,7 @@ export default async function build( ) const isAppDynamicIOEnabled = Boolean(config.experimental.dynamicIO) + const isAfterEnabled = Boolean(config.experimental.after) const isAuthInterruptsEnabled = Boolean( config.experimental.authInterrupts ) @@ -2002,6 +2003,7 @@ export default async function build( configFileName, runtimeEnvConfig, dynamicIO: isAppDynamicIOEnabled, + after: isAfterEnabled, authInterrupts: isAuthInterruptsEnabled, httpAgentOptions: config.httpAgentOptions, locales: config.i18n?.locales, @@ -2226,6 +2228,7 @@ export default async function build( edgeInfo, pageType, dynamicIO: isAppDynamicIOEnabled, + after: isAfterEnabled, authInterrupts: isAuthInterruptsEnabled, cacheHandler: config.cacheHandler, cacheHandlers: config.experimental.cacheHandlers, diff --git a/packages/next/src/build/utils.ts b/packages/next/src/build/utils.ts index 126a3b61095d5..6d1640196c849 100644 --- a/packages/next/src/build/utils.ts +++ b/packages/next/src/build/utils.ts @@ -100,7 +100,7 @@ import type { AppSegmentConfig } from './segment-config/app/app-segment-config' import type { AppSegment } from './segment-config/app/app-segments' import { collectSegments } from './segment-config/app/app-segments' import { createIncrementalCache } from '../export/helpers/create-incremental-cache' -import { InvariantError } from '../shared/lib/invariant-error' +import { AfterRunner } from '../server/after/run-with-after' export type ROUTER_TYPE = 'pages' | 'app' @@ -1215,6 +1215,7 @@ export async function buildAppStaticPaths({ page, distDir, dynamicIO, + after, authInterrupts, configFileName, segments, @@ -1232,6 +1233,7 @@ export async function buildAppStaticPaths({ dir: string page: string dynamicIO: boolean + after: boolean authInterrupts: boolean configFileName: string segments: AppSegment[] @@ -1302,6 +1304,8 @@ export async function buildAppStaticPaths({ } } + const afterRunner = new AfterRunner() + const store = createWorkStore({ page, // We're discovering the parameters here, so we don't have any unknown @@ -1313,17 +1317,13 @@ export async function buildAppStaticPaths({ supportsDynamicResponse: true, isRevalidate: false, experimental: { - after: false, + after, dynamicIO, authInterrupts, }, - waitUntil: undefined, - onClose: () => { - throw new InvariantError( - 'unexpected onClose call in buildAppStaticPaths' - ) - }, - onAfterTaskError: undefined, + waitUntil: afterRunner.context.waitUntil, + onClose: afterRunner.context.onClose, + onAfterTaskError: afterRunner.context.onTaskError, buildId, }, }) @@ -1466,6 +1466,8 @@ export async function buildAppStaticPaths({ }) } + await afterRunner.executeAfter() + return result } @@ -1498,6 +1500,7 @@ export async function isPageStatic({ edgeInfo, pageType, dynamicIO, + after, authInterrupts, originalAppPath, isrFlushToDisk, @@ -1513,6 +1516,7 @@ export async function isPageStatic({ page: string distDir: string dynamicIO: boolean + after: boolean authInterrupts: boolean configFileName: string runtimeEnvConfig: any @@ -1655,6 +1659,7 @@ export async function isPageStatic({ dir, page, dynamicIO, + after, authInterrupts, configFileName, segments, diff --git a/packages/next/src/server/after/after-context.ts b/packages/next/src/server/after/after-context.ts index e464daf37c75e..45b9932d12600 100644 --- a/packages/next/src/server/after/after-context.ts +++ b/packages/next/src/server/after/after-context.ts @@ -66,12 +66,9 @@ export class AfterContext { } const workUnitStore = workUnitAsyncStorage.getStore() - if (!workUnitStore) { - throw new InvariantError( - 'Missing workUnitStore in AfterContext.addCallback' - ) + if (workUnitStore) { + this.workUnitStores.add(workUnitStore) } - this.workUnitStores.add(workUnitStore) // this should only happen once. if (!this.runCallbacksOnClosePromise) { diff --git a/packages/next/src/server/dev/next-dev-server.ts b/packages/next/src/server/dev/next-dev-server.ts index 2aea937b5ce27..b610878dc905f 100644 --- a/packages/next/src/server/dev/next-dev-server.ts +++ b/packages/next/src/server/dev/next-dev-server.ts @@ -765,6 +765,7 @@ export default class DevServer extends Server { publicRuntimeConfig, serverRuntimeConfig, dynamicIO: Boolean(this.nextConfig.experimental.dynamicIO), + after: Boolean(this.nextConfig.experimental.after), }, httpAgentOptions, locales, diff --git a/packages/next/src/server/dev/static-paths-worker.ts b/packages/next/src/server/dev/static-paths-worker.ts index 28ac0fa167ad7..ff97ea98d1bf5 100644 --- a/packages/next/src/server/dev/static-paths-worker.ts +++ b/packages/next/src/server/dev/static-paths-worker.ts @@ -26,6 +26,7 @@ type RuntimeConfig = { publicRuntimeConfig: { [key: string]: any } serverRuntimeConfig: { [key: string]: any } dynamicIO: boolean + after: boolean } // we call getStaticPaths in a separate process to ensure @@ -96,6 +97,7 @@ export async function loadStaticPaths({ dir, page: pathname, dynamicIO: config.dynamicIO, + after: config.after, segments, configFileName: config.configFileName, distDir, diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/callback/[myParam]/page.tsx b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/callback/[myParam]/page.tsx new file mode 100644 index 0000000000000..bb97d5d3e9e78 --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/callback/[myParam]/page.tsx @@ -0,0 +1,18 @@ +import * as React from 'react' +import { unstable_after as after } from 'next/server' +import { setTimeout } from 'timers/promises' + +export function generateStaticParams() { + after(async () => { + await setTimeout(500) + throw new Error( + `My cool error thrown inside unstable_after on route "/callback/[myParam]"` + ) + }) + return [{ myParam: 'a' }, { myParam: 'b' }, { myParam: 'c' }] +} + +export default async function Page(props) { + const params = await props.params + return
Param: {params.myParam}
+} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/layout.tsx b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/layout.tsx new file mode 100644 index 0000000000000..fe18a75a94f1f --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/app/layout.tsx @@ -0,0 +1,10 @@ +import * as React from 'react' + +export default function AppLayout({ children }) { + return ( + + + {children} + + ) +} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params-error/index.test.ts b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/index.test.ts new file mode 100644 index 0000000000000..fef74d7fd279c --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/index.test.ts @@ -0,0 +1,41 @@ +/* eslint-env jest */ +import { nextTestSetup } from 'e2e-utils' +import { + assertHasRedbox, + getRedboxDescription, +} from '../../../../lib/next-test-utils' + +describe('unstable_after() in generateStaticParams - thrown errors', () => { + const { next, skipped, isNextDev } = nextTestSetup({ + files: __dirname, + skipStart: true, + skipDeployment: true, // can't access build errors in deploy tests + }) + + if (skipped) return + + if (isNextDev) { + it('shows the error overlay if an error is thrown inside unstable_after', async () => { + await next.start() + const browser = await next.browser('/callback/1') + await assertHasRedbox(browser) + const route = '/callback/[myParam]' + expect(await getRedboxDescription(browser)).toContain( + `My cool error thrown inside unstable_after on route "${route}"` + ) + }) + } else { + it('fails the build if an error is thrown inside unstable_after', async () => { + const buildResult = await next.build() + expect(buildResult?.exitCode).toBe(1) + + const route = '/callback/[myParam]' + expect(next.cliOutput).toContain( + `Failed to collect page data for ${route}` + ) + expect(next.cliOutput).toContain( + `My cool error thrown inside unstable_after on route "${route}"` + ) + }) + } +}) diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params-error/next.config.js b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/next.config.js new file mode 100644 index 0000000000000..ec0f3bcc9dad4 --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/next.config.js @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +module.exports = { + experimental: { + after: true, + }, +} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params-error/utils/log.js b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/utils/log.js new file mode 100644 index 0000000000000..7811c609528ca --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params-error/utils/log.js @@ -0,0 +1,16 @@ +export function cliLog(/** @type {string | Record} */ data) { + console.log('' + JSON.stringify(data) + '') +} + +export function readCliLogs(/** @type {string} */ output) { + return output + .split('\n') + .map((line) => { + const match = line.match(/^(?.+?)<\/test-log>$/) + if (!match) { + return null + } + return JSON.parse(match.groups.value) + }) + .filter(Boolean) +} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params/app/layout.tsx b/test/e2e/app-dir/next-after-app-static/generate-static-params/app/layout.tsx new file mode 100644 index 0000000000000..fe18a75a94f1f --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params/app/layout.tsx @@ -0,0 +1,10 @@ +import * as React from 'react' + +export default function AppLayout({ children }) { + return ( + + + {children} + + ) +} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params/app/one/[myParam]/page.tsx b/test/e2e/app-dir/next-after-app-static/generate-static-params/app/one/[myParam]/page.tsx new file mode 100644 index 0000000000000..1f317188c3b39 --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params/app/one/[myParam]/page.tsx @@ -0,0 +1,15 @@ +import * as React from 'react' +import { unstable_after as after } from 'next/server' +import { cliLog } from '../../../utils/log' + +export function generateStaticParams() { + after(() => { + cliLog({ source: '[generateStaticParams] /one/[myParam]' }) + }) + return [{ myParam: 'a' }, { myParam: 'b' }, { myParam: 'c' }] +} + +export default async function Page(props) { + const params = await props.params + return
Param: {params.myParam}
+} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params/app/two/[myParam]/page.tsx b/test/e2e/app-dir/next-after-app-static/generate-static-params/app/two/[myParam]/page.tsx new file mode 100644 index 0000000000000..be703dbdb0843 --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params/app/two/[myParam]/page.tsx @@ -0,0 +1,15 @@ +import * as React from 'react' +import { unstable_after as after } from 'next/server' +import { cliLog } from '../../../utils/log' + +export function generateStaticParams() { + after(() => { + cliLog({ source: '[generateStaticParams] /two/[myParam]' }) + }) + return [{ myParam: 'd' }, { myParam: 'e' }, { myParam: 'f' }] +} + +export default async function Page(props) { + const params = await props.params + return
Param: {params.myParam}
+} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params/index.test.ts b/test/e2e/app-dir/next-after-app-static/generate-static-params/index.test.ts new file mode 100644 index 0000000000000..4c514f8a29c9b --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params/index.test.ts @@ -0,0 +1,67 @@ +/* eslint-env jest */ +import { nextTestSetup } from 'e2e-utils' +import * as Log from './utils/log' +import { assertNoRedbox, retry } from '../../../../lib/next-test-utils' + +describe('unstable_after() in generateStaticParams', () => { + const { next, isNextDev, skipped } = nextTestSetup({ + files: __dirname, + skipDeployment: true, // reading CLI logs to observe after + skipStart: true, + }) + + if (skipped) return + + let currentCliOutputIndex = 0 + beforeEach(() => { + currentCliOutputIndex = next.cliOutput.length + }) + + const getLogs = () => { + if (next.cliOutput.length < currentCliOutputIndex) { + // cliOutput shrank since we started the test, so something (like a `sandbox`) reset the logs + currentCliOutputIndex = 0 + } + return next.cliOutput.slice(currentCliOutputIndex) + } + + if (isNextDev) { + it('runs unstable_after callbacks when visiting a page in dev', async () => { + await next.start() + const browser = await next.browser('/one/a') + + expect(await browser.elementByCss('body').text()).toBe('Param: a') + await assertNoRedbox(browser) + await retry(async () => { + expect(Log.readCliLogs(getLogs())).toContainEqual({ + source: '[generateStaticParams] /one/[myParam]', + }) + }) + + await browser.get(new URL('/two/d', next.url).href) + expect(await browser.elementByCss('body').text()).toBe('Param: d') + await assertNoRedbox(browser) + await retry(async () => { + expect(Log.readCliLogs(getLogs())).toContainEqual({ + source: '[generateStaticParams] /two/[myParam]', + }) + }) + }) + } else { + it('runs unstable_after callbacks for each page during build', async () => { + const buildResult = await next.build() + expect(buildResult?.exitCode).toBe(0) + + { + // after should run at build time + const logsFromAfter = Log.readCliLogs(getLogs()) + expect(logsFromAfter).toContainEqual({ + source: '[generateStaticParams] /one/[myParam]', + }) + expect(logsFromAfter).toContainEqual({ + source: '[generateStaticParams] /two/[myParam]', + }) + } + }) + } +}) diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params/next.config.js b/test/e2e/app-dir/next-after-app-static/generate-static-params/next.config.js new file mode 100644 index 0000000000000..ec0f3bcc9dad4 --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params/next.config.js @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +module.exports = { + experimental: { + after: true, + }, +} diff --git a/test/e2e/app-dir/next-after-app-static/generate-static-params/utils/log.js b/test/e2e/app-dir/next-after-app-static/generate-static-params/utils/log.js new file mode 100644 index 0000000000000..7811c609528ca --- /dev/null +++ b/test/e2e/app-dir/next-after-app-static/generate-static-params/utils/log.js @@ -0,0 +1,16 @@ +export function cliLog(/** @type {string | Record} */ data) { + console.log('' + JSON.stringify(data) + '') +} + +export function readCliLogs(/** @type {string} */ output) { + return output + .split('\n') + .map((line) => { + const match = line.match(/^(?.+?)<\/test-log>$/) + if (!match) { + return null + } + return JSON.parse(match.groups.value) + }) + .filter(Boolean) +} From 2c546bb556dbd90db7e96e52ad645826e35453f9 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:44:05 +0100 Subject: [PATCH 61/82] Pin undici in tests (#73263) undici 7 was released 30 minutes ago and broke the tests because Turbopack now has troubles with its `node:sqlite` import. You can see the test failure in https://github.com/vercel/next.js/pull/73261#issuecomment-2504054040 ``` Error: Cannot find module 'node:sqlite': Unsupported external type Url for commonjs reference at (.next/server/chunks/ssr/c1118_undici_e1ac85._.js:35:29147) at [project]/node_modules/.pnpm/undici@7.0.0/node_modules/undici/lib/cache/sqlite-cache-store.js [app-rsc] (ecmascript) (.next/server/chunks/ssr/c1118_undici_e1ac85._.js:35:29278) at instantiateModule (.next/server/chunks/ssr/[turbopack]_runtime.js:590:23) at getOrInstantiateModuleFromParent (.next/server/chunks/ssr/[turbopack]_runtime.js:645:12) at commonJsRequire (.next/server/chunks/ssr/[turbopack]_runtime.js:147:20) at [project]/node_modules/.pnpm/undici@7.0.0/node_modules/undici/index.js [app-rsc] (ecmascript) (.next/server/chunks/ssr/c1118_undici_e1ac85._.js:116:5860) at instantiateModule (.next/server/chunks/ssr/[turbopack]_runtime.js:590:23) at getOrInstantiateModuleFromParent (.next/server/chunks/ssr/[turbopack]_runtime.js:645:12) at esmImport (.next/server/chunks/ssr/[turbopack]_runtime.js:132:20) at [project]/app/undici/page.js [app-rsc] (ecmascript) (.next/server/chunks/ssr/[root of the server]__83c897._.js:1:5666) { ``` https://github.com/nodejs/undici/blob/1cfe0949053aac6267f11b919cee9315a27f1fd6/index.js#L52-L59 https://github.com/nodejs/undici/blob/1cfe0949053aac6267f11b919cee9315a27f1fd6/lib/cache/sqlite-cache-store.js#L3 --- test/e2e/app-dir/app-external/app-external.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/app-dir/app-external/app-external.test.ts b/test/e2e/app-dir/app-external/app-external.test.ts index 4959d506df187..1e960424717c6 100644 --- a/test/e2e/app-dir/app-external/app-external.test.ts +++ b/test/e2e/app-dir/app-external/app-external.test.ts @@ -24,8 +24,8 @@ describe('app dir - external dependency', () => { const { next, skipped } = nextTestSetup({ files: __dirname, dependencies: { - swr: 'latest', - undici: 'latest', + swr: '2.2.5', + undici: '6.21.0', }, packageJson: { scripts: { From 664d888f9e1787b6aede7735022dfe94427652fc Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 27 Nov 2024 17:00:00 +0100 Subject: [PATCH 62/82] Error on navigation API usage in pages router and middleware (#73100) --- .../next/src/build/templates/middleware.ts | 9 ++ packages/next/src/client/index.tsx | 12 +- .../server-navigation-error/app/layout.tsx | 8 + .../server-navigation-error/app/page.tsx | 3 + .../app/route/not-found/route.ts | 5 + .../app/route/redirect/route.ts | 5 + .../server-navigation-error/middleware.ts | 10 ++ .../server-navigation-error/next.config.js | 6 + .../pages/pages/not-found.tsx | 5 + .../pages/pages/redirect.tsx | 5 + .../server-navigation-error.test.ts | 151 ++++++++++++++++++ 11 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 test/development/app-dir/server-navigation-error/app/layout.tsx create mode 100644 test/development/app-dir/server-navigation-error/app/page.tsx create mode 100644 test/development/app-dir/server-navigation-error/app/route/not-found/route.ts create mode 100644 test/development/app-dir/server-navigation-error/app/route/redirect/route.ts create mode 100644 test/development/app-dir/server-navigation-error/middleware.ts create mode 100644 test/development/app-dir/server-navigation-error/next.config.js create mode 100644 test/development/app-dir/server-navigation-error/pages/pages/not-found.tsx create mode 100644 test/development/app-dir/server-navigation-error/pages/pages/redirect.tsx create mode 100644 test/development/app-dir/server-navigation-error/server-navigation-error.test.ts diff --git a/packages/next/src/build/templates/middleware.ts b/packages/next/src/build/templates/middleware.ts index 7d1098fea4f51..6127a3b7afbba 100644 --- a/packages/next/src/build/templates/middleware.ts +++ b/packages/next/src/build/templates/middleware.ts @@ -7,6 +7,7 @@ import { adapter } from '../../server/web/adapter' // Import the userland code. import * as _mod from 'VAR_USERLAND' import { edgeInstrumentationOnRequestError } from '../../server/web/globals' +import { isNextRouterError } from '../../client/components/is-next-router-error' const mod = { ..._mod } const handler = mod.middleware || mod.default @@ -26,6 +27,14 @@ function errorHandledHandler(fn: AdapterOptions['handler']) { try { return await fn(...args) } catch (err) { + // In development, error the navigation API usage in runtime, + // since it's not allowed to be used in middleware as it's outside of react component tree. + if (process.env.NODE_ENV !== 'production') { + if (isNextRouterError(err)) { + err.message = `Next.js navigation API is not allowed to be used in Middleware.` + throw err + } + } const req = args[0] const url = new URL(req.url) const resource = url.pathname + url.search diff --git a/packages/next/src/client/index.tsx b/packages/next/src/client/index.tsx index b6ad90c2faeaf..42ebd0da9bb09 100644 --- a/packages/next/src/client/index.tsx +++ b/packages/next/src/client/index.tsx @@ -48,6 +48,7 @@ import { import { onRecoverableError } from './react-client-callbacks/shared' import tracer from './tracing/tracer' import reportToSocket from './tracing/report-to-socket' +import { isNextRouterError } from './components/is-next-router-error' /// @@ -927,7 +928,16 @@ export async function hydrate(opts?: { beforeRender?: () => Promise }) { error.name = initialErr!.name error.stack = initialErr!.stack - throw getServerError(error, initialErr!.source!) + const errSource = initialErr.source! + + // In development, error the navigation API usage in runtime, + // since it's not allowed to be used in pages router as it doesn't contain error boundary like app router. + if (isNextRouterError(initialErr)) { + error.message = + 'Next.js navigation API is not allowed to be used in Pages Router.' + } + + throw getServerError(error, errSource) }) } // We replaced the server-side error with a client-side error, and should diff --git a/test/development/app-dir/server-navigation-error/app/layout.tsx b/test/development/app-dir/server-navigation-error/app/layout.tsx new file mode 100644 index 0000000000000..888614deda3ba --- /dev/null +++ b/test/development/app-dir/server-navigation-error/app/layout.tsx @@ -0,0 +1,8 @@ +import { ReactNode } from 'react' +export default function Root({ children }: { children: ReactNode }) { + return ( + + {children} + + ) +} diff --git a/test/development/app-dir/server-navigation-error/app/page.tsx b/test/development/app-dir/server-navigation-error/app/page.tsx new file mode 100644 index 0000000000000..ff7159d9149fe --- /dev/null +++ b/test/development/app-dir/server-navigation-error/app/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return

hello world

+} diff --git a/test/development/app-dir/server-navigation-error/app/route/not-found/route.ts b/test/development/app-dir/server-navigation-error/app/route/not-found/route.ts new file mode 100644 index 0000000000000..ef2cfdaf754be --- /dev/null +++ b/test/development/app-dir/server-navigation-error/app/route/not-found/route.ts @@ -0,0 +1,5 @@ +import { notFound } from 'next/navigation' + +export async function GET(req) { + notFound() +} diff --git a/test/development/app-dir/server-navigation-error/app/route/redirect/route.ts b/test/development/app-dir/server-navigation-error/app/route/redirect/route.ts new file mode 100644 index 0000000000000..8408f9c3cd5ad --- /dev/null +++ b/test/development/app-dir/server-navigation-error/app/route/redirect/route.ts @@ -0,0 +1,5 @@ +import { redirect } from 'next/navigation' + +export async function GET(req) { + redirect('/') +} diff --git a/test/development/app-dir/server-navigation-error/middleware.ts b/test/development/app-dir/server-navigation-error/middleware.ts new file mode 100644 index 0000000000000..e39c78cd137ac --- /dev/null +++ b/test/development/app-dir/server-navigation-error/middleware.ts @@ -0,0 +1,10 @@ +import { notFound, redirect } from 'next/navigation' +import { NextRequest } from 'next/server' + +export default function middleware(req: NextRequest) { + if (req.nextUrl.pathname === '/middleware/not-found') { + notFound() + } else if (req.nextUrl.pathname === '/middleware/redirect') { + redirect('/') + } +} diff --git a/test/development/app-dir/server-navigation-error/next.config.js b/test/development/app-dir/server-navigation-error/next.config.js new file mode 100644 index 0000000000000..807126e4cf0bf --- /dev/null +++ b/test/development/app-dir/server-navigation-error/next.config.js @@ -0,0 +1,6 @@ +/** + * @type {import('next').NextConfig} + */ +const nextConfig = {} + +module.exports = nextConfig diff --git a/test/development/app-dir/server-navigation-error/pages/pages/not-found.tsx b/test/development/app-dir/server-navigation-error/pages/pages/not-found.tsx new file mode 100644 index 0000000000000..97ea65b48340c --- /dev/null +++ b/test/development/app-dir/server-navigation-error/pages/pages/not-found.tsx @@ -0,0 +1,5 @@ +import { notFound } from 'next/navigation' + +export default function Page() { + notFound() +} diff --git a/test/development/app-dir/server-navigation-error/pages/pages/redirect.tsx b/test/development/app-dir/server-navigation-error/pages/pages/redirect.tsx new file mode 100644 index 0000000000000..27a26b52db00d --- /dev/null +++ b/test/development/app-dir/server-navigation-error/pages/pages/redirect.tsx @@ -0,0 +1,5 @@ +import { redirect } from 'next/navigation' + +export default function Page() { + redirect('/') +} diff --git a/test/development/app-dir/server-navigation-error/server-navigation-error.test.ts b/test/development/app-dir/server-navigation-error/server-navigation-error.test.ts new file mode 100644 index 0000000000000..a27c26e0d632b --- /dev/null +++ b/test/development/app-dir/server-navigation-error/server-navigation-error.test.ts @@ -0,0 +1,151 @@ +import { nextTestSetup } from 'e2e-utils' +import { + assertHasRedbox, + getRedboxDescription, + getRedboxSource, +} from 'next-test-utils' + +describe('server-navigation-error', () => { + const { next } = nextTestSetup({ + files: __dirname, + }) + + describe('pages router', () => { + it('should error on navigation API redirect', async () => { + const browser = await next.browser('/pages/redirect') + await assertHasRedbox(browser) + expect(await getRedboxDescription(browser)).toMatch( + `Next.js navigation API is not allowed to be used in Pages Router.` + ) + const source = await getRedboxSource(browser) + if (process.env.TURBOPACK) { + expect(source).toMatchInlineSnapshot(` + "pages/pages/redirect.tsx (4:10) @ Page + + 2 | + 3 | export default function Page() { + > 4 | redirect('/') + | ^ + 5 | } + 6 |" + `) + } else { + expect(source).toMatchInlineSnapshot(` + "pages/pages/redirect.tsx (4:12) @ Page + + 2 | + 3 | export default function Page() { + > 4 | redirect('/') + | ^ + 5 | } + 6 |" + `) + } + }) + + it('should error on navigation API notFound', async () => { + const browser = await next.browser('/pages/not-found') + await assertHasRedbox(browser) + expect(await getRedboxDescription(browser)).toMatch( + `Next.js navigation API is not allowed to be used in Pages Router.` + ) + const source = await getRedboxSource(browser) + if (process.env.TURBOPACK) { + expect(source).toMatchInlineSnapshot(` + "pages/pages/not-found.tsx (4:10) @ Page + + 2 | + 3 | export default function Page() { + > 4 | notFound() + | ^ + 5 | } + 6 |" + `) + } else { + expect(source).toMatchInlineSnapshot(` + "pages/pages/not-found.tsx (4:11) @ notFound + + 2 | + 3 | export default function Page() { + > 4 | notFound() + | ^ + 5 | } + 6 |" + `) + } + }) + }) + + describe('middleware', () => { + it('should error on navigation API redirect ', async () => { + const browser = await next.browser('/middleware/redirect') + // FIXME: the first request to middleware error load didn't show the redbox, need one more reload + await browser.refresh() + await assertHasRedbox(browser) + expect(await getRedboxDescription(browser)).toMatch( + `Next.js navigation API is not allowed to be used in Middleware.` + ) + const source = await getRedboxSource(browser) + if (process.env.TURBOPACK) { + expect(source).toMatchInlineSnapshot(` + "middleware.ts (8:12) @ middleware + + 6 | notFound() + 7 | } else if (req.nextUrl.pathname === '/middleware/redirect') { + > 8 | redirect('/') + | ^ + 9 | } + 10 | } + 11 |" + `) + } else { + expect(source).toMatchInlineSnapshot(` + "middleware.ts (8:14) @ middleware + + 6 | notFound() + 7 | } else if (req.nextUrl.pathname === '/middleware/redirect') { + > 8 | redirect('/') + | ^ + 9 | } + 10 | } + 11 |" + `) + } + }) + + it('should error on navigation API not-found', async () => { + const browser = await next.browser('/middleware/not-found') + await assertHasRedbox(browser) + expect(await getRedboxDescription(browser)).toMatch( + `Next.js navigation API is not allowed to be used in Middleware.` + ) + const source = await getRedboxSource(browser) + + if (process.env.TURBOPACK) { + expect(source).toMatchInlineSnapshot(` + "middleware.ts (6:12) @ middleware + + 4 | export default function middleware(req: NextRequest) { + 5 | if (req.nextUrl.pathname === '/middleware/not-found') { + > 6 | notFound() + | ^ + 7 | } else if (req.nextUrl.pathname === '/middleware/redirect') { + 8 | redirect('/') + 9 | }" + `) + } else { + expect(source).toMatchInlineSnapshot(` + "middleware.ts (6:13) @ notFound + + 4 | export default function middleware(req: NextRequest) { + 5 | if (req.nextUrl.pathname === '/middleware/not-found') { + > 6 | notFound() + | ^ + 7 | } else if (req.nextUrl.pathname === '/middleware/redirect') { + 8 | redirect('/') + 9 | }" + `) + } + }) + }) +}) From f911175eace5bb3e034ff65653b8ef6dd9f9f992 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:35:18 +0100 Subject: [PATCH 63/82] Turbopack: use try_join instead of future::try_join_all (#73261) These were the only 2 occurrences in the codebase. Might be a candidate for an ast-grep lint rule --- .../turbopack-core/src/chunk/chunk_group.rs | 22 ++++++++++--------- .../turbopack-node/src/transforms/webpack.rs | 14 +++++------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs index 440740027f20e..1ee2f5bfd24c3 100644 --- a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs +++ b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs @@ -2,7 +2,6 @@ use std::collections::HashSet; use anyhow::Result; use auto_hash_map::AutoSet; -use futures::future::try_join_all; use turbo_tasks::{ FxIndexMap, FxIndexSet, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Value, Vc, }; @@ -152,15 +151,18 @@ pub async fn make_chunk_group( .await? .clone_value(); - let rebased_modules = try_join_all(traced_modules.into_iter().map(|module| { - RebasedAsset::new( - *module, - module.ident().path().root(), - module.ident().path().root(), - ) - .to_resolved() - })) - .await?; + let rebased_modules = traced_modules + .into_iter() + .map(|module| { + RebasedAsset::new( + *module, + module.ident().path().root(), + module.ident().path().root(), + ) + .to_resolved() + }) + .try_join() + .await?; referenced_output_assets.extend(rebased_modules.into_iter().map(ResolvedVc::upcast)); diff --git a/turbopack/crates/turbopack-node/src/transforms/webpack.rs b/turbopack/crates/turbopack-node/src/transforms/webpack.rs index 5107b0d3ec8b2..10e7be95e55fc 100644 --- a/turbopack/crates/turbopack-node/src/transforms/webpack.rs +++ b/turbopack/crates/turbopack-node/src/transforms/webpack.rs @@ -3,7 +3,6 @@ use std::mem::take; use anyhow::{bail, Context, Result}; use async_trait::async_trait; use either::Either; -use futures::future::try_join_all; use serde::{Deserialize, Serialize}; use serde_json::{json, Value as JsonValue}; use serde_with::serde_as; @@ -279,13 +278,12 @@ impl WebpackLoadersProcessedAsset { Either::Left(str) => File::from(str), Either::Right(bytes) => File::from(bytes.binary), }; - let assets = try_join_all( - emitted_assets_to_virtual_sources(processed.assets) - .await? - .into_iter() - .map(|v| v.to_resolved()), - ) - .await?; + let assets = emitted_assets_to_virtual_sources(processed.assets) + .await? + .into_iter() + .map(|v| v.to_resolved()) + .try_join() + .await?; let content = AssetContent::File(FileContent::Content(file).resolved_cell()).resolved_cell(); From a771ce2ff2e1bab9091b9630ecdc1456dfa1197e Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Wed, 27 Nov 2024 09:01:04 -0800 Subject: [PATCH 64/82] Undeprecate revalidate APIs and rename expire APIs (#73193) As discussed we are removing the deprecated field from `revalidateTag` and `revalidatePath` as they aren't going away anytime soon and the new `expire` APIs will have slightly different semantics so not a 1-1 rename with no arguments change anymore. We are also adding the `unstable_` prefix for `expireTag`/`expirePath` while we iterate on them so it's clear they will change. --------- Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com> --- .../04-functions/expireTag.mdx | 85 ------------------- .../04-functions/revalidatePath.mdx | 2 - .../04-functions/revalidateTag.mdx | 2 - ...expirePath.mdx => unstable_expirePath.mdx} | 56 ++++++------ .../04-functions/unstable_expireTag.mdx | 85 +++++++++++++++++++ packages/next/cache.d.ts | 4 +- packages/next/cache.js | 12 +-- .../plugins/next-types-plugin/index.ts | 4 +- .../src/server/lib/cache-handlers/default.ts | 4 +- .../src/server/lib/cache-handlers/types.ts | 4 +- .../server/web/spec-extension/revalidate.ts | 37 +++++--- test/deploy-tests-manifest.json | 4 +- .../app/cached/page.tsx | 4 +- .../app/test/page.tsx | 4 +- test/e2e/app-dir/actions/app-action.test.ts | 6 +- .../actions/app/delayed-action/actions.ts | 4 +- .../app-dir/actions/app/redirect/actions.ts | 4 +- .../app-dir/actions/app/revalidate-2/page.js | 4 +- .../actions/app/revalidate-multiple/page.js | 6 +- .../app-dir/actions/app/revalidate/page.js | 14 +-- test/e2e/app-dir/actions/app/shared/action.js | 4 +- .../e2e/app-dir/app-static/app-static.test.ts | 2 +- .../app/api/revalidate-path-edge/route.ts | 4 +- .../app/api/revalidate-path-node/route.ts | 4 +- .../app/api/revalidate-tag-edge/route.ts | 4 +- .../app/api/revalidate-tag-node/route.ts | 4 +- .../app-static/app/no-store/static/page.tsx | 4 +- .../unstable-cache/dynamic-undefined/page.tsx | 4 +- .../app/unstable-cache/dynamic/page.tsx | 4 +- .../app/[locale]/actions.ts | 4 +- .../app/popstate-revalidate/foo/action.ts | 4 +- .../app/timestamp/revalidate.js | 4 +- .../app/timestamp/trigger-revalidate/route.js | 2 +- .../next-after-app-deploy/index.test.ts | 2 +- .../next-after-app-deploy/middleware.js | 2 +- .../app/@dialog/revalidate-modal/page.tsx | 4 +- .../app/actions.ts | 4 +- .../nested-revalidate/@modal/modal/action.ts | 4 +- .../ppr-full/app/api/revalidate/route.js | 4 +- .../app/revalidate-tag/route.js | 4 +- .../app/api/revalidate-path/route.js | 4 +- .../app/api/revalidate-tag/route.js | 4 +- .../revalidate-dynamic.test.ts | 2 +- .../app/actions/revalidate.ts | 4 +- .../app/revalidate_via_page/page.tsx | 4 +- .../revalidatetag-rsc.test.ts | 10 +-- .../use-cache/app/cache-tag/buttons.tsx | 14 +-- test/e2e/app-dir/use-cache/app/form/page.tsx | 4 +- test/e2e/app-dir/use-cache/use-cache.test.ts | 6 +- .../isr/app/app/self-revalidate/action.js | 4 +- .../app/api/revalidate-alot/route.ts | 4 +- .../fetch-cache/app/api/revalidate/route.ts | 4 +- .../ssg-single-pass/app/revalidate/route.ts | 4 +- test/turbopack-build-tests-manifest.json | 8 +- 54 files changed, 253 insertions(+), 240 deletions(-) delete mode 100644 docs/01-app/03-api-reference/04-functions/expireTag.mdx rename docs/01-app/03-api-reference/04-functions/{expirePath.mdx => unstable_expirePath.mdx} (54%) create mode 100644 docs/01-app/03-api-reference/04-functions/unstable_expireTag.mdx diff --git a/docs/01-app/03-api-reference/04-functions/expireTag.mdx b/docs/01-app/03-api-reference/04-functions/expireTag.mdx deleted file mode 100644 index 604369c935870..0000000000000 --- a/docs/01-app/03-api-reference/04-functions/expireTag.mdx +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: expireTag -description: API Reference for the expireTag function. -version: canary ---- - -`expireTag` allows you to purge [cached data](/docs/app/building-your-application/caching) on-demand for a specific cache tag. - -> **Good to know**: -> -> - `expireTag` is available in both [Node.js and Edge runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes). -> - `expireTag` only invalidates the cache when the path is next visited. This means calling `expireTag` with a dynamic route segment will not immediately trigger many expirations at once. The invalidation only happens when the path is next visited. - -## Reference - -### Parameters - -```tsx -expireTag(...tags: string[]): void; -``` - -- `tags`: String arguments representing the cache tags associated with the data you want to revalidate. Must be less than or equal to 256 characters each. This value is case-sensitive. - -You can add tags to `fetch` as follows: - -```tsx -fetch(url, { next: { tags: [...] } }); -``` - -### Returns - -`expireTag` does not return a value. - -## Examples - -### Server Action - -You can invoke `expireTag` in a Server Action: - -```ts filename="app/actions.ts" switcher -'use server' - -import { expireTag } from 'next/cache' - -export default async function submit() { - await addPost() - expireTag('posts', 'blog') -} -``` - -```js filename="app/actions.js" switcher -'use server' - -import { expireTag } from 'next/cache' - -export default async function submit() { - await addPost() - expireTag('posts', 'blog') -} -``` - -### Route Handler - -You can invoke `expireTag` in a Route Handler: - -```ts filename="app/api/revalidate/route.ts" switcher -import type { NextRequest } from 'next/server' -import { expireTag } from 'next/cache' - -export async function GET(request: NextRequest) { - const tag = request.nextUrl.searchParams.get('tag') - expireTag(tag) - return Response.json({ revalidated: true, now: Date.now() }) -} -``` - -```js filename="app/api/revalidate/route.js" switcher -import { expireTag } from 'next/cache' - -export async function GET(request) { - const tag = request.nextUrl.searchParams.get('tag') - expireTag(tag) - return Response.json({ revalidated: true, now: Date.now() }) -} -``` diff --git a/docs/01-app/03-api-reference/04-functions/revalidatePath.mdx b/docs/01-app/03-api-reference/04-functions/revalidatePath.mdx index 821dbf3b62047..dd65815b8b1b0 100644 --- a/docs/01-app/03-api-reference/04-functions/revalidatePath.mdx +++ b/docs/01-app/03-api-reference/04-functions/revalidatePath.mdx @@ -3,8 +3,6 @@ title: revalidatePath description: API Reference for the revalidatePath function. --- -**Warning**: `revalidatePath` has been deprecated in favor of `expirePath` and will be removed in a future version. - `revalidatePath` allows you to purge [cached data](/docs/app/building-your-application/caching) on-demand for a specific path. > **Good to know**: diff --git a/docs/01-app/03-api-reference/04-functions/revalidateTag.mdx b/docs/01-app/03-api-reference/04-functions/revalidateTag.mdx index 3dc867eaca378..729e773b8f5e4 100644 --- a/docs/01-app/03-api-reference/04-functions/revalidateTag.mdx +++ b/docs/01-app/03-api-reference/04-functions/revalidateTag.mdx @@ -3,8 +3,6 @@ title: revalidateTag description: API Reference for the revalidateTag function. --- -**Warning**: `revalidateTag` has been deprecated in favor of `expireTag` and will be removed in a future version. - `revalidateTag` allows you to purge [cached data](/docs/app/building-your-application/caching) on-demand for a specific cache tag. > **Good to know**: diff --git a/docs/01-app/03-api-reference/04-functions/expirePath.mdx b/docs/01-app/03-api-reference/04-functions/unstable_expirePath.mdx similarity index 54% rename from docs/01-app/03-api-reference/04-functions/expirePath.mdx rename to docs/01-app/03-api-reference/04-functions/unstable_expirePath.mdx index d243e5b1d1ce0..e1dfcd5c2c5a6 100644 --- a/docs/01-app/03-api-reference/04-functions/expirePath.mdx +++ b/docs/01-app/03-api-reference/04-functions/unstable_expirePath.mdx @@ -1,24 +1,24 @@ --- -title: expirePath -description: API Reference for the expirePath function. -version: canary +title: unstable_expirePath +description: API Reference for the unstable_expirePath function. +version: unstable --- -`expirePath` allows you to purge [cached data](/docs/app/building-your-application/caching) on-demand for a specific path. +`unstable_expirePath` allows you to purge [cached data](/docs/app/building-your-application/caching) on-demand for a specific path. > **Good to know**: > -> - `expirePath` is available in both [Node.js and Edge runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes). -> - `expirePath` only invalidates the cache when the included path is next visited. This means calling `expirePath` with a dynamic route segment will not immediately trigger many expirations at once. The invalidation only happens when the path is next visited. -> - Currently, `expirePath` invalidates all the routes in the [client-side Router Cache](/docs/app/building-your-application/caching#client-side-router-cache) when used in a server action. This behavior is temporary and will be updated in the future to apply only to the specific path. -> - Using `expirePath` invalidates **only the specific path** in the [server-side Route Cache](/docs/app/building-your-application/caching#full-route-cache). +> - `unstable_expirePath` is available in both [Node.js and Edge runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes). +> - `unstable_expirePath` only invalidates the cache when the included path is next visited. This means calling `unstable_expirePath` with a dynamic route segment will not immediately trigger many expirations at once. The invalidation only happens when the path is next visited. +> - Currently, `unstable_expirePath` invalidates all the routes in the [client-side Router Cache](/docs/app/building-your-application/caching#client-side-router-cache) when used in a server action. This behavior is temporary and will be updated in the future to apply only to the specific path. +> - Using `unstable_expirePath` invalidates **only the specific path** in the [server-side Route Cache](/docs/app/building-your-application/caching#full-route-cache). ## Reference ### Parameters ```tsx -expirePath(path: string, type?: 'page' | 'layout'): void; +unstable_expirePath(path: string, type?: 'page' | 'layout'): void; ``` - `path`: Either a string representing the filesystem path associated with the data you want to expire (for example, `/product/[slug]/page`), or the literal route segment (for example, `/product/123`). Must be less than 1024 characters. This value is case-sensitive. @@ -26,15 +26,15 @@ expirePath(path: string, type?: 'page' | 'layout'): void; ### Returns -`expirePath` does not return a value. +`unstable_expirePath` does not return a value. ## Examples ### Expiring a specific URL ```ts -import { expirePath } from 'next/cache' -expirePath('/blog/post-1') +import { unstable_expirePath } from 'next/cache' +unstable_expirePath('/blog/post-1') ``` This will purge the cache for one specific URL on the next page visit. @@ -42,10 +42,10 @@ This will purge the cache for one specific URL on the next page visit. ### Expiring a page path ```ts -import { expirePath } from 'next/cache' -expirePath('/blog/[slug]', 'page') +import { unstable_expirePath } from 'next/cache' +unstable_expirePath('/blog/[slug]', 'page') // or with route groups -expirePath('/(main)/blog/[slug]', 'page') +unstable_expirePath('/(main)/blog/[slug]', 'page') ``` This will purge the cache any URL that matches the provided `page` file on the next page visit. This will _not_ invalidate pages beneath the specific page. For example, `/blog/[slug]` won't invalidate `/blog/[slug]/[author]`. @@ -53,10 +53,10 @@ This will purge the cache any URL that matches the provided `page` file on the n ### Expiring a layout path ```ts -import { expirePath } from 'next/cache' -expirePath('/blog/[slug]', 'layout') +import { unstable_expirePath } from 'next/cache' +unstable_expirePath('/blog/[slug]', 'layout') // or with route groups -expirePath('/(main)/post/[slug]', 'layout') +unstable_expirePath('/(main)/post/[slug]', 'layout') ``` This will purge the cache on any URL that matches the provided `layout` file on the next page visit. This will cause pages beneath with the same layout to revalidate on the next visit. For example, in the above case, `/blog/[slug]/[another]` would also revalidate on the next visit. @@ -64,41 +64,41 @@ This will purge the cache on any URL that matches the provided `layout` file on ### Expiring all data ```ts -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' -expirePath('/', 'layout') +unstable_expirePath('/', 'layout') ``` This will purge the Data Cache on the next page visit. ### Server Action -You can call `expirePath` in a Server Action: +You can call `unstable_expirePath` in a Server Action: ```ts filename="app/actions.ts" switcher 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export default async function submit() { await submitForm() - expirePath('/') + unstable_expirePath('/') } ``` ### Route Handler -You can call `expirePath` in a Route Handler: +You can call `unstable_expirePath` in a Route Handler: ```ts filename="app/api/expire/route.ts" switcher -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' import type { NextRequest } from 'next/server' export async function GET(request: NextRequest) { const path = request.nextUrl.searchParams.get('path') if (path) { - expirePath(path) + unstable_expirePath(path) return Response.json({ revalidated: true, now: Date.now() }) } @@ -111,13 +111,13 @@ export async function GET(request: NextRequest) { ``` ```js filename="app/api/expire/route.js" switcher -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function GET(request) { const path = request.nextUrl.searchParams.get('path') if (path) { - expirePath(path) + unstable_expirePath(path) return Response.json({ expired: true, now: Date.now() }) } diff --git a/docs/01-app/03-api-reference/04-functions/unstable_expireTag.mdx b/docs/01-app/03-api-reference/04-functions/unstable_expireTag.mdx new file mode 100644 index 0000000000000..b51505a482e51 --- /dev/null +++ b/docs/01-app/03-api-reference/04-functions/unstable_expireTag.mdx @@ -0,0 +1,85 @@ +--- +title: unstable_expireTag +description: API Reference for the unstable_expireTag function. +version: unstable +--- + +`unstable_expireTag` allows you to purge [cached data](/docs/app/building-your-application/caching) on-demand for a specific cache tag. + +> **Good to know**: +> +> - `unstable_expireTag` is available in both [Node.js and Edge runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes). +> - `unstable_expireTag` only invalidates the cache when the path is next visited. This means calling `unstable_expireTag` with a dynamic route segment will not immediately trigger many expirations at once. The invalidation only happens when the path is next visited. + +## Reference + +### Parameters + +```tsx +unstable_expireTag(...tags: string[]): void; +``` + +- `tags`: String arguments representing the cache tags associated with the data you want to revalidate. Must be less than or equal to 256 characters each. This value is case-sensitive. + +You can add tags to `fetch` as follows: + +```tsx +fetch(url, { next: { tags: [...] } }); +``` + +### Returns + +`unstable_expireTag` does not return a value. + +## Examples + +### Server Action + +You can invoke `unstable_expireTag` in a Server Action: + +```ts filename="app/actions.ts" switcher +'use server' + +import { unstable_expireTag } from 'next/cache' + +export default async function submit() { + await addPost() + unstable_expireTag('posts', 'blog') +} +``` + +```js filename="app/actions.js" switcher +'use server' + +import { unstable_expireTag } from 'next/cache' + +export default async function submit() { + await addPost() + unstable_expireTag('posts', 'blog') +} +``` + +### Route Handler + +You can invoke `unstable_expireTag` in a Route Handler: + +```ts filename="app/api/revalidate/route.ts" switcher +import type { NextRequest } from 'next/server' +import { unstable_expireTag } from 'next/cache' + +export async function GET(request: NextRequest) { + const tag = request.nextUrl.searchParams.get('tag') + unstable_expireTag(tag) + return Response.json({ revalidated: true, now: Date.now() }) +} +``` + +```js filename="app/api/revalidate/route.js" switcher +import { unstable_expireTag } from 'next/cache' + +export async function GET(request) { + const tag = request.nextUrl.searchParams.get('tag') + unstable_expireTag(tag) + return Response.json({ revalidated: true, now: Date.now() }) +} +``` diff --git a/packages/next/cache.d.ts b/packages/next/cache.d.ts index 128161cc7a67f..f07bb2a3f274c 100644 --- a/packages/next/cache.d.ts +++ b/packages/next/cache.d.ts @@ -3,8 +3,8 @@ export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cac export { revalidatePath, revalidateTag, - expirePath, - expireTag, + unstable_expirePath, + unstable_expireTag, } from 'next/dist/server/web/spec-extension/revalidate' export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store' diff --git a/packages/next/cache.js b/packages/next/cache.js index 22cc94d555a90..4cdb31d3e35e4 100644 --- a/packages/next/cache.js +++ b/packages/next/cache.js @@ -7,10 +7,10 @@ const cacheExports = { revalidatePath: require('next/dist/server/web/spec-extension/revalidate') .revalidatePath, - expireTag: require('next/dist/server/web/spec-extension/revalidate') - .expireTag, - expirePath: require('next/dist/server/web/spec-extension/revalidate') - .expirePath, + unstable_expireTag: require('next/dist/server/web/spec-extension/revalidate') + .unstable_expireTag, + unstable_expirePath: require('next/dist/server/web/spec-extension/revalidate') + .unstable_expirePath, unstable_noStore: require('next/dist/server/web/spec-extension/unstable-no-store') @@ -28,8 +28,8 @@ module.exports = cacheExports exports.unstable_cache = cacheExports.unstable_cache exports.revalidatePath = cacheExports.revalidatePath exports.revalidateTag = cacheExports.revalidateTag -exports.expireTag = cacheExports.expireTag -exports.expirePath = cacheExports.expirePath +exports.unstable_expireTag = cacheExports.unstable_expireTag +exports.unstable_expirePath = cacheExports.unstable_expirePath exports.unstable_noStore = cacheExports.unstable_noStore exports.unstable_cacheLife = cacheExports.unstable_cacheLife exports.unstable_cacheTag = cacheExports.unstable_cacheTag diff --git a/packages/next/src/build/webpack/plugins/next-types-plugin/index.ts b/packages/next/src/build/webpack/plugins/next-types-plugin/index.ts index f2d481fd053a8..23b851cc21292 100644 --- a/packages/next/src/build/webpack/plugins/next-types-plugin/index.ts +++ b/packages/next/src/build/webpack/plugins/next-types-plugin/index.ts @@ -689,8 +689,8 @@ declare module 'next/cache' { export { revalidateTag, revalidatePath, - expireTag, - expirePath, + unstable_expireTag, + unstable_expirePath, } from 'next/dist/server/web/spec-extension/revalidate' export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store' diff --git a/packages/next/src/server/lib/cache-handlers/default.ts b/packages/next/src/server/lib/cache-handlers/default.ts index 02065fcc5c125..e78c0f1a5f997 100644 --- a/packages/next/src/server/lib/cache-handlers/default.ts +++ b/packages/next/src/server/lib/cache-handlers/default.ts @@ -103,7 +103,7 @@ const DefaultCacheHandler: CacheHandler = { } }, - async expireTags(...tags) { + async unstable_expireTags(...tags) { for (const tag of tags) { if (!tagsManifest.items[tag]) { tagsManifest.items[tag] = {} @@ -114,7 +114,7 @@ const DefaultCacheHandler: CacheHandler = { }, async receiveExpiredTags(...tags): Promise { - return this.expireTags(...tags) + return this.unstable_expireTags(...tags) }, } diff --git a/packages/next/src/server/lib/cache-handlers/types.ts b/packages/next/src/server/lib/cache-handlers/types.ts index 48ba359f2bc27..1b1c651413bda 100644 --- a/packages/next/src/server/lib/cache-handlers/types.ts +++ b/packages/next/src/server/lib/cache-handlers/types.ts @@ -44,9 +44,9 @@ export interface CacheHandler { set(cacheKey: string, entry: Promise): Promise - // This is called when expireTags('') is called + // This is called when unstable_expireTags('') is called // and should update tags manifest accordingly - expireTags(...tags: string[]): Promise + unstable_expireTags(...tags: string[]): Promise // This is called when an action request sends // NEXT_CACHE_REVALIDATED_TAGS_HEADER and tells diff --git a/packages/next/src/server/web/spec-extension/revalidate.ts b/packages/next/src/server/web/spec-extension/revalidate.ts index dd48191687866..e2ba5c0a35a3a 100644 --- a/packages/next/src/server/web/spec-extension/revalidate.ts +++ b/packages/next/src/server/web/spec-extension/revalidate.ts @@ -12,7 +12,6 @@ import { workUnitAsyncStorage } from '../../app-render/work-unit-async-storage.e import { DynamicServerError } from '../../../client/components/hooks-server-context' /** - * @deprecated this function has been deprecated in favor of expireTag() * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag. * * Read more: [Next.js Docs: `revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag) @@ -22,30 +21,48 @@ export function revalidateTag(tag: string) { } /** - * @deprecated this function has been deprecated in favor of expirePath() * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific path. * - * Read more: [Next.js Docs: `revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath) + * Read more: [Next.js Docs: `unstable_expirePath`](https://nextjs.org/docs/app/api-reference/functions/unstable_expirePath) */ -export function revalidatePath(originalPath: string, type?: 'layout' | 'page') { - return expirePath(originalPath, type) +export function unstable_expirePath( + originalPath: string, + type?: 'layout' | 'page' +) { + if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) { + console.warn( + `Warning: expirePath received "${originalPath}" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/unstable_expirePath` + ) + return + } + + let normalizedPath = `${NEXT_CACHE_IMPLICIT_TAG_ID}${originalPath}` + + if (type) { + normalizedPath += `${normalizedPath.endsWith('/') ? '' : '/'}${type}` + } else if (isDynamicRoute(originalPath)) { + console.warn( + `Warning: a dynamic page path "${originalPath}" was passed to "expirePath", but the "type" parameter is missing. This has no effect by default, see more info here https://nextjs.org/docs/app/api-reference/functions/unstable_expirePath` + ) + } + return revalidate([normalizedPath], `unstable_expirePath ${originalPath}`) } /** * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag. * - * Read more: [Next.js Docs: `expireTag`](https://nextjs.org/docs/app/api-reference/functions/expireTag) + * Read more: [Next.js Docs: `unstable_expireTag`](https://nextjs.org/docs/app/api-reference/functions/unstable_expireTag) */ -export function expireTag(...tags: string[]) { - return revalidate(tags, `expireTag ${tags.join(', ')}`) +export function unstable_expireTag(...tags: string[]) { + return revalidate(tags, `unstable_expireTag ${tags.join(', ')}`) } /** * This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific path. * - * Read more: [Next.js Docs: `expirePath`](https://nextjs.org/docs/app/api-reference/functions/expirePath) + * Read more: [Next.js Docs: `revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath) */ -export function expirePath(originalPath: string, type?: 'layout' | 'page') { +export function revalidatePath(originalPath: string, type?: 'layout' | 'page') { if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) { console.warn( `Warning: revalidatePath received "${originalPath}" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath` diff --git a/test/deploy-tests-manifest.json b/test/deploy-tests-manifest.json index 4bd657ed5774c..e0ef7fb9b5345 100644 --- a/test/deploy-tests-manifest.json +++ b/test/deploy-tests-manifest.json @@ -4,13 +4,13 @@ "test/e2e/app-dir/actions/app-action.test.ts": { "failed": [ "app-dir action handling fetch actions should invalidate client cache when path is revalidated", - "app-dir action handling fetch actions should handle expireTag" + "app-dir action handling fetch actions should handle unstable_expireTag" ] }, "test/e2e/app-dir/app-static/app-static.test.ts": { "failed": [ "app-dir static/dynamic handling new tags have been specified on subsequent fetch should not fetch from memory cache", - "app-dir static/dynamic handling new tags have been specified on subsequent fetch should not fetch from memory cache after expireTag is used" + "app-dir static/dynamic handling new tags have been specified on subsequent fetch should not fetch from memory cache after unstable_expireTag is used" ] }, "test/e2e/app-dir/metadata/metadata.test.ts": { diff --git a/test/development/app-dir/dynamic-io-dev-cache-scope/app/cached/page.tsx b/test/development/app-dir/dynamic-io-dev-cache-scope/app/cached/page.tsx index e179b488b05da..cbe0f376b6be6 100644 --- a/test/development/app-dir/dynamic-io-dev-cache-scope/app/cached/page.tsx +++ b/test/development/app-dir/dynamic-io-dev-cache-scope/app/cached/page.tsx @@ -1,5 +1,5 @@ import { - expireTag, + unstable_expireTag, unstable_cacheLife as cacheLife, unstable_cacheTag, } from 'next/cache' @@ -13,7 +13,7 @@ function InnerComponent({ children }) { async function refresh() { 'use server' - expireTag('hello') + unstable_expireTag('hello') } async function reload() { diff --git a/test/e2e/app-dir/actions-revalidate-remount/app/test/page.tsx b/test/e2e/app-dir/actions-revalidate-remount/app/test/page.tsx index 099931fe6509f..e4fb27b7b03a2 100644 --- a/test/e2e/app-dir/actions-revalidate-remount/app/test/page.tsx +++ b/test/e2e/app-dir/actions-revalidate-remount/app/test/page.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export default async function HomePage() { await new Promise((resolve) => setTimeout(resolve, 200)) @@ -9,7 +9,7 @@ export default async function HomePage() { { 'use server' - expirePath('/test') + unstable_expirePath('/test') }} > diff --git a/test/e2e/app-dir/actions/app-action.test.ts b/test/e2e/app-dir/actions/app-action.test.ts index 5852044a0dc7d..6279844e05bbf 100644 --- a/test/e2e/app-dir/actions/app-action.test.ts +++ b/test/e2e/app-dir/actions/app-action.test.ts @@ -1276,7 +1276,7 @@ describe('app-dir action handling', () => { }, 5000) }) - it('should handle expirePath', async () => { + it('should handle unstable_expirePath', async () => { const browser = await next.browser('/revalidate') const randomNumber = await browser.elementByCss('#random-number').text() const justPutIt = await browser.elementByCss('#justputit').text() @@ -1299,7 +1299,7 @@ describe('app-dir action handling', () => { }) }) - it('should handle expireTag', async () => { + it('should handle unstable_expireTag', async () => { const browser = await next.browser('/revalidate') const randomNumber = await browser.elementByCss('#random-number').text() const justPutIt = await browser.elementByCss('#justputit').text() @@ -1323,7 +1323,7 @@ describe('app-dir action handling', () => { }) // TODO: investigate flakey behavior with revalidate - it.skip('should handle expireTag + redirect', async () => { + it.skip('should handle unstable_expireTag + redirect', async () => { const browser = await next.browser('/revalidate') const randomNumber = await browser.elementByCss('#random-number').text() const justPutIt = await browser.elementByCss('#justputit').text() diff --git a/test/e2e/app-dir/actions/app/delayed-action/actions.ts b/test/e2e/app-dir/actions/app/delayed-action/actions.ts index 0ec545a06699d..e80ff6f3ad7a3 100644 --- a/test/e2e/app-dir/actions/app/delayed-action/actions.ts +++ b/test/e2e/app-dir/actions/app/delayed-action/actions.ts @@ -1,10 +1,10 @@ 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' import { redirect } from 'next/navigation' export const action = async () => { console.log('revalidating') - expirePath('/delayed-action', 'page') + unstable_expirePath('/delayed-action', 'page') return Math.random() } diff --git a/test/e2e/app-dir/actions/app/redirect/actions.ts b/test/e2e/app-dir/actions/app/redirect/actions.ts index e0188efa8acd5..21de7a0a787b9 100644 --- a/test/e2e/app-dir/actions/app/redirect/actions.ts +++ b/test/e2e/app-dir/actions/app/redirect/actions.ts @@ -1,7 +1,7 @@ 'use server' import { redirect } from 'next/navigation' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' type State = { errors: Record @@ -16,7 +16,7 @@ export async function action(previousState: State, formData: FormData) { } if (revalidate === 'on') { - expirePath('/redirect') + unstable_expirePath('/redirect') } redirect('/redirect/other') diff --git a/test/e2e/app-dir/actions/app/revalidate-2/page.js b/test/e2e/app-dir/actions/app/revalidate-2/page.js index 8c5e209fb5cd5..32f21e443a39c 100644 --- a/test/e2e/app-dir/actions/app/revalidate-2/page.js +++ b/test/e2e/app-dir/actions/app/revalidate-2/page.js @@ -1,4 +1,4 @@ -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' import { cookies } from 'next/headers' import Link from 'next/link' @@ -25,7 +25,7 @@ export default async function Page() { id="revalidate-tag" formAction={async () => { 'use server' - expireTag('thankyounext') + unstable_expireTag('thankyounext') }} > revalidate thankyounext diff --git a/test/e2e/app-dir/actions/app/revalidate-multiple/page.js b/test/e2e/app-dir/actions/app/revalidate-multiple/page.js index c632996a79521..3b75c88146cb3 100644 --- a/test/e2e/app-dir/actions/app/revalidate-multiple/page.js +++ b/test/e2e/app-dir/actions/app/revalidate-multiple/page.js @@ -1,4 +1,4 @@ -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' export default async function Page() { const data1 = await fetch( @@ -29,8 +29,8 @@ export default async function Page() { id="revalidate" formAction={async () => { 'use server' - expireTag('thankyounext') - expireTag('justputit') + unstable_expireTag('thankyounext') + unstable_expireTag('justputit') }} > revalidate thankyounext diff --git a/test/e2e/app-dir/actions/app/revalidate/page.js b/test/e2e/app-dir/actions/app/revalidate/page.js index 0ae15584c8be5..800fae31ef83e 100644 --- a/test/e2e/app-dir/actions/app/revalidate/page.js +++ b/test/e2e/app-dir/actions/app/revalidate/page.js @@ -1,4 +1,4 @@ -import { expirePath, expireTag } from 'next/cache' +import { unstable_expirePath, unstable_expireTag } from 'next/cache' import { redirect } from 'next/navigation' import Link from 'next/link' @@ -60,7 +60,7 @@ export default async function Page() { id="revalidate-thankyounext" formAction={async () => { 'use server' - expireTag('thankyounext') + unstable_expireTag('thankyounext') }} > revalidate thankyounext @@ -71,7 +71,7 @@ export default async function Page() { id="revalidate-justputit" formAction={async () => { 'use server' - expireTag('justputit') + unstable_expireTag('justputit') }} > revalidate justputit @@ -82,7 +82,7 @@ export default async function Page() { id="revalidate-path" formAction={async () => { 'use server' - expirePath('/revalidate') + unstable_expirePath('/revalidate') }} > revalidate path @@ -93,7 +93,7 @@ export default async function Page() { id="revalidate-path-redirect" formAction={async () => { 'use server' - expireTag('justputit') + unstable_expireTag('justputit') redirect('/revalidate') }} > @@ -116,7 +116,7 @@ export default async function Page() { id="redirect-revalidate" formAction={async () => { 'use server' - expireTag('justputit') + unstable_expireTag('justputit') redirect('/revalidate?foo=bar') }} > @@ -126,7 +126,7 @@ export default async function Page() { { 'use server' - expireTag('justputit') + unstable_expireTag('justputit') }} /> diff --git a/test/e2e/app-dir/actions/app/shared/action.js b/test/e2e/app-dir/actions/app/shared/action.js index 552f22adf00b8..348836444dd62 100644 --- a/test/e2e/app-dir/actions/app/shared/action.js +++ b/test/e2e/app-dir/actions/app/shared/action.js @@ -1,12 +1,12 @@ 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' let x = 0 export async function inc() { ++x - expirePath('/shared') + unstable_expirePath('/shared') } export async function get() { diff --git a/test/e2e/app-dir/app-static/app-static.test.ts b/test/e2e/app-dir/app-static/app-static.test.ts index d06fb401ef852..c0b400c8a3113 100644 --- a/test/e2e/app-dir/app-static/app-static.test.ts +++ b/test/e2e/app-dir/app-static/app-static.test.ts @@ -152,7 +152,7 @@ describe('app-dir static/dynamic handling', () => { expect(data1).not.toBe(data2) }) - it('should not fetch from memory cache after expireTag is used', async () => { + it('should not fetch from memory cache after unstable_expireTag is used', async () => { const res1 = await next.fetch('/specify-new-tags/one-tag') expect(res1.status).toBe(200) diff --git a/test/e2e/app-dir/app-static/app/api/revalidate-path-edge/route.ts b/test/e2e/app-dir/app-static/app/api/revalidate-path-edge/route.ts index d587a48d3f8f3..a252d436c4626 100644 --- a/test/e2e/app-dir/app-static/app/api/revalidate-path-edge/route.ts +++ b/test/e2e/app-dir/app-static/app/api/revalidate-path-edge/route.ts @@ -1,5 +1,5 @@ import { NextRequest, NextResponse } from 'next/server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export const runtime = 'edge' @@ -7,7 +7,7 @@ export async function GET(req: NextRequest) { const path = req.nextUrl.searchParams.get('path') || '/' try { console.log('revalidating path', path) - expirePath(path) + unstable_expirePath(path) return NextResponse.json({ revalidated: true, now: Date.now() }) } catch (err) { console.error('Failed to revalidate', path, err) diff --git a/test/e2e/app-dir/app-static/app/api/revalidate-path-node/route.ts b/test/e2e/app-dir/app-static/app/api/revalidate-path-node/route.ts index 33635cd70bd5c..daa0a3066bb19 100644 --- a/test/e2e/app-dir/app-static/app/api/revalidate-path-node/route.ts +++ b/test/e2e/app-dir/app-static/app/api/revalidate-path-node/route.ts @@ -1,5 +1,5 @@ import { NextRequest, NextResponse } from 'next/server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export const revalidate = 1 @@ -7,7 +7,7 @@ export async function GET(req: NextRequest) { const path = req.nextUrl.searchParams.get('path') || '/' try { console.log('revalidating path', path) - expirePath(path) + unstable_expirePath(path) return NextResponse.json({ revalidated: true, now: Date.now() }) } catch (err) { console.error('Failed to revalidate', path, err) diff --git a/test/e2e/app-dir/app-static/app/api/revalidate-tag-edge/route.ts b/test/e2e/app-dir/app-static/app/api/revalidate-tag-edge/route.ts index 65e3c2a4442e4..ca99fe330c551 100644 --- a/test/e2e/app-dir/app-static/app/api/revalidate-tag-edge/route.ts +++ b/test/e2e/app-dir/app-static/app/api/revalidate-tag-edge/route.ts @@ -1,11 +1,11 @@ import { NextResponse } from 'next/server' -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' export const revalidate = 0 export const runtime = 'edge' export async function GET(req) { const tag = req.nextUrl.searchParams.get('tag') - expireTag(tag) + unstable_expireTag(tag) return NextResponse.json({ revalidated: true, now: Date.now() }) } diff --git a/test/e2e/app-dir/app-static/app/api/revalidate-tag-node/route.ts b/test/e2e/app-dir/app-static/app/api/revalidate-tag-node/route.ts index 8ae087fbd6857..11e9494a44cb1 100644 --- a/test/e2e/app-dir/app-static/app/api/revalidate-tag-node/route.ts +++ b/test/e2e/app-dir/app-static/app/api/revalidate-tag-node/route.ts @@ -1,10 +1,10 @@ import { NextResponse } from 'next/server' -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' export const revalidate = 0 export async function GET(req) { const tag = req.nextUrl.searchParams.get('tag') - expireTag(tag) + unstable_expireTag(tag) return NextResponse.json({ revalidated: true, now: Date.now() }) } diff --git a/test/e2e/app-dir/app-static/app/no-store/static/page.tsx b/test/e2e/app-dir/app-static/app/no-store/static/page.tsx index 7bb9bc25ddb82..c0908b70dc090 100644 --- a/test/e2e/app-dir/app-static/app/no-store/static/page.tsx +++ b/test/e2e/app-dir/app-static/app/no-store/static/page.tsx @@ -1,11 +1,11 @@ -import { expireTag, unstable_cache } from 'next/cache' +import { unstable_expireTag, unstable_cache } from 'next/cache' import { getUncachedRandomData } from '../no-store-fn' import { RevalidateButton } from '../revalidate-button' export default async function Page() { async function revalidate() { 'use server' - await expireTag('no-store-fn') + await unstable_expireTag('no-store-fn') } const cachedData = await unstable_cache( diff --git a/test/e2e/app-dir/app-static/app/unstable-cache/dynamic-undefined/page.tsx b/test/e2e/app-dir/app-static/app/unstable-cache/dynamic-undefined/page.tsx index d4427b33fab6b..a59e2d53dd2ed 100644 --- a/test/e2e/app-dir/app-static/app/unstable-cache/dynamic-undefined/page.tsx +++ b/test/e2e/app-dir/app-static/app/unstable-cache/dynamic-undefined/page.tsx @@ -1,4 +1,4 @@ -import { expireTag, unstable_cache } from 'next/cache' +import { unstable_expireTag, unstable_cache } from 'next/cache' import { RevalidateButton } from '../revalidate-button' export const dynamic = 'force-dynamic' @@ -6,7 +6,7 @@ export const dynamic = 'force-dynamic' export default async function Page() { async function revalidate() { 'use server' - await expireTag('undefined-value-data') + await unstable_expireTag('undefined-value-data') } const cachedData = await unstable_cache( diff --git a/test/e2e/app-dir/app-static/app/unstable-cache/dynamic/page.tsx b/test/e2e/app-dir/app-static/app/unstable-cache/dynamic/page.tsx index 4592a195bc524..070969e238e0c 100644 --- a/test/e2e/app-dir/app-static/app/unstable-cache/dynamic/page.tsx +++ b/test/e2e/app-dir/app-static/app/unstable-cache/dynamic/page.tsx @@ -1,4 +1,4 @@ -import { expireTag, unstable_cache } from 'next/cache' +import { unstable_expireTag, unstable_cache } from 'next/cache' import { RevalidateButton } from '../revalidate-button' export const dynamic = 'force-dynamic' @@ -6,7 +6,7 @@ export const dynamic = 'force-dynamic' export default async function Page() { async function revalidate() { 'use server' - await expireTag('random-value-data') + await unstable_expireTag('random-value-data') } const cachedData = await unstable_cache( diff --git a/test/e2e/app-dir/dynamic-interception-route-revalidate/app/[locale]/actions.ts b/test/e2e/app-dir/dynamic-interception-route-revalidate/app/[locale]/actions.ts index a9f5e7ae63ba5..d4bdaffa25f09 100644 --- a/test/e2e/app-dir/dynamic-interception-route-revalidate/app/[locale]/actions.ts +++ b/test/e2e/app-dir/dynamic-interception-route-revalidate/app/[locale]/actions.ts @@ -1,9 +1,9 @@ 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function doAction() { - expirePath('/en/photos/1/view') + unstable_expirePath('/en/photos/1/view') // sleep 1s await new Promise((resolve) => setTimeout(resolve, 1000)) return Math.random() diff --git a/test/e2e/app-dir/navigation/app/popstate-revalidate/foo/action.ts b/test/e2e/app-dir/navigation/app/popstate-revalidate/foo/action.ts index e0371ffebb3d1..a8da6c20addfa 100644 --- a/test/e2e/app-dir/navigation/app/popstate-revalidate/foo/action.ts +++ b/test/e2e/app-dir/navigation/app/popstate-revalidate/foo/action.ts @@ -1,8 +1,8 @@ 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function action() { - expirePath('/', 'layout') + unstable_expirePath('/', 'layout') return true } diff --git a/test/e2e/app-dir/next-after-app-deploy/app/timestamp/revalidate.js b/test/e2e/app-dir/next-after-app-deploy/app/timestamp/revalidate.js index d4b8517109e95..8c08eddeef5ea 100644 --- a/test/e2e/app-dir/next-after-app-deploy/app/timestamp/revalidate.js +++ b/test/e2e/app-dir/next-after-app-deploy/app/timestamp/revalidate.js @@ -1,4 +1,4 @@ -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function revalidateTimestampPage(/** @type {string} */ key) { const path = `/timestamp/key/${encodeURIComponent(key)}` @@ -10,7 +10,7 @@ export async function revalidateTimestampPage(/** @type {string} */ key) { } console.log('revalidateTimestampPage :: revalidating', path) - expirePath(path) + unstable_expirePath(path) } const WAIT_BEFORE_REVALIDATING_DEFAULT = 1000 diff --git a/test/e2e/app-dir/next-after-app-deploy/app/timestamp/trigger-revalidate/route.js b/test/e2e/app-dir/next-after-app-deploy/app/timestamp/trigger-revalidate/route.js index 569e4ba95b645..b2ca2d473adae 100644 --- a/test/e2e/app-dir/next-after-app-deploy/app/timestamp/trigger-revalidate/route.js +++ b/test/e2e/app-dir/next-after-app-deploy/app/timestamp/trigger-revalidate/route.js @@ -1,7 +1,7 @@ import { revalidateTimestampPage } from '../revalidate' export async function POST(/** @type {Request} */ request) { - // we can't call expirePath from middleware, so we need to do it from here instead + // we can't call unstable_expirePath from middleware, so we need to do it from here instead const path = new URL(request.url).searchParams.get('path') if (!path) { return Response.json( diff --git a/test/e2e/app-dir/next-after-app-deploy/index.test.ts b/test/e2e/app-dir/next-after-app-deploy/index.test.ts index 58ec0792c91ea..ac6126cbaa10d 100644 --- a/test/e2e/app-dir/next-after-app-deploy/index.test.ts +++ b/test/e2e/app-dir/next-after-app-deploy/index.test.ts @@ -9,7 +9,7 @@ const WAIT_BEFORE_REVALIDATING = 1000 // If we want to verify that `unstable_after()` ran its callback, // we need it to perform some kind of side effect (because it can't affect the response). // In other tests, we often use logs for this, but we don't have access to those in deploy tests. -// So instead this test relies on calling `expirePath` inside `unstable_after` +// So instead this test relies on calling `unstable_expirePath` inside `unstable_after` // to revalidate an ISR page '/timestamp/key/[key]', and then checking if the timestamp changed -- // if it did, we successfully ran the callback (and performed a side effect). diff --git a/test/e2e/app-dir/next-after-app-deploy/middleware.js b/test/e2e/app-dir/next-after-app-deploy/middleware.js index 9496a4d1d4d9f..7566d4a1697cd 100644 --- a/test/e2e/app-dir/next-after-app-deploy/middleware.js +++ b/test/e2e/app-dir/next-after-app-deploy/middleware.js @@ -9,7 +9,7 @@ export function middleware( if (match) { const pathPrefix = match.groups.prefix after(async () => { - // we can't call expirePath from middleware, so we need to do it via an endpoint instead + // we can't call unstable_expirePath from middleware, so we need to do it via an endpoint instead const pathToRevalidate = pathPrefix + `/middleware` const postUrl = new URL('/timestamp/trigger-revalidate', url.href) diff --git a/test/e2e/app-dir/parallel-routes-revalidation/app/@dialog/revalidate-modal/page.tsx b/test/e2e/app-dir/parallel-routes-revalidation/app/@dialog/revalidate-modal/page.tsx index da5ee609d76c3..6cb45f0cb8429 100644 --- a/test/e2e/app-dir/parallel-routes-revalidation/app/@dialog/revalidate-modal/page.tsx +++ b/test/e2e/app-dir/parallel-routes-revalidation/app/@dialog/revalidate-modal/page.tsx @@ -1,6 +1,6 @@ import Link from 'next/link' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' import { addData } from '../../actions' export default function Page() { @@ -9,7 +9,7 @@ export default function Page() { await addData(new Date().toISOString()) - expirePath('/', 'layout') + unstable_expirePath('/', 'layout') } return ( diff --git a/test/e2e/app-dir/parallel-routes-revalidation/app/actions.ts b/test/e2e/app-dir/parallel-routes-revalidation/app/actions.ts index c090fce0b764c..1d612f3c5bb6e 100644 --- a/test/e2e/app-dir/parallel-routes-revalidation/app/actions.ts +++ b/test/e2e/app-dir/parallel-routes-revalidation/app/actions.ts @@ -1,5 +1,5 @@ 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' import { redirect } from 'next/navigation' let data = [] @@ -25,5 +25,5 @@ export async function redirectAction() { export async function clearData() { data = [] - expirePath('/') + unstable_expirePath('/') } diff --git a/test/e2e/app-dir/parallel-routes-revalidation/app/nested-revalidate/@modal/modal/action.ts b/test/e2e/app-dir/parallel-routes-revalidation/app/nested-revalidate/@modal/modal/action.ts index 8e623cddd2bcb..3aa8fecf8e69f 100644 --- a/test/e2e/app-dir/parallel-routes-revalidation/app/nested-revalidate/@modal/modal/action.ts +++ b/test/e2e/app-dir/parallel-routes-revalidation/app/nested-revalidate/@modal/modal/action.ts @@ -1,10 +1,10 @@ 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function revalidateAction() { console.log('revalidate action') - expirePath('/') + unstable_expirePath('/') return { success: true, } diff --git a/test/e2e/app-dir/ppr-full/app/api/revalidate/route.js b/test/e2e/app-dir/ppr-full/app/api/revalidate/route.js index 7a8053e892d48..cdb5a911021e7 100644 --- a/test/e2e/app-dir/ppr-full/app/api/revalidate/route.js +++ b/test/e2e/app-dir/ppr-full/app/api/revalidate/route.js @@ -1,4 +1,4 @@ -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function GET(request) { const url = new URL(request.url) @@ -12,7 +12,7 @@ export async function GET(request) { type = 'page' } - expirePath(pathname, type) + unstable_expirePath(pathname, type) } return new Response( diff --git a/test/e2e/app-dir/ppr-unstable-cache/app/revalidate-tag/route.js b/test/e2e/app-dir/ppr-unstable-cache/app/revalidate-tag/route.js index 1e629fddc7e36..fd76e4e68909d 100644 --- a/test/e2e/app-dir/ppr-unstable-cache/app/revalidate-tag/route.js +++ b/test/e2e/app-dir/ppr-unstable-cache/app/revalidate-tag/route.js @@ -1,6 +1,6 @@ -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' export const POST = async () => { - expireTag('unstable-cache-fetch') + unstable_expireTag('unstable-cache-fetch') return new Response('OK', { status: 200 }) } diff --git a/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-path/route.js b/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-path/route.js index 0a9a69ff5ad11..569645441c959 100644 --- a/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-path/route.js +++ b/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-path/route.js @@ -1,7 +1,7 @@ import { NextResponse } from 'next/server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function GET(req) { - expirePath('/') + unstable_expirePath('/') return NextResponse.json({ revalidated: true, now: Date.now() }) } diff --git a/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-tag/route.js b/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-tag/route.js index 4de5b8625e9a5..4b5bd2e2bfd13 100644 --- a/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-tag/route.js +++ b/test/e2e/app-dir/revalidate-dynamic/app/api/revalidate-tag/route.js @@ -1,7 +1,7 @@ import { NextResponse } from 'next/server' -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' export async function GET(req) { - expireTag('thankyounext') + unstable_expireTag('thankyounext') return NextResponse.json({ revalidated: true, now: Date.now() }) } diff --git a/test/e2e/app-dir/revalidate-dynamic/revalidate-dynamic.test.ts b/test/e2e/app-dir/revalidate-dynamic/revalidate-dynamic.test.ts index 3c0d0920324fa..cf1fce5f684c8 100644 --- a/test/e2e/app-dir/revalidate-dynamic/revalidate-dynamic.test.ts +++ b/test/e2e/app-dir/revalidate-dynamic/revalidate-dynamic.test.ts @@ -6,7 +6,7 @@ describe('app-dir revalidate-dynamic', () => { }) if (isNextStart) { - it('should correctly mark a route handler that uses expireTag as dynamic', async () => { + it('should correctly mark a route handler that uses unstable_expireTag as dynamic', async () => { expect(next.cliOutput).toContain('ƒ /api/revalidate-path') expect(next.cliOutput).toContain('ƒ /api/revalidate-tag') }) diff --git a/test/e2e/app-dir/revalidatetag-rsc/app/actions/revalidate.ts b/test/e2e/app-dir/revalidatetag-rsc/app/actions/revalidate.ts index 6a6ebd56a8800..d8b29d452776e 100644 --- a/test/e2e/app-dir/revalidatetag-rsc/app/actions/revalidate.ts +++ b/test/e2e/app-dir/revalidatetag-rsc/app/actions/revalidate.ts @@ -1,11 +1,11 @@ 'use server' -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' export const revalidate = async ( tag: string ): Promise<{ revalidated: boolean }> => { - expireTag(tag) + unstable_expireTag(tag) return { revalidated: true } } diff --git a/test/e2e/app-dir/revalidatetag-rsc/app/revalidate_via_page/page.tsx b/test/e2e/app-dir/revalidatetag-rsc/app/revalidate_via_page/page.tsx index 1d2d66e5feb7e..e69c73172687b 100644 --- a/test/e2e/app-dir/revalidatetag-rsc/app/revalidate_via_page/page.tsx +++ b/test/e2e/app-dir/revalidatetag-rsc/app/revalidate_via_page/page.tsx @@ -1,7 +1,7 @@ 'use server' import Link from 'next/link' -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' const RevalidateViaPage = async ({ searchParams, @@ -9,7 +9,7 @@ const RevalidateViaPage = async ({ searchParams: Promise<{ tag: string }> }) => { const { tag } = await searchParams - expireTag(tag) + unstable_expireTag(tag) return (
diff --git a/test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts b/test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts index 77039b17a124a..d321f40b65cf6 100644 --- a/test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts +++ b/test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts @@ -1,12 +1,12 @@ import { nextTestSetup } from 'e2e-utils' import { assertHasRedbox, getRedboxHeader, retry } from 'next-test-utils' -describe('expireTag-rsc', () => { +describe('unstable_expireTag-rsc', () => { const { next, isNextDev, isNextDeploy } = nextTestSetup({ files: __dirname, }) - it('should revalidate fetch cache if expireTag invoked via server action', async () => { + it('should revalidate fetch cache if unstable_expireTag invoked via server action', async () => { const browser = await next.browser('/') const randomNumber = await browser.elementById('data').text() await browser.refresh() @@ -23,14 +23,14 @@ describe('expireTag-rsc', () => { if (!isNextDeploy) { // skipped in deploy because it uses `next.cliOutput` - it('should error if expireTag is called during render', async () => { + it('should error if unstable_expireTag is called during render', async () => { const browser = await next.browser('/') await browser.elementByCss('#revalidate-via-page').click() if (isNextDev) { await assertHasRedbox(browser) await expect(getRedboxHeader(browser)).resolves.toContain( - 'Route /revalidate_via_page used "expireTag data"' + 'Route /revalidate_via_page used "unstable_expireTag data"' ) } else { await retry(async () => { @@ -41,7 +41,7 @@ describe('expireTag-rsc', () => { } expect(next.cliOutput).toContain( - 'Route /revalidate_via_page used "expireTag data"' + 'Route /revalidate_via_page used "unstable_expireTag data"' ) }) } diff --git a/test/e2e/app-dir/use-cache/app/cache-tag/buttons.tsx b/test/e2e/app-dir/use-cache/app/cache-tag/buttons.tsx index d24bcc80b4256..2b9ef977ca84c 100644 --- a/test/e2e/app-dir/use-cache/app/cache-tag/buttons.tsx +++ b/test/e2e/app-dir/use-cache/app/cache-tag/buttons.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { expirePath, expireTag } from 'next/cache' +import { unstable_expirePath, unstable_expireTag } from 'next/cache' export function RevalidateButtons() { return ( @@ -8,7 +8,7 @@ export function RevalidateButtons() { id="revalidate-a" formAction={async () => { 'use server' - expireTag('a') + unstable_expireTag('a') }} > revalidate a @@ -17,7 +17,7 @@ export function RevalidateButtons() { id="revalidate-b" formAction={async () => { 'use server' - expireTag('b') + unstable_expireTag('b') }} > revalidate b @@ -26,7 +26,7 @@ export function RevalidateButtons() { id="revalidate-c" formAction={async () => { 'use server' - expireTag('c') + unstable_expireTag('c') }} > revalidate c @@ -35,7 +35,7 @@ export function RevalidateButtons() { id="revalidate-f" formAction={async () => { 'use server' - expireTag('f') + unstable_expireTag('f') }} > revalidate f @@ -44,7 +44,7 @@ export function RevalidateButtons() { id="revalidate-r" formAction={async () => { 'use server' - expireTag('r') + unstable_expireTag('r') }} > revalidate r @@ -53,7 +53,7 @@ export function RevalidateButtons() { id="revalidate-path" formAction={async () => { 'use server' - expirePath('/cache-tag') + unstable_expirePath('/cache-tag') }} > revalidate path diff --git a/test/e2e/app-dir/use-cache/app/form/page.tsx b/test/e2e/app-dir/use-cache/app/form/page.tsx index 4738967c61ca6..212619bef631c 100644 --- a/test/e2e/app-dir/use-cache/app/form/page.tsx +++ b/test/e2e/app-dir/use-cache/app/form/page.tsx @@ -1,8 +1,8 @@ -import { expireTag, unstable_cacheTag as cacheTag } from 'next/cache' +import { unstable_expireTag, unstable_cacheTag as cacheTag } from 'next/cache' async function refresh() { 'use server' - expireTag('home') + unstable_expireTag('home') } export default async function Page() { diff --git a/test/e2e/app-dir/use-cache/use-cache.test.ts b/test/e2e/app-dir/use-cache/use-cache.test.ts index 819f70f418302..124e16c4b13ee 100644 --- a/test/e2e/app-dir/use-cache/use-cache.test.ts +++ b/test/e2e/app-dir/use-cache/use-cache.test.ts @@ -177,12 +177,12 @@ describe('use-cache', () => { // TODO: pending tags handling on deploy if (!isNextDeploy) { - it('should update after expireTag correctly', async () => { + it('should update after unstable_expireTag correctly', async () => { const browser = await next.browser('/cache-tag') const initial = await browser.elementByCss('#a').text() // Bust the ISR cache first, to populate the in-memory cache for the - // subsequent expireTag calls. + // subsequent unstable_expireTag calls. await browser.elementByCss('#revalidate-path').click() await retry(async () => { expect(await browser.elementByCss('#a').text()).not.toBe(initial) @@ -313,7 +313,7 @@ describe('use-cache', () => { }) }) - it('should be able to revalidate a page using expireTag', async () => { + it('should be able to revalidate a page using unstable_expireTag', async () => { const browser = await next.browser(`/form`) const time1 = await browser.waitForElementByCss('#t').text() diff --git a/test/e2e/on-request-error/isr/app/app/self-revalidate/action.js b/test/e2e/on-request-error/isr/app/app/self-revalidate/action.js index 83a7362a25b5a..a588c46c1427c 100644 --- a/test/e2e/on-request-error/isr/app/app/self-revalidate/action.js +++ b/test/e2e/on-request-error/isr/app/app/self-revalidate/action.js @@ -1,7 +1,7 @@ 'use server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function revalidateSelf() { - expirePath('/app/self-revalidate') + unstable_expirePath('/app/self-revalidate') } diff --git a/test/production/app-dir/fetch-cache/app/api/revalidate-alot/route.ts b/test/production/app-dir/fetch-cache/app/api/revalidate-alot/route.ts index 92371c67d8e59..210df2094aaed 100644 --- a/test/production/app-dir/fetch-cache/app/api/revalidate-alot/route.ts +++ b/test/production/app-dir/fetch-cache/app/api/revalidate-alot/route.ts @@ -1,11 +1,11 @@ -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' import { NextRequest, NextResponse } from 'next/server' export const dynamic = 'force-dynamic' export function GET(req: NextRequest) { for (let i = 0; i < 130; i++) { - expireTag(`thankyounext-${i}`) + unstable_expireTag(`thankyounext-${i}`) } return NextResponse.json({ done: true }) } diff --git a/test/production/app-dir/fetch-cache/app/api/revalidate/route.ts b/test/production/app-dir/fetch-cache/app/api/revalidate/route.ts index f00c6ff48658d..e2ef505d76932 100644 --- a/test/production/app-dir/fetch-cache/app/api/revalidate/route.ts +++ b/test/production/app-dir/fetch-cache/app/api/revalidate/route.ts @@ -1,9 +1,9 @@ -import { expireTag } from 'next/cache' +import { unstable_expireTag } from 'next/cache' import { NextRequest, NextResponse } from 'next/server' export const dynamic = 'force-dynamic' export function GET(req: NextRequest) { - expireTag('thankyounext') + unstable_expireTag('thankyounext') return NextResponse.json({ done: true }) } diff --git a/test/production/app-dir/ssg-single-pass/app/revalidate/route.ts b/test/production/app-dir/ssg-single-pass/app/revalidate/route.ts index 57fd02e75cc6b..6394d3d69efff 100644 --- a/test/production/app-dir/ssg-single-pass/app/revalidate/route.ts +++ b/test/production/app-dir/ssg-single-pass/app/revalidate/route.ts @@ -1,8 +1,8 @@ import { NextResponse } from 'next/server' -import { expirePath } from 'next/cache' +import { unstable_expirePath } from 'next/cache' export async function GET() { - expirePath('/') + unstable_expirePath('/') return NextResponse.json({ success: true }) } diff --git a/test/turbopack-build-tests-manifest.json b/test/turbopack-build-tests-manifest.json index 75052eec3f429..f9df5bf5f05ba 100644 --- a/test/turbopack-build-tests-manifest.json +++ b/test/turbopack-build-tests-manifest.json @@ -153,8 +153,8 @@ "app-dir action handling fetch actions should handle calls to redirect() with a relative URL in a single pass", "app-dir action handling fetch actions should handle calls to redirect() with external URLs", "app-dir action handling fetch actions should handle redirects to routes that provide an invalid RSC response", - "app-dir action handling fetch actions should handle expirePath", - "app-dir action handling fetch actions should handle expireTag", + "app-dir action handling fetch actions should handle unstable_expirePath", + "app-dir action handling fetch actions should handle unstable_expireTag", "app-dir action handling fetch actions should invalidate client cache on other routes when cookies.set is called", "app-dir action handling fetch actions should invalidate client cache when path is revalidated", "app-dir action handling fetch actions should invalidate client cache when tag is revalidated", @@ -210,7 +210,7 @@ "app-dir action handling should not expose action content in sourcemaps" ], "pending": [ - "app-dir action handling fetch actions should handle expireTag + redirect", + "app-dir action handling fetch actions should handle unstable_expireTag + redirect", "app-dir action handling server actions render client components client component imported action should support importing client components from actions" ], "flakey": [], @@ -3447,7 +3447,7 @@ }, "test/e2e/app-dir/revalidate-dynamic/revalidate-dynamic.test.ts": { "passed": [ - "app-dir revalidate-dynamic should correctly mark a route handler that uses expireTag as dynamic", + "app-dir revalidate-dynamic should correctly mark a route handler that uses unstable_expireTag as dynamic", "app-dir revalidate-dynamic should revalidate the data with /api/revalidate-path", "app-dir revalidate-dynamic should revalidate the data with /api/revalidate-tag" ], From a168d74f9f36254a59d94695d6cbb0cbc419c5e7 Mon Sep 17 00:00:00 2001 From: YeonHee Date: Thu, 28 Nov 2024 02:01:31 +0900 Subject: [PATCH 65/82] docs(server-actions): add missing formData type (#73257) This PR adds the missing `FormData` type annotation to the formData parameter in the server actions example. Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> --- .../02-data-fetching/03-server-actions-and-mutations.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/01-app/02-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx b/docs/01-app/02-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx index 0082e35548f3c..4b2fce0dfbb62 100644 --- a/docs/01-app/02-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx +++ b/docs/01-app/02-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx @@ -510,7 +510,7 @@ export function Thread({ messages }: { messages: Message[] }) { string >(messages, (state, newMessage) => [...state, { message: newMessage }]) - const formAction = async (formData) => { + const formAction = async (formData: FormData) => { const message = formData.get('message') as string addOptimisticMessage(message) await send(message) From ad8a47acca60b2b6acff67c1dce3257c06599d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 28 Nov 2024 02:10:46 +0900 Subject: [PATCH 66/82] perf(turbopack): Use `ResolvedVc` for `next-api`, part 2 (#73235) ### What? Use `ResolvedVc` instead of `Vc` for struct fields in `next-api`, but split into multiple PRs. ### Why? To reduce scope of changes of each PRs so I can debug HMR failures. ### How? --- crates/next-api/src/app.rs | 19 ++++++++----------- crates/next-api/src/instrumentation.rs | 10 ++++++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/crates/next-api/src/app.rs b/crates/next-api/src/app.rs index 5cf4e741b377b..a8362eb28e3af 100644 --- a/crates/next-api/src/app.rs +++ b/crates/next-api/src/app.rs @@ -678,7 +678,7 @@ pub fn app_entry_point_to_route( AppEndpoint { ty: AppEndpointType::Page { ty: AppPageEndpointType::Html, - loader_tree: *loader_tree, + loader_tree, }, app_project, page: page.clone(), @@ -689,7 +689,7 @@ pub fn app_entry_point_to_route( AppEndpoint { ty: AppEndpointType::Page { ty: AppPageEndpointType::Rsc, - loader_tree: *loader_tree, + loader_tree, }, app_project, page, @@ -707,10 +707,7 @@ pub fn app_entry_point_to_route( original_name: page.to_string(), endpoint: Vc::upcast( AppEndpoint { - ty: AppEndpointType::Route { - path: *path, - root_layouts: *root_layouts, - }, + ty: AppEndpointType::Route { path, root_layouts }, app_project, page, } @@ -755,11 +752,11 @@ enum AppPageEndpointType { enum AppEndpointType { Page { ty: AppPageEndpointType, - loader_tree: Vc, + loader_tree: ResolvedVc, }, Route { - path: Vc, - root_layouts: Vc, + path: ResolvedVc, + root_layouts: ResolvedVc, }, Metadata { metadata: MetadataItem, @@ -843,9 +840,9 @@ impl AppEndpoint { let next_config = self.await?.app_project.project().next_config(); let app_entry = match this.ty { - AppEndpointType::Page { loader_tree, .. } => self.app_page_entry(loader_tree), + AppEndpointType::Page { loader_tree, .. } => self.app_page_entry(*loader_tree), AppEndpointType::Route { path, root_layouts } => { - self.app_route_entry(path, root_layouts, next_config) + self.app_route_entry(*path, *root_layouts, next_config) } AppEndpointType::Metadata { metadata } => { self.app_metadata_entry(metadata, next_config) diff --git a/crates/next-api/src/instrumentation.rs b/crates/next-api/src/instrumentation.rs index 93f518c31d299..2fe8c83411eca 100644 --- a/crates/next-api/src/instrumentation.rs +++ b/crates/next-api/src/instrumentation.rs @@ -41,7 +41,7 @@ pub struct InstrumentationEndpoint { is_edge: bool, app_dir: Option>, - ecmascript_client_reference_transition_name: Option>, + ecmascript_client_reference_transition_name: Option>, } #[turbo_tasks::value_impl] @@ -53,7 +53,7 @@ impl InstrumentationEndpoint { source: ResolvedVc>, is_edge: bool, app_dir: Option>, - ecmascript_client_reference_transition_name: Option>, + ecmascript_client_reference_transition_name: Option>, ) -> Vc { Self { project, @@ -113,7 +113,8 @@ impl InstrumentationEndpoint { Value::new(ServerContextType::Instrumentation { app_dir: this.app_dir, ecmascript_client_reference_transition_name: this - .ecmascript_client_reference_transition_name, + .ecmascript_client_reference_transition_name + .map(|v| *v), }), this.project.next_mode(), ) @@ -165,7 +166,8 @@ impl InstrumentationEndpoint { Value::new(ServerContextType::Instrumentation { app_dir: this.app_dir, ecmascript_client_reference_transition_name: this - .ecmascript_client_reference_transition_name, + .ecmascript_client_reference_transition_name + .map(|v| *v), }), this.project.next_mode(), ) From 29fca4b11a71bf91ee287850dc7c71dcd43d8f96 Mon Sep 17 00:00:00 2001 From: Jam Balaya Date: Thu, 28 Nov 2024 02:22:38 +0900 Subject: [PATCH 67/82] docs: update static-tweet to react-tweet (#73253) ## Description Now that next-tweet has been renamed [react-tweet](https://github.com/vercel/react-tweet), [Static Tweet (Demo)](https://static-tweet.vercel.app/) navigates https://react-tweet.vercel.app. So updated the link. ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> --- .../02-rendering/02-static-site-generation.mdx | 2 +- .../02-building-your-application/03-data-fetching/index.mdx | 2 +- .../02-pages/03-api-reference/03-functions/get-static-paths.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/02-pages/02-building-your-application/02-rendering/02-static-site-generation.mdx b/docs/02-pages/02-building-your-application/02-rendering/02-static-site-generation.mdx index 7de99342d14f4..18fcb28752311 100644 --- a/docs/02-pages/02-building-your-application/02-rendering/02-static-site-generation.mdx +++ b/docs/02-pages/02-building-your-application/02-rendering/02-static-site-generation.mdx @@ -23,7 +23,7 @@ description: Use Static Site Generation (SSG) to pre-render pages at build time. - [Kontent Example](https://github.com/vercel/next.js/tree/canary/examples/cms-kontent-ai) ([Demo](https://next-blog-kontent.vercel.app/)) - [Builder.io Example](https://github.com/vercel/next.js/tree/canary/examples/cms-builder-io) ([Demo](https://cms-builder-io.vercel.app/)) - [TinaCMS Example](https://github.com/vercel/next.js/tree/canary/examples/cms-tina) ([Demo](https://cms-tina-example.vercel.app/)) -- [Static Tweet (Demo)](https://static-tweet.vercel.app/) +- [Static Tweet (Demo)](https://react-tweet.vercel.app/) - [Enterspeed Example](https://github.com/vercel/next.js/tree/canary/examples/cms-enterspeed) ([Demo](https://next-blog-demo.enterspeed.com/)) diff --git a/docs/02-pages/02-building-your-application/03-data-fetching/index.mdx b/docs/02-pages/02-building-your-application/03-data-fetching/index.mdx index 91041ad6f9459..e1f00e05a742c 100644 --- a/docs/02-pages/02-building-your-application/03-data-fetching/index.mdx +++ b/docs/02-pages/02-building-your-application/03-data-fetching/index.mdx @@ -22,5 +22,5 @@ Data fetching in Next.js allows you to render your content in different ways, de - [Storyblok Example](https://github.com/vercel/next.js/tree/canary/examples/cms-storyblok) ([Demo](https://next-blog-storyblok.vercel.app/)) - [GraphCMS Example](https://github.com/vercel/next.js/tree/canary/examples/cms-graphcms) ([Demo](https://next-blog-graphcms.vercel.app/)) - [Kontent Example](https://github.com/vercel/next.js/tree/canary/examples/cms-kontent-ai) ([Demo](https://next-blog-kontent.vercel.app/)) -- [Static Tweet Demo](https://static-tweet.vercel.app/) +- [Static Tweet Demo](https://react-tweet.vercel.app/) - [Enterspeed Example](https://github.com/vercel/next.js/tree/canary/examples/cms-enterspeed) ([Demo](https://next-blog-demo.enterspeed.com/)) diff --git a/docs/02-pages/03-api-reference/03-functions/get-static-paths.mdx b/docs/02-pages/03-api-reference/03-functions/get-static-paths.mdx index 724bda1de3a1b..38a5c984c3586 100644 --- a/docs/02-pages/03-api-reference/03-functions/get-static-paths.mdx +++ b/docs/02-pages/03-api-reference/03-functions/get-static-paths.mdx @@ -152,7 +152,7 @@ export default Post
Examples -- [Static generation of a large number of pages](https://static-tweet.vercel.app) +- [Static generation of a large number of pages](https://react-tweet.vercel.app/)
From d1e554be4c0bac8bf28c84a05065c230cb6f9d80 Mon Sep 17 00:00:00 2001 From: YeonHee Date: Thu, 28 Nov 2024 02:22:50 +0900 Subject: [PATCH 68/82] docs(fetching): `params` to `await params` (#73254) Hi Team. This PR fixes an issue in the examples where the params object was destructured without being awaited. Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> --- .../02-data-fetching/01-fetching.mdx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx b/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx index 42b04aa154c26..c919284b52420 100644 --- a/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx +++ b/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx @@ -417,10 +417,11 @@ There may be cases where you want this pattern because one fetch depends on the ```tsx filename="app/artist/[username]/page.tsx" switcher export default async function Page({ - params: { username }, + params, }: { params: Promise<{ username: string }> }) { + const { username } = await params // Get artist information const artist = await getArtist(username) @@ -451,7 +452,8 @@ async function Playlists({ artistID }: { artistID: string }) { ``` ```jsx filename="app/artist/[username]/page.js" switcher -export default async function Page({ params: { username } }) { +export default async function Page({ params }) { + const { username } = await params // Get artist information const artist = await getArtist(username) @@ -509,10 +511,11 @@ async function getAlbums(username: string) { } export default async function Page({ - params: { username }, + params, }: { params: Promise<{ username: string }> }) { + const { username } = await params const artistData = getArtist(username) const albumsData = getAlbums(username) @@ -541,7 +544,8 @@ async function getAlbums(username) { return res.json() } -export default async function Page({ params: { username } }) { +export default async function Page({ params }) { + const { username } = await params const artistData = getArtist(username) const albumsData = getAlbums(username) @@ -597,10 +601,11 @@ export default async function Item({ id }) { import Item, { preload, checkIsAvailable } from '@/components/Item' export default async function Page({ - params: { id }, + params, }: { params: Promise<{ id: string }> }) { + const { id } = await params // starting loading item data preload(id) // perform another asynchronous task @@ -613,7 +618,8 @@ export default async function Page({ ```jsx filename="app/item/[id]/page.js" switcher import Item, { preload, checkIsAvailable } from '@/components/Item' -export default async function Page({ params: { id } }) { +export default async function Page({ params }) { + const { id } = await params // starting loading item data preload(id) // perform another asynchronous task From 60b96e82be1388ba8d58ad4c6e4fe332ddd33263 Mon Sep 17 00:00:00 2001 From: Jiwon Choi Date: Thu, 28 Nov 2024 02:37:46 +0900 Subject: [PATCH 69/82] Revert "codemod: replace `revalidate(Tag|Path)` to `expire(Tag|Path)`" (#73269) ### Why? Follow-up of https://github.com/vercel/next.js/pull/73193, as we undeprecate revalidate APIs, the codemod should be reverted as well. Fortunately, there were no docs change. Reverts vercel/next.js#72826 --- packages/next-codemod/lib/utils.ts | 6 - .../alias-asterisk.input.ts | 8 -- .../alias-asterisk.output.ts | 8 -- .../import-both-alias-asterisk.input.ts | 8 -- .../import-both-alias-asterisk.output.ts | 8 -- .../import-both-alias-both.input.ts | 8 -- .../import-both-alias-both.output.ts | 8 -- .../import-both-alias-expire.input.ts | 8 -- .../import-both-alias-expire.output.ts | 8 -- .../import-both-alias-revalidate.input.ts | 8 -- .../import-both-alias-revalidate.output.ts | 8 -- .../revalidate-to-expire/import-both.input.ts | 8 -- .../import-both.output.ts | 8 -- .../no-import-next-cache.input.ts | 3 - .../no-import-next-cache.output.ts | 0 .../revalidate-to-expire/no-import.input.ts | 5 - .../revalidate-to-expire/no-import.output.ts | 5 - .../revalidate-to-expire/noop.input.ts | 0 .../revalidate-to-expire/noop.output.ts | 0 .../revalidate-to-expire/path-alias.input.ts | 5 - .../revalidate-to-expire/path-alias.output.ts | 5 - .../revalidate-to-expire/path-basic.input.ts | 5 - .../revalidate-to-expire/path-basic.output.ts | 5 - .../revalidate-to-expire/tag-alias.input.ts | 5 - .../revalidate-to-expire/tag-alias.output.ts | 5 - .../revalidate-to-expire/tag-basic.input.ts | 5 - .../revalidate-to-expire/tag-basic.output.ts | 5 - .../__tests__/revalidate-to-expire.test.js | 16 --- .../transforms/revalidate-to-expire.ts | 130 ------------------ 29 files changed, 301 deletions(-) delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import-next-cache.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import-next-cache.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/noop.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/noop.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.output.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.input.ts delete mode 100644 packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.output.ts delete mode 100644 packages/next-codemod/transforms/__tests__/revalidate-to-expire.test.js delete mode 100644 packages/next-codemod/transforms/revalidate-to-expire.ts diff --git a/packages/next-codemod/lib/utils.ts b/packages/next-codemod/lib/utils.ts index e543df6a6a6f7..5baf18c31c2e7 100644 --- a/packages/next-codemod/lib/utils.ts +++ b/packages/next-codemod/lib/utils.ts @@ -116,10 +116,4 @@ export const TRANSFORMER_INQUIRER_CHOICES = [ value: 'app-dir-runtime-config-experimental-edge', version: '15.0.0-canary.179', }, - { - title: - 'Transform `revalidateTag` and `revalidatePath` to `expireTag` and `expirePath`', - value: 'revalidate-to-expire', - version: '15.0.4-canary.12', - }, ] diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.input.ts deleted file mode 100644 index 046c45378f654..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.input.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as cache from "next/cache"; - -export async function GET() { - cache.revalidatePath("next"); - cache.revalidateTag("next"); - cache["revalidatePath"]("next"); - cache["revalidateTag"]("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.output.ts deleted file mode 100644 index 3242c8ca8b4a3..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/alias-asterisk.output.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as cache from "next/cache"; - -export async function GET() { - cache.expirePath("next"); - cache.expireTag("next"); - cache["expirePath"]("next"); - cache["expireTag"]("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.input.ts deleted file mode 100644 index 9b08bd3bf4d30..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.input.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as cache from "next/cache"; - -export async function GET() { - cache.revalidatePath("next"); - cache.revalidateTag("next"); - cache.expirePath("next"); - cache.expireTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.output.ts deleted file mode 100644 index 316ecda80e921..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-asterisk.output.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as cache from "next/cache"; - -export async function GET() { - cache.expirePath("next"); - cache.expireTag("next"); - cache.expirePath("next"); - cache.expireTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.input.ts deleted file mode 100644 index ef350ef014da0..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.input.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { revalidatePath as revalidatePathAlias, revalidateTag as revalidateTagAlias, expirePath as expirePathAlias, expireTag as expireTagAlias } from "next/cache"; - -export async function GET() { - revalidatePathAlias("next"); - revalidateTagAlias("next"); - expirePathAlias("next"); - expireTagAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.output.ts deleted file mode 100644 index 2a3c45056c5b5..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-both.output.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { expirePath as expirePathAlias, expireTag as expireTagAlias } from "next/cache"; - -export async function GET() { - expirePathAlias("next"); - expireTagAlias("next"); - expirePathAlias("next"); - expireTagAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.input.ts deleted file mode 100644 index 696506e0168f8..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.input.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { revalidatePath, revalidateTag, expirePath as expirePathAlias, expireTag as expireTagAlias } from "next/cache"; - -export async function GET() { - revalidatePath("next"); - revalidateTag("next"); - expirePathAlias("next"); - expireTagAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.output.ts deleted file mode 100644 index 2a3c45056c5b5..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-expire.output.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { expirePath as expirePathAlias, expireTag as expireTagAlias } from "next/cache"; - -export async function GET() { - expirePathAlias("next"); - expireTagAlias("next"); - expirePathAlias("next"); - expireTagAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.input.ts deleted file mode 100644 index ac80be3680ee3..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.input.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { revalidatePath as revalidatePathAlias, revalidateTag as revalidateTagAlias, expirePath, expireTag } from "next/cache"; - -export async function GET() { - revalidatePathAlias("next"); - revalidateTagAlias("next"); - expirePath("next"); - expireTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.output.ts deleted file mode 100644 index 1e41f04b9c736..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both-alias-revalidate.output.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { expirePath, expireTag } from "next/cache"; - -export async function GET() { - expirePath("next"); - expireTag("next"); - expirePath("next"); - expireTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.input.ts deleted file mode 100644 index b9f77036458d5..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.input.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { revalidatePath, revalidateTag, expirePath, expireTag } from "next/cache"; - -export async function GET() { - revalidatePath("next"); - revalidateTag("next"); - expirePath("next"); - expireTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.output.ts deleted file mode 100644 index 1e41f04b9c736..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/import-both.output.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { expirePath, expireTag } from "next/cache"; - -export async function GET() { - expirePath("next"); - expireTag("next"); - expirePath("next"); - expireTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import-next-cache.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import-next-cache.input.ts deleted file mode 100644 index b3809d1d0f6c1..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import-next-cache.input.ts +++ /dev/null @@ -1,3 +0,0 @@ -export async function GET() { - return new Response("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import-next-cache.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import-next-cache.output.ts deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.input.ts deleted file mode 100644 index 6d977c3684a4a..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.input.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { unstable_cacheTag as cacheTag } from "next/cache"; - -export async function GET() { - cacheTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.output.ts deleted file mode 100644 index 6d977c3684a4a..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/no-import.output.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { unstable_cacheTag as cacheTag } from "next/cache"; - -export async function GET() { - cacheTag("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/noop.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/noop.input.ts deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/noop.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/noop.output.ts deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.input.ts deleted file mode 100644 index ea5ff2a462586..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.input.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { revalidatePath as revalidatePathAlias } from "next/cache"; - -export async function GET() { - revalidatePathAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.output.ts deleted file mode 100644 index dd077e3ea283f..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-alias.output.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expirePath as revalidatePathAlias } from "next/cache"; - -export async function GET() { - revalidatePathAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.input.ts deleted file mode 100644 index 20e2faf31af60..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.input.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { revalidatePath } from "next/cache"; - -export async function GET() { - revalidatePath("next"); -} \ No newline at end of file diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.output.ts deleted file mode 100644 index 121a87d596bfc..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/path-basic.output.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expirePath } from "next/cache"; - -export async function GET() { - expirePath("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.input.ts deleted file mode 100644 index 6500cd016cf0f..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.input.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { revalidateTag as revalidateTagAlias } from "next/cache"; - -export async function GET() { - revalidateTagAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.output.ts deleted file mode 100644 index 55590679020f1..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-alias.output.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expireTag as revalidateTagAlias } from "next/cache"; - -export async function GET() { - revalidateTagAlias("next"); -} diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.input.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.input.ts deleted file mode 100644 index 2173e8256c965..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.input.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { revalidateTag } from "next/cache"; - -export async function GET() { - revalidateTag("next"); -} \ No newline at end of file diff --git a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.output.ts b/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.output.ts deleted file mode 100644 index 9b3fb8d9b23ea..0000000000000 --- a/packages/next-codemod/transforms/__testfixtures__/revalidate-to-expire/tag-basic.output.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expireTag } from "next/cache"; - -export async function GET() { - expireTag("next"); -} diff --git a/packages/next-codemod/transforms/__tests__/revalidate-to-expire.test.js b/packages/next-codemod/transforms/__tests__/revalidate-to-expire.test.js deleted file mode 100644 index 90dbfa0e148e7..0000000000000 --- a/packages/next-codemod/transforms/__tests__/revalidate-to-expire.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* global jest */ -jest.autoMockOff() -const defineTest = require('jscodeshift/dist/testUtils').defineTest -const { readdirSync } = require('fs') -const { join } = require('path') - -const fixtureDir = 'revalidate-to-expire' -const fixtureDirPath = join(__dirname, '..', '__testfixtures__', fixtureDir) -const fixtures = readdirSync(fixtureDirPath) - .filter(file => file.endsWith('.input.ts')) - .map(file => file.replace('.input.ts', '')) - -for (const fixture of fixtures) { - const prefix = `${fixtureDir}/${fixture}`; - defineTest(__dirname, fixtureDir, null, prefix, { parser: 'ts' }); -} diff --git a/packages/next-codemod/transforms/revalidate-to-expire.ts b/packages/next-codemod/transforms/revalidate-to-expire.ts deleted file mode 100644 index 37d771679db28..0000000000000 --- a/packages/next-codemod/transforms/revalidate-to-expire.ts +++ /dev/null @@ -1,130 +0,0 @@ -import type { API, FileInfo } from 'jscodeshift' -import { createParserFromPath } from '../lib/parser' - -export default function transformer(file: FileInfo, _api: API) { - const j = createParserFromPath(file.path) - const root = j(file.source) - - if (!root.length) { - return - } - - const nextCacheImports = root.find(j.ImportDeclaration, { - source: { - value: 'next/cache', - }, - }) - - if (!nextCacheImports.length) { - return - } - - let nextCacheNamespace = '' - let revalidatePathName = 'revalidatePath' - let revalidateTagName = 'revalidateTag' - let expirePathName = 'expirePath' - let expireTagName = 'expireTag' - - nextCacheImports.forEach((path) => { - let hasExpirePath = false - let hasExpireTag = false - - // Set the alias name for callee if exists. - path.node.specifiers.forEach((specifier) => { - if (specifier.type === 'ImportSpecifier') { - if (specifier.imported.name === 'expirePath') { - expirePathName = specifier.local?.name ?? 'expirePath' - hasExpirePath = true - } - if (specifier.imported.name === 'expireTag') { - expireTagName = specifier.local?.name ?? 'expireTag' - hasExpireTag = true - } - } - }) - - // Remove the revalidate functions from the import specifiers if - // expire functions are also imported. - path.node.specifiers = path.node.specifiers.filter((specifier) => { - if (specifier.type !== 'ImportSpecifier') { - return true - } - if (hasExpireTag && specifier.imported.name === 'revalidateTag') { - revalidateTagName = specifier.local?.name ?? 'revalidateTag' - return false - } - if (hasExpirePath && specifier.imported.name === 'revalidatePath') { - revalidatePathName = specifier.local?.name ?? 'revalidatePath' - return false - } - return true - }) - - path.node.specifiers.forEach((specifier) => { - if (specifier.type === 'ImportSpecifier') { - if (specifier.imported.name === 'revalidateTag') { - specifier.imported.name = 'expireTag' - } - if (specifier.imported.name === 'revalidatePath') { - specifier.imported.name = 'expirePath' - } - } - - // import * as from 'next/cache' - if (specifier.type === 'ImportNamespaceSpecifier') { - nextCacheNamespace = specifier.local.name - } - }) - }) - - root.find(j.CallExpression).forEach((path) => { - const callee = path.node.callee - - // Handle direct function calls: - // ```ts - // revalidateTag('next') - // revalidatePath('/next') - // ``` - if ( - callee.type === 'Identifier' && - (callee.name === revalidateTagName || callee.name === revalidatePathName) - ) { - callee.name = - callee.name === revalidateTagName ? expireTagName : expirePathName - } - - // Handle namespace calls: - // ```ts - // import * as cache from 'next/cache' - // ``` - if ( - callee.type === 'MemberExpression' && - callee.object.type === 'Identifier' && - callee.object.name === nextCacheNamespace - ) { - // cache.revalidateTag('next') - // cache.revalidatePath('/next') - if ( - callee.property.type === 'Identifier' && - (callee.property.name === 'revalidateTag' || - callee.property.name === 'revalidatePath') - ) { - callee.property.name = - callee.property.name === 'revalidateTag' ? 'expireTag' : 'expirePath' - } - - // cache['revalidateTag']('next') - // cache['revalidatePath']('/next') - if ( - callee.property.type === 'StringLiteral' && - (callee.property.value === 'revalidateTag' || - callee.property.value === 'revalidatePath') - ) { - callee.property.value = - callee.property.value === 'revalidateTag' ? 'expireTag' : 'expirePath' - } - } - }) - - return root.toSource() -} From 7f47d08e8df0af970ac33a8ab7d496af40ccc6b4 Mon Sep 17 00:00:00 2001 From: ovogmap <71624334+ovogmap@users.noreply.github.com> Date: Thu, 28 Nov 2024 02:49:35 +0900 Subject: [PATCH 70/82] convert let keyword to const keyword to data fetching and caching example (#73251) Improving Documentation - I noticed that using const instead of let in the example code for data fetching and caching is more appropriate, so I made the change. ![image](https://github.com/user-attachments/assets/73eb2dd7-386f-44ee-b820-7dbdd6a803eb) Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> --- .../02-data-fetching/01-fetching.mdx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx b/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx index c919284b52420..9dd9d3fd0d6f0 100644 --- a/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx +++ b/docs/01-app/02-building-your-application/02-data-fetching/01-fetching.mdx @@ -19,8 +19,8 @@ Here's a minimal example of data fetching in Next.js: ```tsx filename="app/page.tsx" switcher export default async function Page() { - let data = await fetch('https://api.vercel.app/blog') - let posts = await data.json() + const data = await fetch('https://api.vercel.app/blog') + const posts = await data.json() return (