From eb23134e9b575bf26460e17280aa1d94f90528d6 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 22 Jul 2024 19:25:52 +0200 Subject: [PATCH 01/12] Wait for pending Webpack Hot Updates before evaluating JS from RSC responses (#67673) --- .../app/hot-reloader-client.tsx | 35 ++++++++- .../router-reducer/fetch-server-response.ts | 9 +++ .../new-runtime-functionality/page.tsx | 8 ++ .../app/bundler-runtime-changes/page.tsx | 9 +++ test/development/app-hmr/app/favicon.ico | Bin 0 -> 15086 bytes test/development/app-hmr/hmr.test.ts | 70 +++++++++++++++++- test/development/app-hmr/tsconfig.json | 24 ++++++ 7 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 test/development/app-hmr/app/bundler-runtime-changes/new-runtime-functionality/page.tsx create mode 100644 test/development/app-hmr/app/bundler-runtime-changes/page.tsx create mode 100644 test/development/app-hmr/app/favicon.ico create mode 100644 test/development/app-hmr/tsconfig.json diff --git a/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx b/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx index 9c7a6333a1389..2e4acf86ec8b4 100644 --- a/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx +++ b/packages/next/src/client/components/react-dev-overlay/app/hot-reloader-client.tsx @@ -47,17 +47,35 @@ let __nextDevClientId = Math.round(Math.random() * 100 + Date.now()) let reloading = false let startLatency: number | null = null -function onBeforeFastRefresh(dispatcher: Dispatcher, hasUpdates: boolean) { +let pendingHotUpdateWebpack = Promise.resolve() +let resolvePendingHotUpdateWebpack: () => void = () => {} +function setPendingHotUpdateWebpack() { + pendingHotUpdateWebpack = new Promise((resolve) => { + resolvePendingHotUpdateWebpack = () => { + resolve() + } + }) +} + +export function waitForWebpackRuntimeHotUpdate() { + return pendingHotUpdateWebpack +} + +function handleBeforeHotUpdateWebpack( + dispatcher: Dispatcher, + hasUpdates: boolean +) { if (hasUpdates) { dispatcher.onBeforeRefresh() } } -function onFastRefresh( +function handleSuccessfulHotUpdateWebpack( dispatcher: Dispatcher, sendMessage: (message: string) => void, updatedModules: ReadonlyArray ) { + resolvePendingHotUpdateWebpack() dispatcher.onBuildOk() reportHmrLatency(sendMessage, updatedModules) @@ -159,6 +177,7 @@ function tryApplyUpdates( dispatcher: Dispatcher ) { if (!isUpdateAvailable() || !canApplyUpdates()) { + resolvePendingHotUpdateWebpack() dispatcher.onBuildOk() reportHmrLatency(sendMessage, []) return @@ -281,12 +300,16 @@ function processMessage( } else { tryApplyUpdates( function onBeforeHotUpdate(hasUpdates: boolean) { - onBeforeFastRefresh(dispatcher, hasUpdates) + handleBeforeHotUpdateWebpack(dispatcher, hasUpdates) }, function onSuccessfulHotUpdate(webpackUpdatedModules: string[]) { // Only dismiss it when we're sure it's a hot update. // Otherwise it would flicker right before the reload. - onFastRefresh(dispatcher, sendMessage, webpackUpdatedModules) + handleSuccessfulHotUpdateWebpack( + dispatcher, + sendMessage, + webpackUpdatedModules + ) }, sendMessage, dispatcher @@ -320,6 +343,9 @@ function processMessage( } case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING: { startLatency = Date.now() + if (!process.env.TURBOPACK) { + setPendingHotUpdateWebpack() + } console.log('[Fast Refresh] rebuilding') break } @@ -426,6 +452,7 @@ function processMessage( reloading = true return window.location.reload() } + resolvePendingHotUpdateWebpack() startTransition(() => { router.hmrRefresh() dispatcher.onRefresh() diff --git a/packages/next/src/client/components/router-reducer/fetch-server-response.ts b/packages/next/src/client/components/router-reducer/fetch-server-response.ts index 42f98d1153ee8..3a6db614d15d9 100644 --- a/packages/next/src/client/components/router-reducer/fetch-server-response.ts +++ b/packages/next/src/client/components/router-reducer/fetch-server-response.ts @@ -29,6 +29,7 @@ import { import { callServer } from '../../app-call-server' import { PrefetchKind } from './router-reducer-types' import { hexHash } from '../../../shared/lib/hash' +import { waitForWebpackRuntimeHotUpdate } from '../react-dev-overlay/app/hot-reloader-client' export interface FetchServerResponseOptions { readonly flightRouterState: FlightRouterState @@ -180,6 +181,14 @@ export async function fetchServerResponse( return doMpaNavigation(responseUrl.toString()) } + // We may navigate to a page that requires a different Webpack runtime. + // In prod, every page will have the same Webpack runtime. + // In dev, the Webpack runtime is minimal for each page. + // We need to ensure the Webpack runtime is updated before executing client-side JS of the new page. + if (process.env.NODE_ENV !== 'production' && !process.env.TURBOPACK) { + await waitForWebpackRuntimeHotUpdate() + } + // Handle the `fetch` readable stream that can be unwrapped by `React.use`. const response: NavigationFlightResponse = await createFromFetch( Promise.resolve(res), diff --git a/test/development/app-hmr/app/bundler-runtime-changes/new-runtime-functionality/page.tsx b/test/development/app-hmr/app/bundler-runtime-changes/new-runtime-functionality/page.tsx new file mode 100644 index 0000000000000..f9901dbe10239 --- /dev/null +++ b/test/development/app-hmr/app/bundler-runtime-changes/new-runtime-functionality/page.tsx @@ -0,0 +1,8 @@ +'use client' +// requires +import * as React from 'react' + +export default function RuntimeChangesNewRuntimeFunctionalityPage() { + React.useEffect(() => {}, []) + return
+} diff --git a/test/development/app-hmr/app/bundler-runtime-changes/page.tsx b/test/development/app-hmr/app/bundler-runtime-changes/page.tsx new file mode 100644 index 0000000000000..d5e9c6455dec9 --- /dev/null +++ b/test/development/app-hmr/app/bundler-runtime-changes/page.tsx @@ -0,0 +1,9 @@ +import Link from 'next/link' + +export default function RuntimeChangesPage() { + return ( + + Click me + + ) +} diff --git a/test/development/app-hmr/app/favicon.ico b/test/development/app-hmr/app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..989c61c03ef7077b51d28a35237fc5b89f7ca0f9 GIT binary patch literal 15086 zcmdU$3vg6d9mel&9-9O(AvPcongB(xQc|JND({Cf6{VZjbFo zk9*Gl|DE@9Eh}K9Sr0#KVHaDkbhfPCmSq(ehy8h$b)2v~Y<-`SZdor9p(}AnVod-F zx6K1JR%87JFlfsOSb^5)=!mzgfV%@IAUvzFbSELV1!*4v&w!tS?cfl24^)Bo!7*?E zyb6|r3E&~}mW_SS4SItp?E-!bUI!P!9bi1-Hu3%iwt*?gyFV>0jk;@GgC6M+?}gwL z@WVM?-jtVrf)^0q9=lNtvOk639{{z5cwCYRS6TcOJOxtPPvEXT_*-xjB*W25+H2_e zIcNuxHgF$^5cNkdx>FfvCpsSj$(XN__ykBLFF&#lqPtfj8KB&UknSY#qpvaIYTWfz z4{+~Bn!hyx?oN5^fQzU80QZ)}-Q0w@J9&5+P9bnt1OJ&ss0L2DrebSc(%2f;z+Fow z&G$`(b2Jb2g~C`FNDHQ=5w3AJI!#maKOc)fW#5zV^Pd3z|A1qxb;gTcxEB`}oBsX# zn|}TJr4)Vp_BDBVd0y&T>!qhb#8CFF@Mx}RF#XV>L(Tc~=gqZi*UZ(cS8ZGFL?Id1 zuU|KN_wF@q+O%my9QZtN z%q$$9)A#Jz)0{qiI%Qedwr!iq&CT_!AFgUcV?~~QLk8CGfamnomzg(jUP}01x^&45 z8#c_dZWqs&a9eOGz|y$tOGZ&qkvV+$aMF2LxpJk+$jI=eJIr-6+(STX`-JAK$&)9W zn>TMJoQG4VPMMODl0>*G&3-n6`S5=f_l0nte96*yw|)EeI{dF(xnlP1+hMnJ$tqHtQ(9VTG`2P*r$vhvX3CT)X4I%r4aRLimiTvu|6{~UsQozd)&Jb(?S#j(6<2i< z@4LtFqsS=&pCf*i$27_6OlA5%!}-2oz&`8KxkV~vn~ohjnlWR>n9-w0`&k$G;jopm z&q_~A4{`6!=&w=GiOeNX?<|eS=U6HJU{T)Imva9w2qvd98+0YS&#p!RjZPg?c(tZxdXf#mj@n{f^Q6Gtx6M39oQ- zXqs+&tcj*?`>6xX#Z7q+&)&U$**lrZ&dOmr3(Ui>@hM*YeO%%HgVXmMuJLTvC9Rpy zb~Hi$6YVVFW=RM_bwt_bSyNy8ms;1#&1 z^tAx>P=L%b`0MP;45p?_#;r|AHxW$XBxuy!4FHz53 zvND^ot!-SBk&#J8?0n2ellE?&&Q6Kv&ckK=Z^8Qo%H%<0>i*%LnygS3{X0$VYN&XC z4a|M}AaNXM-1-mDnow;{W5AoV?X|>tj<|i`okv)cF`>**I{UAD>ZTLizChj{6KEGD z@a;f&9&IqCH{+jUP2$tE}e2&l+G^ zTBKM-wKmBSP;-$SvAIR8RJdc4Birw?%k`a}kW$+vzf$rYKRiy#@3I}k87?QM+$fMDeJ4Rp**fK{lCOEERg8#%AYjRb$*ZxF_{}735zyQ@7CZ~4 z0^NW11BD3N*YM-SYb;xBGWwoa=N3or zfo>;H`_bhdA9U{He5+#*88XDooH^6Xm@&gQx_9qhN0v*6%0TU0XOuZuTS3gYx`WhR zq+fIN=u!KeDV|)y*PuHMJc#@Kc=2>bwPM8zU+Q%>J$?H0nE7$((K{-Q>m$KOuJC&4 zRF1k6^lEnR-fiD&-AyLnw1(>geh3=e|IC^-tB!iTOE`P>tkGGd`~FYi9`B&Eq+*RSFf0NS~}nF)2EN=)~%Z-S?HAhXIL};2)n`Z_sY>nJe7Yb<^N6W zySBerGCOqWV9LtM?6JYe`x1BATtsd^^moJdHRohzW*Xh;I%dg|B{AzH7H?OW-WwIN zAJEy^A6?;YjxpWMn>ROm_Uv)gn@yWGCGytbH|#&`wPLsp#MBj!*ZA?{&9P(0%#kBU z%!m;qe5FO^Eie|?hC28xj^n_y9JTlM?c1BSZQCYN_6O0~rbc_sFa9}x^d}Kl{qFlU zT5Er)i$Z*F1J7lUVB9}2>*d#Ku60ocdT(_uLAhRdzlZK#wHoWXa&z;b5ST#dhro+G zKXJ%c;EB2#>-*T3YfhfPmsFO+33QLl%<^^y#F>lAVF(=59+FuTs;#|-?nkkG8#uHD zvq?z3`QjnHN6@SD813N_Hkp}v3Ki6Ujt!$s#2jA;*Lph*>ucb3a2-VVVb$#p@D&gQ5fe^3l>p7%(dnZ7I>(&^+-*Sp z-%DCYmiEEoA=4V{0roeo%hS`->%j?k;$d$GDv$31JHO<^Oq({%Y~8xmY~H-N4)hLe z+_-U$e%Wf*-vVnuBwYKVix)3O)&Pz}??-#|=n;t*PO}{Q4R?BRU$$(SIdtfdS-g0$ zS-Nzo{kA2}+qqXsyW5>!?pCc@*>8B1ANq#v)*H9zc=(mRB1X8;eZ1cD>8;sa?&H<2 zCIXsqZ5ha|wa~_m8_oLl>up)l-|?$GjfSJ<`?q3zH~IPbcY9;KlP2_O(#dG8sLA~-IOl?ecJv`iBaMm|`Q+pl{ rR)b2g3;YT^#kT_NI;MI6q;ok>Wpt|~7v=OSA=)_MilewnqqP4APe-+J literal 0 HcmV?d00001 diff --git a/test/development/app-hmr/hmr.test.ts b/test/development/app-hmr/hmr.test.ts index ebe2d56a934c7..b143b42863ece 100644 --- a/test/development/app-hmr/hmr.test.ts +++ b/test/development/app-hmr/hmr.test.ts @@ -99,7 +99,7 @@ describe(`app-dir-hmr`, () => { 'window.__TEST_NO_RELOAD === undefined' ) // Used to be flaky but presumably no longer is. - // If this flakes again, please add the received value as a commnet. + // If this flakes again, please add the received value as a comment. expect({ envValue, mpa }).toEqual({ envValue: 'ipad', mpa: false, @@ -245,5 +245,73 @@ describe(`app-dir-hmr`, () => { it('should have no unexpected action error for hmr', async () => { expect(next.cliOutput).not.toContain('Unexpected action') }) + + it('can navigate cleanly to a page that requires a change in the Webpack runtime', async () => { + // This isn't a very accurate test since the Webpack runtime is somewhat an implementation detail. + // To ensure this is still valid, check the `*/webpack.*.hot-update.js` network response content when the navigation is triggered. + // If there is new functionality added, the test is still valid. + // If not, the test doesn't cover anything new. + // TODO: Enforce console.error assertions or MPA navigation assertions in all tests instead. + const browser = await next.browser('/bundler-runtime-changes') + await browser.eval('window.__TEST_NO_RELOAD = true') + + await browser + .elementByCss('a') + .click() + .waitForElementByCss('[data-testid="new-runtime-functionality-page"]') + + const logs = await browser.log() + // TODO: Should assert on all logs but these are cluttered with logs from our test utils (e.g. playwright tracing or webdriver) + if (process.env.TURBOPACK) { + // FIXME: logging "rebuilding" multiple times instead of closing it of with "done in" + // Should just not branch here and have the same logs as Webpack. + expect(logs).toEqual( + expect.arrayContaining([ + { + message: '[Fast Refresh] rebuilding', + source: 'log', + }, + { + message: '[Fast Refresh] rebuilding', + source: 'log', + }, + { + message: '[Fast Refresh] rebuilding', + source: 'log', + }, + ]) + ) + expect(logs).not.toEqual( + expect.arrayContaining([ + { + message: expect.stringContaining('[Fast Refresh] done in'), + source: 'log', + }, + ]) + ) + } else { + expect(logs).toEqual( + expect.arrayContaining([ + { + message: '[Fast Refresh] rebuilding', + source: 'log', + }, + { + message: expect.stringContaining('[Fast Refresh] done in'), + source: 'log', + }, + ]) + ) + expect(logs).not.toEqual( + expect.arrayContaining([ + expect.objectContaining({ + source: 'error', + }), + ]) + ) + } + // No MPA navigation triggered + expect(await browser.eval('window.__TEST_NO_RELOAD')).toEqual(true) + }) }) }) diff --git a/test/development/app-hmr/tsconfig.json b/test/development/app-hmr/tsconfig.json new file mode 100644 index 0000000000000..1d4f624eff7d9 --- /dev/null +++ b/test/development/app-hmr/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": false, + "noEmit": true, + "incremental": true, + "module": "esnext", + "esModuleInterop": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "plugins": [ + { + "name": "next" + } + ] + }, + "include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} From 0dfcdea234f2a9f9df29b80037c8d40e4f059223 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 22 Jul 2024 20:02:20 +0200 Subject: [PATCH 02/12] Label React syncs in GitHub with `type: react-sync` (#67710) --- .github/.react-version | 1 + .github/labeler.json | 3 ++- scripts/sync-react.js | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .github/.react-version diff --git a/.github/.react-version b/.github/.react-version new file mode 100644 index 0000000000000..2de43dcf77c1f --- /dev/null +++ b/.github/.react-version @@ -0,0 +1 @@ +19.0.0-rc-6230622a1a-20240610 \ No newline at end of file diff --git a/.github/labeler.json b/.github/labeler.json index 0f1575da620bb..c0c57e7820161 100644 --- a/.github/labeler.json +++ b/.github/labeler.json @@ -71,6 +71,7 @@ "packages/next-swc/**", "packages/next/**", "packages/react-refresh-utils/**" - ] + ], + "type: react-sync": [".github/.react-version"] } } diff --git a/scripts/sync-react.js b/scripts/sync-react.js index 011755bbf52af..7fd91473520ae 100644 --- a/scripts/sync-react.js +++ b/scripts/sync-react.js @@ -177,6 +177,8 @@ Or run this command again without the --no-install flag to do both automatically ) } + await fsp.writeFile(path.join(cwd, '.github/.react-version'), newVersionStr) + console.log( `Successfully updated React from ${baseSha} to ${newSha}.\n` + `Don't forget to find & replace all references to the React version '${baseVersionStr}' with '${newVersionStr}':\n` + From 6dfa1c56241422bf08bd40b035863fd668070884 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 22 Jul 2024 21:24:13 +0200 Subject: [PATCH 03/12] Stop handling hydration errors from unsupported React versions (#67903) --- .../component-stack-pseudo-html.tsx | 2 +- .../internal/helpers/hydration-error-info.ts | 22 ++----------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/packages/next/src/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.tsx b/packages/next/src/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.tsx index 58b2e2d199665..6b2c858d6f346 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.tsx +++ b/packages/next/src/client/components/react-dev-overlay/internal/container/RuntimeError/component-stack-pseudo-html.tsx @@ -66,7 +66,7 @@ export function PseudoHtmlDiff({ firstContent: string secondContent: string reactOutputComponentDiff: string | undefined - hydrationMismatchType: 'tag' | 'text' | 'text-in-tag' + hydrationMismatchType: 'tag' | 'text' } & React.HTMLAttributes) { const isHtmlTagsWarning = hydrationMismatchType === 'tag' const isReactHydrationDiff = !!reactOutputComponentDiff diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts b/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts index 5596f7dde95e1..67f93a4ad3070 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts +++ b/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts @@ -21,35 +21,17 @@ const htmlTagsWarnings = new Set([ 'Warning: In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s', 'Warning: In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.', "Warning: In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.", - 'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s', - 'Warning: Did not expect server HTML to contain a <%s> in <%s>.%s', ]) -const textAndTagsMismatchWarnings = new Set([ - 'Warning: Expected server HTML to contain a matching text node for "%s" in <%s>.%s', - 'Warning: Did not expect server HTML to contain the text node "%s" in <%s>.%s', -]) -const textMismatchWarning = - 'Warning: Text content did not match. Server: "%s" Client: "%s"%s' -export const getHydrationWarningType = ( - msg: NullableText -): 'tag' | 'text' | 'text-in-tag' => { +export const getHydrationWarningType = (msg: NullableText): 'tag' | 'text' => { if (isHtmlTagsWarning(msg)) return 'tag' - if (isTextInTagsMismatchWarning(msg)) return 'text-in-tag' return 'text' } const isHtmlTagsWarning = (msg: NullableText) => Boolean(msg && htmlTagsWarnings.has(msg)) -const isTextMismatchWarning = (msg: NullableText) => textMismatchWarning === msg -const isTextInTagsMismatchWarning = (msg: NullableText) => - Boolean(msg && textAndTagsMismatchWarnings.has(msg)) - -const isKnownHydrationWarning = (msg: NullableText) => - isHtmlTagsWarning(msg) || - isTextInTagsMismatchWarning(msg) || - isTextMismatchWarning(msg) +const isKnownHydrationWarning = (msg: NullableText) => isHtmlTagsWarning(msg) export const getReactHydrationDiffSegments = (msg: NullableText) => { if (msg) { From 4b4593c4a8a71ec131ec6571c7c663ec16d36a0f Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:15:09 +0200 Subject: [PATCH 04/12] Remove stray heading in error page (#68025) It currently looks like this Bildschirmfoto 2024-07-22 um 10 09 05 --- errors/missing-root-layout-tags.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/errors/missing-root-layout-tags.mdx b/errors/missing-root-layout-tags.mdx index 82feae6993e59..4becf81f873f1 100644 --- a/errors/missing-root-layout-tags.mdx +++ b/errors/missing-root-layout-tags.mdx @@ -2,8 +2,6 @@ title: Missing Root Layout tags --- -## `` - #### Why This Error Occurred You forgot to define the `` and/or `` tags in your Root Layout. From cc0193b474b9759453c5fc7f672302b69a6b8aa0 Mon Sep 17 00:00:00 2001 From: vercel-release-bot Date: Mon, 22 Jul 2024 23:23:03 +0000 Subject: [PATCH 05/12] v15.0.0-canary.77 --- 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 | 12 ++++++------ packages/react-refresh-utils/package.json | 2 +- packages/third-parties/package.json | 4 ++-- pnpm-lock.yaml | 14 +++++++------- 17 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lerna.json b/lerna.json index 3e8b6ba2a4395..cd631d9f88914 100644 --- a/lerna.json +++ b/lerna.json @@ -16,5 +16,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "15.0.0-canary.76" + "version": "15.0.0-canary.77" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 54d55de8d6f5d..7d513acd63754 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.0-canary.76", + "version": "15.0.0-canary.77", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index 061198d43bec4..93fb25c3eaa9d 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.0-canary.76", + "version": "15.0.0-canary.77", "description": "ESLint configuration used by Next.js.", "main": "index.js", "license": "MIT", @@ -10,7 +10,7 @@ }, "homepage": "https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-config", "dependencies": { - "@next/eslint-plugin-next": "15.0.0-canary.76", + "@next/eslint-plugin-next": "15.0.0-canary.77", "@rushstack/eslint-patch": "^1.3.3", "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0", "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index fc2c69de07135..e4028e77a84b6 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.0-canary.76", + "version": "15.0.0-canary.77", "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 7d4fb031d69a2..7910e03774744 100644 --- a/packages/font/package.json +++ b/packages/font/package.json @@ -1,7 +1,7 @@ { "name": "@next/font", "private": true, - "version": "15.0.0-canary.76", + "version": "15.0.0-canary.77", "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 9014ed6d37d90..6bb97fb01ea18 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.0-canary.76", + "version": "15.0.0-canary.77", "main": "index.js", "types": "index.d.ts", "license": "MIT", diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 9ca1e534269a2..abdb32389310d 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "15.0.0-canary.76", + "version": "15.0.0-canary.77", "license": "MIT", "repository": { "type": "git", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 6190c1bb5cd58..da41a702fff81 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "15.0.0-canary.76", + "version": "15.0.0-canary.77", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 674d163f057b2..36fd11ce61e98 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "15.0.0-canary.76", + "version": "15.0.0-canary.77", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 4494f96754bba..b1f5ba42bf5ac 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.0-canary.76", + "version": "15.0.0-canary.77", "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 0ea71299590ad..0d2ef0a819b4c 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.0-canary.76", + "version": "15.0.0-canary.77", "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 0ce93f278deab..4968c152e4d7b 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.0-canary.76", + "version": "15.0.0-canary.77", "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 5ea00b28b765d..ef1efe9fab52f 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "15.0.0-canary.76", + "version": "15.0.0-canary.77", "private": true, "scripts": { "clean": "node ../../scripts/rm.mjs native", diff --git a/packages/next/package.json b/packages/next/package.json index 3c143fde3693f..0e9152ec8c988 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "15.0.0-canary.76", + "version": "15.0.0-canary.77", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -93,7 +93,7 @@ ] }, "dependencies": { - "@next/env": "15.0.0-canary.76", + "@next/env": "15.0.0-canary.77", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.12", "busboy": "1.6.0", @@ -158,10 +158,10 @@ "@jest/types": "29.5.0", "@mswjs/interceptors": "0.23.0", "@napi-rs/triples": "1.2.0", - "@next/polyfill-module": "15.0.0-canary.76", - "@next/polyfill-nomodule": "15.0.0-canary.76", - "@next/react-refresh-utils": "15.0.0-canary.76", - "@next/swc": "15.0.0-canary.76", + "@next/polyfill-module": "15.0.0-canary.77", + "@next/polyfill-nomodule": "15.0.0-canary.77", + "@next/react-refresh-utils": "15.0.0-canary.77", + "@next/swc": "15.0.0-canary.77", "@opentelemetry/api": "1.6.0", "@playwright/test": "1.41.2", "@swc/core": "1.7.0-nightly-20240714.1", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index eb043e5acf2d0..27e4dde0a9251 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.0-canary.76", + "version": "15.0.0-canary.77", "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 689f5a12f3eab..27d1732d9d3ba 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -1,6 +1,6 @@ { "name": "@next/third-parties", - "version": "15.0.0-canary.76", + "version": "15.0.0-canary.77", "repository": { "url": "vercel/next.js", "directory": "packages/third-parties" @@ -26,7 +26,7 @@ "third-party-capital": "1.0.20" }, "devDependencies": { - "next": "15.0.0-canary.76", + "next": "15.0.0-canary.77", "outdent": "0.8.0", "prettier": "2.5.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e24b810dabdfe..fa74628bfe5f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -783,7 +783,7 @@ importers: packages/eslint-config-next: dependencies: '@next/eslint-plugin-next': - specifier: 15.0.0-canary.76 + specifier: 15.0.0-canary.77 version: link:../eslint-plugin-next '@rushstack/eslint-patch': specifier: ^1.3.3 @@ -844,7 +844,7 @@ importers: packages/next: dependencies: '@next/env': - specifier: 15.0.0-canary.76 + specifier: 15.0.0-canary.77 version: link:../next-env '@swc/counter': specifier: 0.1.3 @@ -975,16 +975,16 @@ importers: specifier: 1.2.0 version: 1.2.0 '@next/polyfill-module': - specifier: 15.0.0-canary.76 + specifier: 15.0.0-canary.77 version: link:../next-polyfill-module '@next/polyfill-nomodule': - specifier: 15.0.0-canary.76 + specifier: 15.0.0-canary.77 version: link:../next-polyfill-nomodule '@next/react-refresh-utils': - specifier: 15.0.0-canary.76 + specifier: 15.0.0-canary.77 version: link:../react-refresh-utils '@next/swc': - specifier: 15.0.0-canary.76 + specifier: 15.0.0-canary.77 version: link:../next-swc '@opentelemetry/api': specifier: 1.6.0 @@ -1597,7 +1597,7 @@ importers: version: 1.0.20 devDependencies: next: - specifier: 15.0.0-canary.76 + specifier: 15.0.0-canary.77 version: link:../next outdent: specifier: 0.8.0 From 9caa2fdc4dd43b6a967abc14148fede87789baa2 Mon Sep 17 00:00:00 2001 From: Lee Robinson Date: Mon, 22 Jul 2024 18:45:53 -0500 Subject: [PATCH 06/12] docs: update sitemap version history (#68009) Closes https://github.com/vercel/next.js/issues/67834. --- .../02-file-conventions/01-metadata/sitemap.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/02-app/02-api-reference/02-file-conventions/01-metadata/sitemap.mdx b/docs/02-app/02-api-reference/02-file-conventions/01-metadata/sitemap.mdx index 54cc76a354999..8a10c89579c09 100644 --- a/docs/02-app/02-api-reference/02-file-conventions/01-metadata/sitemap.mdx +++ b/docs/02-app/02-api-reference/02-file-conventions/01-metadata/sitemap.mdx @@ -293,8 +293,8 @@ type Sitemap = Array<{ ## Version History -| Version | Changes | -| --------- | ------------------------------------------------------------ | -| `v14.2.0` | Add localizations support. | -| `v13.4.5` | Add `changeFrequency` and `priority` attributes to sitemaps. | -| `v13.3.0` | `sitemap` introduced. | +| Version | Changes | +| ---------- | ------------------------------------------------------------ | +| `v14.2.0` | Add localizations support. | +| `v13.4.14` | Add `changeFrequency` and `priority` attributes to sitemaps. | +| `v13.3.0` | `sitemap` introduced. | From 668f8edb0ea47d578c6389a1d6df8fe902dec55c Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Tue, 23 Jul 2024 10:54:10 +0200 Subject: [PATCH 07/12] Update React from 6230622a1a-20240610 to dfd30974ab-20240613 (#66711) --- .github/.react-version | 2 +- examples/reproduction-template/package.json | 4 +- package.json | 34 +- packages/create-next-app/templates/index.ts | 4 +- packages/next/package.json | 4 +- .../internal/helpers/hydration-error-info.ts | 8 +- .../cjs/react-dom-client.development.js | 62566 ++++++--------- .../cjs/react-dom-client.production.js | 476 +- .../cjs/react-dom-profiling.development.js | 63385 ++++++--------- .../cjs/react-dom-profiling.profiling.js | 520 +- ...t-dom-server-legacy.browser.development.js | 21073 +++-- ...ct-dom-server-legacy.browser.production.js | 96 +- ...eact-dom-server-legacy.node.development.js | 21073 +++-- ...react-dom-server-legacy.node.production.js | 96 +- .../react-dom-server.browser.development.js | 21975 +++--- .../react-dom-server.browser.production.js | 141 +- .../cjs/react-dom-server.bun.production.js | 138 +- .../cjs/react-dom-server.edge.development.js | 22008 +++--- .../cjs/react-dom-server.edge.production.js | 100 +- .../cjs/react-dom-server.node.development.js | 21745 +++--- .../cjs/react-dom-server.node.production.js | 99 +- .../react-dom-unstable_testing.development.js | 63715 ++++++---------- .../react-dom-unstable_testing.production.js | 476 +- .../cjs/react-dom.development.js | 1034 +- .../cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 741 +- .../cjs/react-dom.react-server.production.js | 2 +- .../react-dom-experimental/package.json | 8 +- .../cjs/react-dom-client.development.js | 61748 ++++++--------- .../cjs/react-dom-client.production.js | 474 +- .../cjs/react-dom-profiling.development.js | 62671 ++++++--------- .../cjs/react-dom-profiling.profiling.js | 518 +- ...t-dom-server-legacy.browser.development.js | 19965 ++--- ...ct-dom-server-legacy.browser.production.js | 96 +- ...eact-dom-server-legacy.node.development.js | 19965 ++--- ...react-dom-server-legacy.node.production.js | 96 +- .../react-dom-server.browser.development.js | 20256 +++-- .../react-dom-server.browser.production.js | 154 +- .../cjs/react-dom-server.bun.production.js | 138 +- .../cjs/react-dom-server.edge.development.js | 20291 +++-- .../cjs/react-dom-server.edge.production.js | 100 +- .../cjs/react-dom-server.node.development.js | 20082 ++--- .../cjs/react-dom-server.node.production.js | 146 +- .../react-dom/cjs/react-dom.development.js | 1030 +- .../react-dom/cjs/react-dom.production.js | 2 +- .../cjs/react-dom.react-server.development.js | 737 +- .../cjs/react-dom.react-server.production.js | 2 +- .../next/src/compiled/react-dom/package.json | 8 +- .../cjs/react-compiler-runtime.development.js | 114 +- .../cjs/react-jsx-dev-runtime.development.js | 1139 +- ...sx-dev-runtime.react-server.development.js | 1202 +- .../cjs/react-jsx-runtime.development.js | 1162 +- ...ct-jsx-runtime.react-server.development.js | 1202 +- .../cjs/react.development.js | 3458 +- .../cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 2711 +- .../cjs/react.react-server.production.js | 2 +- .../react-is/cjs/react-is.development.js | 305 +- .../next/src/compiled/react-is/package.json | 2 +- ...om-turbopack-client.browser.development.js | 5732 +- ...dom-turbopack-client.browser.production.js | 278 +- ...r-dom-turbopack-client.edge.development.js | 6222 +- ...er-dom-turbopack-client.edge.production.js | 281 +- ...r-dom-turbopack-client.node.development.js | 6107 +- ...er-dom-turbopack-client.node.production.js | 260 +- ...opack-client.node.unbundled.development.js | 6038 +- ...bopack-client.node.unbundled.production.js | 260 +- ...om-turbopack-server.browser.development.js | 9255 +-- ...dom-turbopack-server.browser.production.js | 420 +- ...r-dom-turbopack-server.edge.development.js | 9340 +-- ...er-dom-turbopack-server.edge.production.js | 403 +- ...r-dom-turbopack-server.node.development.js | 9570 +-- ...er-dom-turbopack-server.node.production.js | 404 +- ...opack-server.node.unbundled.development.js | 9465 +-- ...bopack-server.node.unbundled.production.js | 404 +- .../package.json | 4 +- ...om-turbopack-client.browser.development.js | 5166 +- ...dom-turbopack-client.browser.production.js | 278 +- ...r-dom-turbopack-client.edge.development.js | 5656 +- ...er-dom-turbopack-client.edge.production.js | 281 +- ...r-dom-turbopack-client.node.development.js | 5577 +- ...er-dom-turbopack-client.node.production.js | 260 +- ...opack-client.node.unbundled.development.js | 5462 +- ...bopack-client.node.unbundled.production.js | 260 +- ...om-turbopack-server.browser.development.js | 8509 +-- ...dom-turbopack-server.browser.production.js | 360 +- ...r-dom-turbopack-server.edge.development.js | 8557 +-- ...er-dom-turbopack-server.edge.production.js | 343 +- ...r-dom-turbopack-server.node.development.js | 8780 +-- ...er-dom-turbopack-server.node.production.js | 344 +- ...opack-server.node.unbundled.development.js | 8675 +-- ...bopack-server.node.unbundled.production.js | 344 +- .../react-server-dom-turbopack/package.json | 4 +- ...-dom-webpack-client.browser.development.js | 5784 +- ...r-dom-webpack-client.browser.production.js | 278 +- ...ver-dom-webpack-client.edge.development.js | 6225 +- ...rver-dom-webpack-client.edge.production.js | 281 +- ...ver-dom-webpack-client.node.development.js | 6110 +- ...rver-dom-webpack-client.node.production.js | 260 +- ...bpack-client.node.unbundled.development.js | 6038 +- ...ebpack-client.node.unbundled.production.js | 260 +- ...-dom-webpack-server.browser.development.js | 9299 +-- ...r-dom-webpack-server.browser.production.js | 420 +- ...ver-dom-webpack-server.edge.development.js | 9353 +-- ...rver-dom-webpack-server.edge.production.js | 403 +- ...ver-dom-webpack-server.node.development.js | 9585 +-- ...rver-dom-webpack-server.node.production.js | 404 +- ...bpack-server.node.unbundled.development.js | 9477 +-- ...ebpack-server.node.unbundled.production.js | 404 +- .../package.json | 4 +- ...-dom-webpack-client.browser.development.js | 5204 +- ...r-dom-webpack-client.browser.production.js | 278 +- ...ver-dom-webpack-client.edge.development.js | 5659 +- ...rver-dom-webpack-client.edge.production.js | 281 +- ...ver-dom-webpack-client.node.development.js | 5580 +- ...rver-dom-webpack-client.node.production.js | 260 +- ...bpack-client.node.unbundled.development.js | 5462 +- ...ebpack-client.node.unbundled.production.js | 260 +- ...-dom-webpack-server.browser.development.js | 8553 +-- ...r-dom-webpack-server.browser.production.js | 360 +- ...ver-dom-webpack-server.edge.development.js | 8572 +-- ...rver-dom-webpack-server.edge.production.js | 343 +- ...ver-dom-webpack-server.node.development.js | 8795 +-- ...rver-dom-webpack-server.node.production.js | 344 +- ...bpack-server.node.unbundled.development.js | 8687 +-- ...ebpack-server.node.unbundled.production.js | 344 +- .../react-server-dom-webpack/package.json | 4 +- .../cjs/react-compiler-runtime.development.js | 110 +- .../cjs/react-jsx-dev-runtime.development.js | 1859 +- ...sx-dev-runtime.react-server.development.js | 1904 +- .../cjs/react-jsx-runtime.development.js | 1873 +- ...ct-jsx-runtime.react-server.development.js | 1904 +- .../compiled/react/cjs/react.development.js | 4257 +- .../compiled/react/cjs/react.production.js | 2 +- .../cjs/react.react-server.development.js | 3131 +- .../cjs/react.react-server.production.js | 2 +- .../scheduler-unstable_mock.development.js | 1080 +- ...cheduler-unstable_post_task.development.js | 337 +- .../cjs/scheduler.development.js | 933 +- .../cjs/scheduler.native.development.js | 831 +- .../scheduler-unstable_mock.development.js | 1080 +- ...cheduler-unstable_post_task.development.js | 337 +- .../scheduler/cjs/scheduler.development.js | 933 +- .../cjs/scheduler.native.development.js | 831 +- .../next/src/compiled/unistore/unistore.js | 2 +- pnpm-lock.yaml | 448 +- run-tests.js | 3 +- test/.stats-app/package.json | 4 +- .../app-dir/dynamic-error-trace/index.test.ts | 7 +- test/e2e/app-dir/app-css/index.test.ts | 46 +- .../first-time-setup-js/package.json | 4 +- test/lib/next-modes/base.ts | 2 +- 152 files changed, 321971 insertions(+), 488122 deletions(-) diff --git a/.github/.react-version b/.github/.react-version index 2de43dcf77c1f..2818c978d4b77 100644 --- a/.github/.react-version +++ b/.github/.react-version @@ -1 +1 @@ -19.0.0-rc-6230622a1a-20240610 \ No newline at end of file +19.0.0-rc-dfd30974ab-20240613 \ No newline at end of file diff --git a/examples/reproduction-template/package.json b/examples/reproduction-template/package.json index 9c0776817d8a6..42c43bfdaf725 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.0", - "react-dom": "19.0.0-rc.0" + "react": "19.0.0-rc-dfd30974ab-20240613", + "react-dom": "19.0.0-rc-dfd30974ab-20240613" }, "devDependencies": { "@types/node": "20.12.12", diff --git a/package.json b/package.json index e137c3e332de3..6546d17d7f829 100644 --- a/package.json +++ b/package.json @@ -200,19 +200,19 @@ "pretty-bytes": "5.3.0", "pretty-ms": "7.0.0", "random-seed": "0.3.0", - "react": "19.0.0-rc-6230622a1a-20240610", + "react": "19.0.0-rc-dfd30974ab-20240613", "react-17": "npm:react@17.0.2", - "react-builtin": "npm:react@19.0.0-rc-6230622a1a-20240610", - "react-dom": "19.0.0-rc-6230622a1a-20240610", + "react-builtin": "npm:react@19.0.0-rc-dfd30974ab-20240613", + "react-dom": "19.0.0-rc-dfd30974ab-20240613", "react-dom-17": "npm:react-dom@17.0.2", - "react-dom-builtin": "npm:react-dom@19.0.0-rc-6230622a1a-20240610", - "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-6230622a1a-20240610", - "react-experimental-builtin": "npm:react@0.0.0-experimental-6230622a1a-20240610", - "react-is-builtin": "npm:react-is@19.0.0-rc-6230622a1a-20240610", - "react-server-dom-turbopack": "19.0.0-rc-6230622a1a-20240610", - "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-6230622a1a-20240610", - "react-server-dom-webpack": "19.0.0-rc-6230622a1a-20240610", - "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-6230622a1a-20240610", + "react-dom-builtin": "npm:react-dom@19.0.0-rc-dfd30974ab-20240613", + "react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-dfd30974ab-20240613", + "react-experimental-builtin": "npm:react@0.0.0-experimental-dfd30974ab-20240613", + "react-is-builtin": "npm:react-is@19.0.0-rc-dfd30974ab-20240613", + "react-server-dom-turbopack": "19.0.0-rc-dfd30974ab-20240613", + "react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-dfd30974ab-20240613", + "react-server-dom-webpack": "19.0.0-rc-dfd30974ab-20240613", + "react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-dfd30974ab-20240613", "react-ssr-prepass": "1.0.8", "react-virtualized": "9.22.3", "relay-compiler": "13.0.2", @@ -222,8 +222,8 @@ "resolve-from": "5.0.0", "sass": "1.54.0", "satori": "0.10.9", - "scheduler-builtin": "npm:scheduler@0.25.0-rc-6230622a1a-20240610", - "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-6230622a1a-20240610", + "scheduler-builtin": "npm:scheduler@0.25.0-rc-dfd30974ab-20240613", + "scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-dfd30974ab-20240613", "seedrandom": "3.0.5", "semver": "7.3.7", "shell-quote": "1.7.3", @@ -257,10 +257,10 @@ "@babel/traverse": "7.22.5", "@types/react": "npm:types-react@19.0.0-rc.0", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.0", - "react": "19.0.0-rc-6230622a1a-20240610", - "react-dom": "19.0.0-rc-6230622a1a-20240610", - "react-is": "19.0.0-rc-6230622a1a-20240610", - "scheduler": "0.25.0-rc-6230622a1a-20240610" + "react": "19.0.0-rc-dfd30974ab-20240613", + "react-dom": "19.0.0-rc-dfd30974ab-20240613", + "react-is": "19.0.0-rc-dfd30974ab-20240613", + "scheduler": "0.25.0-rc-dfd30974ab-20240613" }, "engines": { "node": ">=18.18.0", diff --git a/packages/create-next-app/templates/index.ts b/packages/create-next-app/templates/index.ts index 1d54f8ae0e63c..7523e1050f903 100644 --- a/packages/create-next-app/templates/index.ts +++ b/packages/create-next-app/templates/index.ts @@ -184,8 +184,8 @@ export const installTemplate = async ({ * Default dependencies. */ dependencies: { - react: "19.0.0-rc.0", - "react-dom": "19.0.0-rc.0", + react: "19.0.0-rc-dfd30974ab-20240613", + "react-dom": "19.0.0-rc-dfd30974ab-20240613", next: version, }, devDependencies: {}, diff --git a/packages/next/package.json b/packages/next/package.json index 0e9152ec8c988..70e1557cb7115 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -106,8 +106,8 @@ "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", "babel-plugin-react-compiler": "*", - "react": "19.0.0-rc.0", - "react-dom": "19.0.0-rc.0", + "react": "19.0.0-rc-dfd30974ab-20240613", + "react-dom": "19.0.0-rc-dfd30974ab-20240613", "sass": "^1.3.0" }, "peerDependenciesMeta": { diff --git a/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts b/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts index 67f93a4ad3070..f99a6e41c55d0 100644 --- a/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts +++ b/packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts @@ -17,10 +17,10 @@ export const hydrationErrorState: HydrationErrorState = {} // https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference const htmlTagsWarnings = new Set([ - 'Warning: In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s', - 'Warning: In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s', - 'Warning: In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.', - "Warning: In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.", + 'In HTML, %s cannot be a child of <%s>.%s\nThis will cause a hydration error.%s', + 'In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s', + 'In HTML, text nodes cannot be a child of <%s>.\nThis will cause a hydration error.', + "In HTML, whitespace text nodes cannot be a child of <%s>. Make sure you don't have any extra whitespace between tags on each line of your source code.\nThis will cause a hydration error.", ]) export const getHydrationWarningType = (msg: NullableText): 'tag' | 'text' => { 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 b1262973216c8..84110e87630bd 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 @@ -8,38414 +8,24710 @@ * LICENSE file in the root directory of this source tree. */ -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; -if ( - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === - 'function' -) { - __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); -} -var React = require("next/dist/compiled/react-experimental"); -var Scheduler = require("next/dist/compiled/scheduler-experimental"); -var ReactDOM = require('react-dom'); - -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - -// ----------------------------------------------------------------------------- -// Killswitch -// -// Flags that exist solely to turn off a change in case it causes a regression -// when it rolls out to prod. We should remove these as soon as possible. -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// Land or remove (moderate effort) -// -// Flags that can be probably deleted or landed, but might require extra effort -// like migrating internal callers or performance testing. -// ----------------------------------------------------------------------------- -// TODO: Finish rolling out in www - -var favorSafetyOverHydrationPerf = true; -var enableAsyncActions = true; // Need to remove didTimeout argument from Scheduler before landing - -var disableDefaultPropsExceptForClasses = true; // ----------------------------------------------------------------------------- -// Slated for removal in the future (significant effort) -// -// These are experiments that didn't work out, and never shipped, but we can't -// delete from the codebase until we migrate internal callers. -// ----------------------------------------------------------------------------- -// Add a callback property to suspense to notify which promises are currently -// in the update queue. This allows reporting and tracing of what is causing -// the user to see a loading state. -// -// Also allows hydration callbacks to fire when a dehydrated boundary gets -// hydrated or deleted. -// -// This will eventually be replaced by the Transition Tracing proposal. - -var enableSuspenseCallback = false; // Experimental Scope support. - -var enableLazyContextPropagation = false; // FB-only usage. The new API has different semantics. - -var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber -var alwaysThrottleRetries = true; -var enableOwnerStacks = true; -var syncLaneExpirationMs = 250; -var transitionLaneExpirationMs = 5000; // ----------------------------------------------------------------------------- -// Remove IE and MsApp specific workarounds for innerHTML - -var disableIEWorkarounds = true; // Filter certain DOM attributes (e.g. src, href) if their values are empty -// This allows us to land breaking changes to remove legacy mode APIs in experimental builds -// before removing them in stable in the next Major - -var disableLegacyMode = true; // Make equivalent to instead of -// React DOM Chopping Block -// -// Similar to main Chopping Block but only flags related to React DOM. These are -// grouped because we will likely batch all of them into a single major release. -// ----------------------------------------------------------------------------- -// Disable support for comment nodes as React DOM containers. Already disabled -// in open source, but www codebase still relies on it. Need to remove. - -var disableCommentsAsDOMContainers = true; -// Debugging and DevTools -// ----------------------------------------------------------------------------- -// Adds user timing marks for e.g. state updates, suspense, and work loop stuff, -// for an experimental timeline tool. - -var enableSchedulingProfiler = true; // Helps identify side effects in render-phase lifecycle hooks and setState - -var enableProfilerTimer = true; // Record durations for commit and passive effects phases. - -var enableProfilerCommitHooks = true; // Phase param passed to onRender callback differentiates between an "update" and a "cascading-update". - -var enableProfilerNestedUpdatePhase = true; // Adds verbose console logging for e.g. state updates, suspense, and work loop - -var suppressWarning = false; -function setSuppressWarning(newSuppressWarning) { - { - suppressWarning = newSuppressWarning; - } -} // In DEV, calls to console.warn and console.error get replaced -// by calls to these methods by a Babel plugin. -// -// In PROD (or in packages without access to React internals), -// they are left as they are instead. - -function warn(format) { - { - if (!suppressWarning) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args, new Error('react-stack-top-frame')); +/* + Modernizr 3.0.0pre (Custom Build) | MIT +*/ +"use strict"; +"production" !== process.env.NODE_ENV && + (function () { + function findHook(fiber, id) { + for (fiber = fiber.memoizedState; null !== fiber && 0 < id; ) + (fiber = fiber.next), id--; + return fiber; + } + function copyWithSetImpl(obj, path, index, value) { + if (index >= path.length) return value; + var key = path[index], + updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); + updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); + return updated; } - } -} -function error(format) { - { - if (!suppressWarning) { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args, new Error('react-stack-top-frame')); + function copyWithRename(obj, oldPath, newPath) { + if (oldPath.length !== newPath.length) + warn("copyWithRename() expects paths of the same length"); + else { + for (var i = 0; i < newPath.length - 1; i++) + if (oldPath[i] !== newPath[i]) { + warn( + "copyWithRename() expects paths to be the same except for the deepest key" + ); + return; + } + return copyWithRenameImpl(obj, oldPath, newPath, 0); + } + } + function copyWithRenameImpl(obj, oldPath, newPath, index) { + var oldKey = oldPath[index], + updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); + index + 1 === oldPath.length + ? ((updated[newPath[index]] = updated[oldKey]), + isArrayImpl(updated) + ? updated.splice(oldKey, 1) + : delete updated[oldKey]) + : (updated[oldKey] = copyWithRenameImpl( + obj[oldKey], + oldPath, + newPath, + index + 1 + )); + return updated; } - } -} // eslint-disable-next-line react-internal/no-production-logging - -var supportsCreateTask = !!console.createTask; - -function printWarning(level, format, args, currentStack) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n'; - - if (!supportsCreateTask && ReactSharedInternals.getCurrentStack) { - // We only add the current stack to the console when createTask is not supported. - // Since createTask requires DevTools to be open to work, this means that stacks - // can be lost while DevTools isn't open but we can't detect this. - var stack = ReactSharedInternals.getCurrentStack(currentStack); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } + function copyWithDeleteImpl(obj, path, index) { + var key = path[index], + updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj); + if (index + 1 === path.length) + return ( + isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], + updated + ); + updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); + return updated; } - - if (isErrorLogger) { - // Don't prefix our default logging formatting in ReactFiberErrorLoggger. - // Don't toString the arguments. - args.unshift(format); - } else { - // TODO: Remove this prefix and stop toStringing in the wrapper and - // instead do it at each callsite as needed. - // Careful: RN currently depends on this prefix - // eslint-disable-next-line react-internal/safe-string-coercion - args = args.map(function (item) { - return String(item); - }); - args.unshift('Warning: ' + format); - } // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - - Function.prototype.apply.call(console[level], console, args); - } -} - -/** - * HTML nodeType values that represent the type of the node - */ -var ELEMENT_NODE = 1; -var TEXT_NODE = 3; -var COMMENT_NODE = 8; -var DOCUMENT_NODE = 9; -var DOCUMENT_TYPE_NODE = 10; -var DOCUMENT_FRAGMENT_NODE = 11; - -function isValidContainer(node) { - return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers )); -} // TODO: Remove this function which also includes comment nodes. - -/** - * `ReactInstanceMap` maintains a mapping from a public facing stateful - * instance (key) and the internal representation (value). This allows public - * methods to accept the user facing instance as an argument and map them back - * to internal methods. - * - * Note that this module is currently shared and assumed to be stateless. - * If this becomes an actual Map, that will break. - */ -function get(key) { - return key._reactInternals; -} -function set(key, value) { - key._reactInternals = value; -} - -var FunctionComponent = 0; -var ClassComponent = 1; -var HostRoot = 3; // Root of a host tree. Could be nested inside another node. - -var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. - -var HostComponent = 5; -var HostText = 6; -var Fragment = 7; -var Mode = 8; -var ContextConsumer = 9; -var ContextProvider = 10; -var ForwardRef = 11; -var Profiler = 12; -var SuspenseComponent = 13; -var MemoComponent = 14; -var SimpleMemoComponent = 15; -var LazyComponent = 16; -var IncompleteClassComponent = 17; -var DehydratedFragment = 18; -var SuspenseListComponent = 19; -var ScopeComponent = 21; -var OffscreenComponent = 22; -var LegacyHiddenComponent = 23; -var CacheComponent = 24; -var TracingMarkerComponent = 25; -var HostHoistable = 26; -var HostSingleton = 27; -var IncompleteFunctionComponent = 28; - -// When adding new symbols to this file, -// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' -// The Symbol used to tag the ReactElement-like types. - -var REACT_LEGACY_ELEMENT_TYPE = Symbol.for('react.element'); -var REACT_ELEMENT_TYPE = Symbol.for('react.transitional.element') ; -var REACT_PORTAL_TYPE = Symbol.for('react.portal'); -var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); -var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); -var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); -var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); // TODO: Delete with enableRenderableContext - -var REACT_CONSUMER_TYPE = Symbol.for('react.consumer'); -var REACT_CONTEXT_TYPE = Symbol.for('react.context'); -var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); -var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); -var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); -var REACT_MEMO_TYPE = Symbol.for('react.memo'); -var REACT_LAZY_TYPE = Symbol.for('react.lazy'); -var REACT_SCOPE_TYPE = Symbol.for('react.scope'); -var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode'); -var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); -var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden'); -var REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker'); -var REACT_MEMO_CACHE_SENTINEL = Symbol.for('react.memo_cache_sentinel'); -var REACT_POSTPONE_TYPE = Symbol.for('react.postpone'); -var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = '@@iterator'; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; -} -var ASYNC_ITERATOR = Symbol.asyncIterator; - -function getWrappedName$1(outerType, innerType, wrapperName) { - var displayName = outerType.displayName; - - if (displayName) { - return displayName; - } - - var functionName = innerType.displayName || innerType.name || ''; - return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; -} // Keep in sync with react-reconciler/getComponentNameFromFiber - - -function getContextName$1(type) { - return type.displayName || 'Context'; -} - -var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. - -function getComponentNameFromType(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - if (typeof type === 'function') { - if (type.$$typeof === REACT_CLIENT_REFERENCE) { - // TODO: Create a convention for naming client references with debug info. + function shouldSuspendImpl() { + return !1; + } + function shouldErrorImpl() { return null; } - - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case REACT_FRAGMENT_TYPE: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case REACT_PROFILER_TYPE: - return 'Profiler'; - - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - - } - - if (typeof type === 'object') { - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); - } + function warnInvalidHookAccess() { + error$jscomp$0( + "Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks" + ); } - - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - { - return null; - } - - case REACT_CONTEXT_TYPE: - var context = type; - - { - return getContextName$1(context) + '.Provider'; - } - - case REACT_CONSUMER_TYPE: - { - var consumer = type; - return getContextName$1(consumer._context) + '.Consumer'; - } - - case REACT_FORWARD_REF_TYPE: - return getWrappedName$1(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - var outerName = type.displayName || null; - - if (outerName !== null) { - return outerName; - } - - return getComponentNameFromType(type.type) || 'Memo'; - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentNameFromType(init(payload)); - } catch (x) { - return null; - } + function warnInvalidContextAccess() { + error$jscomp$0( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + } + function noop$2() {} + function warnForMissingKey() {} + function setToSortedString(set) { + var array = []; + set.forEach(function (value) { + array.push(value); + }); + return array.sort().join(", "); + } + function findHostInstancesForRefresh(root, families) { + var hostInstances = new Set(); + families = new Set( + families.map(function (family) { + return family.current; + }) + ); + findHostInstancesForMatchingFibersRecursively( + root.current, + families, + hostInstances + ); + return hostInstances; + } + function scheduleRoot(root, element) { + root.context === emptyContextObject && + (updateContainerSync(element, root, null, null), flushSyncWork$1()); + } + function scheduleRefresh(root, update) { + if (null !== resolveFamily) { + var staleFamilies = update.staleFamilies; + update = update.updatedFamilies; + flushPassiveEffects(); + scheduleFibersWithFamiliesRecursively( + root.current, + update, + staleFamilies + ); + flushSyncWork$1(); + } + } + function setRefreshHandler(handler) { + resolveFamily = handler; + } + function warn(format) { + if (!suppressWarning) { + for ( + var _len = arguments.length, + args = Array(1 < _len ? _len - 1 : 0), + _key = 1; + _key < _len; + _key++ + ) + args[_key - 1] = arguments[_key]; + printWarning("warn", format, args, Error("react-stack-top-frame")); + } + } + function error$jscomp$0(format) { + if (!suppressWarning) { + for ( + var _len2 = arguments.length, + args = Array(1 < _len2 ? _len2 - 1 : 0), + _key2 = 1; + _key2 < _len2; + _key2++ + ) + args[_key2 - 1] = arguments[_key2]; + printWarning("error", format, args, Error("react-stack-top-frame")); + } + } + function printWarning(level, format, args, currentStack) { + !supportsCreateTask && + ReactSharedInternals.getCurrentStack && + ((currentStack = ReactSharedInternals.getCurrentStack(currentStack)), + "" !== currentStack && + ((format += "%s"), (args = args.concat([currentStack])))); + args.unshift(format); + Function.prototype.apply.call(console[level], console, args); + } + function isValidContainer(node) { + return !( + !node || + (1 !== node.nodeType && 9 !== node.nodeType && 11 !== node.nodeType) + ); + } + function getIteratorFn(maybeIterable) { + if (null === maybeIterable || "object" !== typeof maybeIterable) + return null; + maybeIterable = + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || + maybeIterable["@@iterator"]; + return "function" === typeof maybeIterable ? maybeIterable : null; + } + function getComponentNameFromType(type) { + if (null == type) return null; + if ("function" === typeof type) + return type.$$typeof === REACT_CLIENT_REFERENCE + ? null + : type.displayName || type.name || null; + if ("string" === typeof type) return type; + switch (type) { + case REACT_FRAGMENT_TYPE: + return "Fragment"; + case REACT_PORTAL_TYPE: + return "Portal"; + case REACT_PROFILER_TYPE: + return "Profiler"; + case REACT_STRICT_MODE_TYPE: + return "StrictMode"; + case REACT_SUSPENSE_TYPE: + return "Suspense"; + case REACT_SUSPENSE_LIST_TYPE: + return "SuspenseList"; + } + if ("object" === typeof type) + switch ( + ("number" === typeof type.tag && + error$jscomp$0( + "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." + ), + type.$$typeof) + ) { + case REACT_CONTEXT_TYPE: + return (type.displayName || "Context") + ".Provider"; + case REACT_CONSUMER_TYPE: + return (type._context.displayName || "Context") + ".Consumer"; + case REACT_FORWARD_REF_TYPE: + var innerType = type.render; + type = type.displayName; + type || + ((type = innerType.displayName || innerType.name || ""), + (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); + return type; + case REACT_MEMO_TYPE: + return ( + (innerType = type.displayName || null), + null !== innerType + ? innerType + : getComponentNameFromType(type.type) || "Memo" + ); + case REACT_LAZY_TYPE: + innerType = type._payload; + type = type._init; + try { + return getComponentNameFromType(type(innerType)); + } catch (x) {} } + return null; } - } - - return null; -} - -function getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); -} // Keep in sync with shared/getComponentNameFromType - - -function getContextName(type) { - return type.displayName || 'Context'; -} - -function getComponentNameFromOwner(owner) { - if (typeof owner.tag === 'number') { - return getComponentNameFromFiber(owner); - } - - if (typeof owner.name === 'string') { - return owner.name; - } - - return null; -} -function getComponentNameFromFiber(fiber) { - var tag = fiber.tag, - type = fiber.type; - - switch (tag) { - case CacheComponent: - return 'Cache'; - - case ContextConsumer: - { - var consumer = type; - return getContextName(consumer._context) + '.Consumer'; + function getComponentNameFromOwner(owner) { + return "number" === typeof owner.tag + ? getComponentNameFromFiber(owner) + : "string" === typeof owner.name + ? owner.name + : null; + } + function getComponentNameFromFiber(fiber) { + var type = fiber.type; + switch (fiber.tag) { + case 24: + return "Cache"; + case 9: + return (type._context.displayName || "Context") + ".Consumer"; + case 10: + return (type.displayName || "Context") + ".Provider"; + case 18: + return "DehydratedFragment"; + case 11: + return ( + (fiber = type.render), + (fiber = fiber.displayName || fiber.name || ""), + type.displayName || + ("" !== fiber ? "ForwardRef(" + fiber + ")" : "ForwardRef") + ); + case 7: + return "Fragment"; + case 26: + case 27: + case 5: + return type; + case 4: + return "Portal"; + case 3: + return "Root"; + case 6: + return "Text"; + case 16: + return getComponentNameFromType(type); + case 8: + return type === REACT_STRICT_MODE_TYPE ? "StrictMode" : "Mode"; + case 22: + return "Offscreen"; + case 12: + return "Profiler"; + case 21: + return "Scope"; + case 13: + return "Suspense"; + case 19: + return "SuspenseList"; + case 25: + return "TracingMarker"; + case 1: + case 0: + case 14: + case 15: + if ("function" === typeof type) + return type.displayName || type.name || null; + if ("string" === typeof type) return type; + break; + case 29: + type = fiber._debugInfo; + if (null != type) + for (var i = type.length - 1; 0 <= i; i--) + if ("string" === typeof type[i].name) return type[i].name; + if (null !== fiber.return) + return getComponentNameFromFiber(fiber.return); } - - case ContextProvider: - { - var _context = type; - return getContextName(_context) + '.Provider'; + return null; + } + function disabledLog() {} + function disableLogs() { + if (0 === disabledDepth) { + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; + var props = { + configurable: !0, + enumerable: !0, + value: disabledLog, + writable: !0 + }; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); } - - case DehydratedFragment: - return 'DehydratedFragment'; - - case ForwardRef: - return getWrappedName(type, type.render, 'ForwardRef'); - - case Fragment: - return 'Fragment'; - - case HostHoistable: - case HostSingleton: - case HostComponent: - // Host component type is the display name (e.g. "div", "View") - return type; - - case HostPortal: - return 'Portal'; - - case HostRoot: - return 'Root'; - - case HostText: - return 'Text'; - - case LazyComponent: - // Name comes from the type in this case; we don't have a tag. - return getComponentNameFromType(type); - - case Mode: - if (type === REACT_STRICT_MODE_TYPE) { - // Don't be less specific than shared/getComponentNameFromType - return 'StrictMode'; + disabledDepth++; + } + function reenableLogs() { + disabledDepth--; + if (0 === disabledDepth) { + var props = { configurable: !0, enumerable: !0, writable: !0 }; + Object.defineProperties(console, { + log: assign({}, props, { value: prevLog }), + info: assign({}, props, { value: prevInfo }), + warn: assign({}, props, { value: prevWarn }), + error: assign({}, props, { value: prevError }), + group: assign({}, props, { value: prevGroup }), + groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), + groupEnd: assign({}, props, { value: prevGroupEnd }) + }); } + 0 > disabledDepth && + error$jscomp$0( + "disabledDepth fell below zero. This is a bug in React. Please file an issue." + ); + } + function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; + } + function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + var frame = componentFrameCache.get(fn); + if (void 0 !== frame) return frame; + reentry = !0; + frame = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + var previousDispatcher = null; + previousDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = null; + disableLogs(); + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + try { + if (construct) { + var Fake = function () { + throw Error(); + }; + Object.defineProperty(Fake.prototype, "props", { + set: function () { + throw Error(); + } + }); + if ("object" === typeof Reflect && Reflect.construct) { + try { + Reflect.construct(Fake, []); + } catch (x) { + var control = x; + } + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x$0) { + control = x$0; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$1) { + control = x$1; + } + (Fake = fn()) && + "function" === typeof Fake.catch && + Fake.catch(function () {}); + } + } catch (sample) { + if (sample && control && "string" === typeof sample.stack) + return [sample.stack, control.stack]; + } + return [null, null]; + } + }; + RunInRootFrame.DetermineComponentFrameRoot.displayName = + "DetermineComponentFrameRoot"; + var namePropDescriptor = Object.getOwnPropertyDescriptor( + RunInRootFrame.DetermineComponentFrameRoot, + "name" + ); + namePropDescriptor && + namePropDescriptor.configurable && + Object.defineProperty( + RunInRootFrame.DetermineComponentFrameRoot, + "name", + { value: "DetermineComponentFrameRoot" } + ); + try { + var _RunInRootFrame$Deter = + RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; + if (sampleStack && controlStack) { + var sampleLines = sampleStack.split("\n"), + controlLines = controlStack.split("\n"); + for ( + sampleStack = _RunInRootFrame$Deter = 0; + _RunInRootFrame$Deter < sampleLines.length && + !sampleLines[_RunInRootFrame$Deter].includes( + "DetermineComponentFrameRoot" + ); - return 'Mode'; - - case OffscreenComponent: - return 'Offscreen'; - - case Profiler: - return 'Profiler'; - - case ScopeComponent: - return 'Scope'; - - case SuspenseComponent: - return 'Suspense'; - - case SuspenseListComponent: - return 'SuspenseList'; - - case TracingMarkerComponent: - return 'TracingMarker'; - // The display name for these tags come from the user-provided type: - - case IncompleteClassComponent: - case IncompleteFunctionComponent: - { - break; + ) + _RunInRootFrame$Deter++; + for ( + ; + sampleStack < controlLines.length && + !controlLines[sampleStack].includes("DetermineComponentFrameRoot"); + + ) + sampleStack++; + if ( + _RunInRootFrame$Deter === sampleLines.length || + sampleStack === controlLines.length + ) + for ( + _RunInRootFrame$Deter = sampleLines.length - 1, + sampleStack = controlLines.length - 1; + 1 <= _RunInRootFrame$Deter && + 0 <= sampleStack && + sampleLines[_RunInRootFrame$Deter] !== controlLines[sampleStack]; + + ) + sampleStack--; + for ( + ; + 1 <= _RunInRootFrame$Deter && 0 <= sampleStack; + _RunInRootFrame$Deter--, sampleStack-- + ) + if ( + sampleLines[_RunInRootFrame$Deter] !== controlLines[sampleStack] + ) { + if (1 !== _RunInRootFrame$Deter || 1 !== sampleStack) { + do + if ( + (_RunInRootFrame$Deter--, + sampleStack--, + 0 > sampleStack || + sampleLines[_RunInRootFrame$Deter] !== + controlLines[sampleStack]) + ) { + var _frame = + "\n" + + sampleLines[_RunInRootFrame$Deter].replace( + " at new ", + " at " + ); + fn.displayName && + _frame.includes("") && + (_frame = _frame.replace("", fn.displayName)); + "function" === typeof fn && + componentFrameCache.set(fn, _frame); + return _frame; + } + while (1 <= _RunInRootFrame$Deter && 0 <= sampleStack); + } + break; + } + } + } finally { + (reentry = !1), + (ReactSharedInternals.H = previousDispatcher), + reenableLogs(), + (Error.prepareStackTrace = frame); + } + sampleLines = (sampleLines = fn ? fn.displayName || fn.name : "") + ? describeBuiltInComponentFrame(sampleLines) + : ""; + "function" === typeof fn && componentFrameCache.set(fn, sampleLines); + return sampleLines; + } + function callComponentInDEV(Component, props, secondArg) { + var wasRendering = isRendering; + isRendering = !0; + try { + return Component(props, secondArg); + } finally { + isRendering = wasRendering; } - - // Fallthrough - - case ClassComponent: - case FunctionComponent: - case MemoComponent: - case SimpleMemoComponent: - if (typeof type === 'function') { - return type.displayName || type.name || null; + } + function callRenderInDEV(instance) { + var wasRendering = isRendering; + isRendering = !0; + try { + return instance.render(); + } finally { + isRendering = wasRendering; + } + } + function callLazyInitInDEV(lazy) { + var init = lazy._init; + return init(lazy._payload); + } + function isNotExternal(stackFrame) { + return !externalRegExp.test(stackFrame); + } + function filterDebugStack(error) { + error = error.stack; + error.startsWith("Error: react-stack-top-frame\n") && + (error = error.slice(29)); + error = error.split("\n").slice(1); + if (null === callComponentFrame) { + var stack = callComponentInDEV( + Error, + "react-stack-top-frame", + {} + ).stack, + startIdx = stack.startsWith("Error: react-stack-top-frame\n") + ? 29 + : 0, + endIdx = stack.indexOf("\n", startIdx); + callComponentFrame = + -1 === endIdx ? stack.slice(startIdx) : stack.slice(startIdx, endIdx); + } + stack = error.indexOf(callComponentFrame); + if ( + -1 === stack && + (null === callLazyInitFrame && + ((stack = callLazyInitInDEV({ + $$typeof: REACT_LAZY_TYPE, + _init: Error, + _payload: "react-stack-top-frame" + }).stack), + (startIdx = stack.startsWith("Error: react-stack-top-frame\n") + ? 29 + : 0), + (endIdx = stack.indexOf("\n", startIdx)), + (callLazyInitFrame = + -1 === endIdx + ? stack.slice(startIdx) + : stack.slice(startIdx, endIdx))), + (stack = error.indexOf(callLazyInitFrame)), + -1 === stack) + ) { + if (null === callIteratorFrame) + try { + callRenderInDEV({ render: null }), (callIteratorFrame = ""); + } catch (error$2) { + (stack = error$2.stack), + (startIdx = stack.startsWith("TypeError: ") + ? stack.indexOf("\n") + 1 + : 0), + (endIdx = stack.indexOf("\n", startIdx)), + (callIteratorFrame = + -1 === endIdx + ? stack.slice(startIdx) + : stack.slice(startIdx, endIdx)); + } + stack = error.indexOf(callIteratorFrame); + } + if (-1 !== stack) error.length = stack; + else return ""; + return error.filter(isNotExternal).join("\n"); + } + function describeFiber(fiber) { + switch (fiber.tag) { + case 26: + case 27: + case 5: + return describeBuiltInComponentFrame(fiber.type); + case 16: + return describeBuiltInComponentFrame("Lazy"); + case 13: + return describeBuiltInComponentFrame("Suspense"); + case 19: + return describeBuiltInComponentFrame("SuspenseList"); + case 0: + case 15: + return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + default: + return ""; } - - if (typeof type === 'string') { - return type; + } + function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ""; + do { + info += describeFiber(workInProgress); + var debugInfo = workInProgress._debugInfo; + if (debugInfo) + for (var i = debugInfo.length - 1; 0 <= i; i--) { + var entry = debugInfo[i]; + if ("string" === typeof entry.name) { + var JSCompiler_temp_const = info, + env = entry.env; + var JSCompiler_inline_result = describeBuiltInComponentFrame( + entry.name + (env ? " (" + env + ")" : "") + ); + info = JSCompiler_temp_const + JSCompiler_inline_result; + } + } + workInProgress = workInProgress.return; + } while (workInProgress); + return info; + } catch (x) { + return "\nError generating stack: " + x.message + "\n" + x.stack; } - - break; - - } - - return null; -} - -var NoFlags$1 = -/* */ -0; -var PerformedWork = -/* */ -1; -var Placement = -/* */ -2; -var DidCapture = -/* */ -128; -var Hydrating = -/* */ -4096; // You can change the rest (and add more). - -var Update = -/* */ -4; -/* Skipped value: 0b0000000000000000000000001000; */ - -var ChildDeletion = -/* */ -16; -var ContentReset = -/* */ -32; -var Callback = -/* */ -64; -/* Used by DidCapture: 0b0000000000000000000010000000; */ - -var ForceClientRender = -/* */ -256; -var Ref = -/* */ -512; -var Snapshot = -/* */ -1024; -var Passive$1 = -/* */ -2048; -/* Used by Hydrating: 0b0000000000000001000000000000; */ - -var Visibility = -/* */ -8192; -var StoreConsistency = -/* */ -16384; // It's OK to reuse these bits because these flags are mutually exclusive for -// different fiber types. We should really be doing this for as many flags as -// possible, because we're about to run out of bits. - -var ScheduleRetry = StoreConsistency; -var ShouldSuspendCommit = Visibility; -var DidDefer = ContentReset; -var FormReset = Snapshot; - -var HostEffectMask = -/* */ -32767; // These are not really side effects, but we still reuse this field. - -var Incomplete = -/* */ -32768; -var ShouldCapture = -/* */ -65536; -var ForceUpdateForLegacySuspense = -/* */ -131072; -var Forked = -/* */ -1048576; // Static tags describe aspects of a fiber that are not specific to a render, -// e.g. a fiber uses a passive effect (even if there are no updates on this particular render). -// This enables us to defer more work in the unmount case, -// since we can defer traversing the tree during layout to look for Passive effects, -// and instead rely on the static flag as a signal that there may be cleanup work. - -var RefStatic = -/* */ -2097152; -var LayoutStatic = -/* */ -4194304; -var PassiveStatic = -/* */ -8388608; -var MaySuspendCommit = -/* */ -16777216; // Flag used to identify newly inserted fibers. It isn't reset after commit unlike `Placement`. - -var PlacementDEV = -/* */ -33554432; -var MountLayoutDev = -/* */ -67108864; -var MountPassiveDev = -/* */ -134217728; // Groups of flags that are used in the commit phase to skip over trees that -// don't contain effects, by checking subtreeFlags. - -var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility -// flag logic (see #20043) -Update | Snapshot | (0); -var MutationMask = Placement | Update | ChildDeletion | ContentReset | Ref | Hydrating | Visibility | FormReset; -var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask - -var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. -// This allows certain concepts to persist without recalculating them, -// e.g. whether a subtree contains passive effects or portals. - -var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; - -var assign = Object.assign; - -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ + function describeFunctionComponentFrameWithoutLineNumber(fn) { + return (fn = fn ? fn.displayName || fn.name : "") + ? describeBuiltInComponentFrame(fn) + : ""; } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + function getCurrentFiberOwnerNameInDevOrNull() { + if (null === current) return null; + var owner = current._debugOwner; + return null != owner ? getComponentNameFromOwner(owner) : null; } - } -} - -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. + function getCurrentParentStackInDev() { + return null === current ? "" : getStackByFiberInDevAndProd(current); + } + function getCurrentFiberStackInDev(stack) { + if (null === current) return ""; + var workInProgress = current; try { - throw Error(); + var info = ""; + if (stack) { + var formattedTopStack = filterDebugStack(stack); + "" !== formattedTopStack && (info += "\n" + formattedTopStack); + } + 6 === workInProgress.tag && (workInProgress = workInProgress.return); + switch (workInProgress.tag) { + case 26: + case 27: + case 5: + info += describeBuiltInComponentFrame(workInProgress.type); + break; + case 13: + info += describeBuiltInComponentFrame("Suspense"); + break; + case 19: + info += describeBuiltInComponentFrame("SuspenseList"); + break; + case 0: + case 15: + case 1: + workInProgress._debugOwner || + "" !== info || + (info += describeFunctionComponentFrameWithoutLineNumber( + workInProgress.type + )); + break; + case 11: + workInProgress._debugOwner || + "" !== info || + (info += describeFunctionComponentFrameWithoutLineNumber( + workInProgress.type.render + )); + } + for (stack = workInProgress; stack; ) + if ("number" === typeof stack.tag) { + workInProgress = stack; + stack = workInProgress._debugOwner; + var debugStack = workInProgress._debugStack; + stack && + debugStack && + ("string" !== typeof debugStack && + (workInProgress._debugStack = debugStack = + filterDebugStack(debugStack)), + "" !== debugStack && (info += "\n" + debugStack)); + } else if ("string" === typeof stack.stack) + "" !== stack.stack && (info += "\n" + stack.stack), + (stack = stack.owner); + else break; + var JSCompiler_inline_result = info; } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; + JSCompiler_inline_result = + "\nError generating stack: " + x.message + "\n" + x.stack; } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$1(); -} -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ - - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; + return JSCompiler_inline_result; } - } - - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); - } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ - - - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; - + function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) { + var previousFiber = current; + ReactSharedInternals.getCurrentStack = + null === fiber ? null : getCurrentFiberStackInDev; + isRendering = !1; + current = fiber; try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow - - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too - - - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? - - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } + return null !== fiber && fiber._debugTask + ? fiber._debugTask.run( + callback.bind(null, arg0, arg1, arg2, arg3, arg4) + ) + : callback(arg0, arg1, arg2, arg3, arg4); + } finally { + current = previousFiber; } - - return [null, null]; + throw Error( + "runWithFiberInDEV should never be called in production. This is a bug in React." + ); } - }; // $FlowFixMe[prop-missing] - - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); - } - - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; - - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... - - - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } + function getNearestMountedFiber(fiber) { + var node = fiber, + nearestMounted = fiber; + if (fiber.alternate) for (; node.return; ) node = node.return; + else { + fiber = node; + do + (node = fiber), + 0 !== (node.flags & 4098) && (nearestMounted = node.return), + (fiber = node.return); + while (fiber); + } + return 3 === node.tag ? nearestMounted : null; + } + function getSuspenseInstanceFromFiber(fiber) { + if (13 === fiber.tag) { + var suspenseState = fiber.memoizedState; + null === suspenseState && + ((fiber = fiber.alternate), + null !== fiber && (suspenseState = fiber.memoizedState)); + if (null !== suspenseState) return suspenseState.dehydrated; } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); + return null; + } + function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) + throw Error("Unable to find node on an unmounted component."); + } + function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + if (!alternate) { + alternate = getNearestMountedFiber(fiber); + if (null === alternate) + throw Error("Unable to find node on an unmounted component."); + return alternate !== fiber ? null : fiber; + } + for (var a = fiber, b = alternate; ; ) { + var parentA = a.return; + if (null === parentA) break; + var parentB = parentA.alternate; + if (null === parentB) { + b = parentA.return; + if (null !== b) { + a = b; + continue; } - break; } + if (parentA.child === parentB.child) { + for (parentB = parentA.child; parentB; ) { + if (parentB === a) return assertIsMounted(parentA), fiber; + if (parentB === b) return assertIsMounted(parentA), alternate; + parentB = parentB.sibling; + } + throw Error("Unable to find node on an unmounted component."); + } + if (a.return !== b.return) (a = parentA), (b = parentB); + else { + for (var didFindChild = !1, _child = parentA.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentA; + b = parentB; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentA; + a = parentB; + break; + } + _child = _child.sibling; + } + if (!didFindChild) { + for (_child = parentB.child; _child; ) { + if (_child === a) { + didFindChild = !0; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = !0; + b = parentB; + a = parentA; + break; + } + _child = _child.sibling; + } + if (!didFindChild) + throw Error( + "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." + ); + } + } + if (a.alternate !== b) + throw Error( + "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." + ); + } + if (3 !== a.tag) + throw Error("Unable to find node on an unmounted component."); + return a.stateNode.current === a ? fiber : alternate; + } + function findCurrentHostFiber(parent) { + parent = findCurrentFiberUsingSlowPath(parent); + return null !== parent ? findCurrentHostFiberImpl(parent) : null; + } + function findCurrentHostFiberImpl(node) { + var tag = node.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node; + for (node = node.child; null !== node; ) { + tag = findCurrentHostFiberImpl(node); + if (null !== tag) return tag; + node = node.sibling; } + return null; } - } finally { - reentry = false; - - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); + function createCursor(defaultValue) { + return { current: defaultValue }; + } + function pop(cursor, fiber) { + 0 > index$jscomp$0 + ? error$jscomp$0("Unexpected pop.") + : (fiber !== fiberStack[index$jscomp$0] && + error$jscomp$0("Unexpected Fiber popped."), + (cursor.current = valueStack[index$jscomp$0]), + (valueStack[index$jscomp$0] = null), + (fiberStack[index$jscomp$0] = null), + index$jscomp$0--); + } + function push(cursor, value, fiber) { + index$jscomp$0++; + valueStack[index$jscomp$0] = cursor.current; + fiberStack[index$jscomp$0] = fiber; + cursor.current = value; + } + function requiredContext(c) { + null === c && + error$jscomp$0( + "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." + ); + return c; + } + function pushHostContainer(fiber, nextRootInstance) { + push(rootInstanceStackCursor, nextRootInstance, fiber); + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor, null, fiber); + var nextRootContext = nextRootInstance.nodeType; + switch (nextRootContext) { + case 9: + case 11: + nextRootContext = 9 === nextRootContext ? "#document" : "#fragment"; + nextRootInstance = (nextRootInstance = + nextRootInstance.documentElement) + ? (nextRootInstance = nextRootInstance.namespaceURI) + ? getOwnHostContext(nextRootInstance) + : HostContextNamespaceNone + : HostContextNamespaceNone; + break; + default: + if ( + ((nextRootInstance = + 8 === nextRootContext + ? nextRootInstance.parentNode + : nextRootInstance), + (nextRootContext = nextRootInstance.tagName), + (nextRootInstance = nextRootInstance.namespaceURI)) + ) + (nextRootInstance = getOwnHostContext(nextRootInstance)), + (nextRootInstance = getChildHostContextProd( + nextRootInstance, + nextRootContext + )); + else + switch (nextRootContext) { + case "svg": + nextRootInstance = HostContextNamespaceSvg; + break; + case "math": + nextRootInstance = HostContextNamespaceMath; + break; + default: + nextRootInstance = HostContextNamespaceNone; + } + } + nextRootContext = nextRootContext.toLowerCase(); + nextRootContext = updatedAncestorInfoDev(null, nextRootContext); + nextRootContext = { + context: nextRootInstance, + ancestorInfo: nextRootContext + }; + pop(contextStackCursor, fiber); + push(contextStackCursor, nextRootContext, fiber); + } + function popHostContainer(fiber) { + pop(contextStackCursor, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); + } + function getHostContext() { + return requiredContext(contextStackCursor.current); + } + function pushHostContext(fiber) { + null !== fiber.memoizedState && + push(hostTransitionProviderCursor, fiber, fiber); + var context = requiredContext(contextStackCursor.current); + var type = fiber.type; + var nextContext = getChildHostContextProd(context.context, type); + type = updatedAncestorInfoDev(context.ancestorInfo, type); + nextContext = { context: nextContext, ancestorInfo: type }; + context !== nextContext && + (push(contextFiberStackCursor, fiber, fiber), + push(contextStackCursor, nextContext, fiber)); + } + function popHostContext(fiber) { + contextFiberStackCursor.current === fiber && + (pop(contextStackCursor, fiber), pop(contextFiberStackCursor, fiber)); + hostTransitionProviderCursor.current === fiber && + (pop(hostTransitionProviderCursor, fiber), + (HostTransitionContext._currentValue = null)); + } + function typeName(value) { + return ( + ("function" === typeof Symbol && + Symbol.toStringTag && + value[Symbol.toStringTag]) || + value.constructor.name || + "Object" + ); } - } - - return syntheticFrame; -} - -function describeClassComponentFrame(ctor) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -// TODO: Consider marking the whole bundle instead of these boundaries. - -/** @noinline */ - -function callComponentInDEV(Component, props, secondArg) { - var wasRendering = isRendering; - setIsRendering(true); - - try { - var result = Component(props, secondArg); - return result; - } finally { - setIsRendering(wasRendering); - } -} -/** @noinline */ - -function callRenderInDEV(instance) { - var wasRendering = isRendering; - setIsRendering(true); - - try { - var result = instance.render(); - return result; - } finally { - setIsRendering(wasRendering); - } -} -/** @noinline */ - -function callLazyInitInDEV(lazy) { - var payload = lazy._payload; - var init = lazy._init; - return init(payload); -} - -var externalRegExp = /\/node\_modules\/|\(\\)/; -var callComponentFrame = null; -var callIteratorFrame = null; -var callLazyInitFrame = null; - -function isNotExternal(stackFrame) { - return !externalRegExp.test(stackFrame); -} - -function initCallComponentFrame() { - // Extract the stack frame of the callComponentInDEV function. - var error = callComponentInDEV(Error, 'react-stack-top-frame', {}); - var stack = error.stack; - var startIdx = stack.startsWith('Error: react-stack-top-frame\n') ? 29 : 0; - var endIdx = stack.indexOf('\n', startIdx); - - if (endIdx === -1) { - return stack.slice(startIdx); - } - - return stack.slice(startIdx, endIdx); -} - -function initCallRenderFrame() { - // Extract the stack frame of the callRenderInDEV function. - try { - callRenderInDEV({ - render: null - }); - return ''; - } catch (error) { - var stack = error.stack; - var startIdx = stack.startsWith('TypeError: ') ? stack.indexOf('\n') + 1 : 0; - var endIdx = stack.indexOf('\n', startIdx); - - if (endIdx === -1) { - return stack.slice(startIdx); + function willCoercionThrow(value) { + try { + return testStringCoercion(value), !1; + } catch (e) { + return !0; + } + } + function testStringCoercion(value) { + return "" + value; + } + function checkAttributeStringCoercion(value, attributeName) { + if (willCoercionThrow(value)) + return ( + error$jscomp$0( + "The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before using it here.", + attributeName, + typeName(value) + ), + testStringCoercion(value) + ); + } + function checkCSSPropertyStringCoercion(value, propName) { + if (willCoercionThrow(value)) + return ( + error$jscomp$0( + "The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before using it here.", + propName, + typeName(value) + ), + testStringCoercion(value) + ); + } + function checkFormFieldValueStringCoercion(value) { + if (willCoercionThrow(value)) + return ( + error$jscomp$0( + "Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before using it here.", + typeName(value) + ), + testStringCoercion(value) + ); + } + function injectInternals(internals) { + if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) return !0; + if (!hook.supportsFiber) + return ( + error$jscomp$0( + "The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://react.dev/link/react-devtools" + ), + !0 + ); + try { + (internals = assign({}, internals, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + })), + (rendererID = hook.inject(internals)), + (injectedHook = hook); + } catch (err) { + error$jscomp$0("React instrumentation encountered an error: %s.", err); + } + return hook.checkDCE ? !0 : !1; } - - return stack.slice(startIdx, endIdx); - } -} - -function initCallLazyInitFrame() { - // Extract the stack frame of the callLazyInitInDEV function. - var error = callLazyInitInDEV({ - $$typeof: REACT_LAZY_TYPE, - _init: Error, - _payload: 'react-stack-top-frame' - }); - var stack = error.stack; - var startIdx = stack.startsWith('Error: react-stack-top-frame\n') ? 29 : 0; - var endIdx = stack.indexOf('\n', startIdx); - - if (endIdx === -1) { - return stack.slice(startIdx); - } - - return stack.slice(startIdx, endIdx); -} - -function filterDebugStack(error) { - // Since stacks can be quite large and we pass a lot of them, we filter them out eagerly - // to save bandwidth even in DEV. We'll also replay these stacks on the client so by - // stripping them early we avoid that overhead. Otherwise we'd normally just rely on - // the DevTools or framework's ignore lists to filter them out. - var stack = error.stack; - - if (stack.startsWith('Error: react-stack-top-frame\n')) { - // V8's default formatting prefixes with the error message which we - // don't want/need. - stack = stack.slice(29); - } - - var frames = stack.split('\n').slice(1); - - if (callComponentFrame === null) { - callComponentFrame = initCallComponentFrame(); - } - - var lastFrameIdx = frames.indexOf(callComponentFrame); - - if (lastFrameIdx === -1) { - if (callLazyInitFrame === null) { - callLazyInitFrame = initCallLazyInitFrame(); + function onCommitRoot$1(root, eventPriority) { + if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) + try { + var didError = 128 === (root.current.flags & 128); + switch (eventPriority) { + case DiscreteEventPriority: + var schedulerPriority = ImmediatePriority; + break; + case ContinuousEventPriority: + schedulerPriority = UserBlockingPriority; + break; + case DefaultEventPriority: + schedulerPriority = NormalPriority$1; + break; + case IdleEventPriority: + schedulerPriority = IdlePriority; + break; + default: + schedulerPriority = NormalPriority$1; + } + injectedHook.onCommitFiberRoot( + rendererID, + root, + schedulerPriority, + didError + ); + } catch (err) { + hasLoggedError || + ((hasLoggedError = !0), + error$jscomp$0( + "React instrumentation encountered an error: %s", + err + )); + } + } + function setIsStrictModeForDevtools(newIsStrictMode) { + "function" === typeof log$1 && + (unstable_setDisableYieldValue(newIsStrictMode), + (suppressWarning = newIsStrictMode)); + if (injectedHook && "function" === typeof injectedHook.setStrictMode) + try { + injectedHook.setStrictMode(rendererID, newIsStrictMode); + } catch (err) { + hasLoggedError || + ((hasLoggedError = !0), + error$jscomp$0( + "React instrumentation encountered an error: %s", + err + )); + } + } + function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; + } + function getLaneLabelMap() { + for ( + var map = new Map(), lane = 1, index = 0; + index < TotalLanes; + index++ + ) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } + return map; + } + function markCommitStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStopped && + injectedProfilingHooks.markCommitStopped(); + } + function markComponentRenderStarted(fiber) { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentRenderStarted && + injectedProfilingHooks.markComponentRenderStarted(fiber); + } + function markComponentRenderStopped() { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentRenderStopped && + injectedProfilingHooks.markComponentRenderStopped(); + } + function markComponentLayoutEffectUnmountStarted(fiber) { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted && + injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); + } + function markComponentLayoutEffectUnmountStopped() { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped && + injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); + } + function markRenderStarted(lanes) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStarted && + injectedProfilingHooks.markRenderStarted(lanes); + } + function markRenderStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStopped && + injectedProfilingHooks.markRenderStopped(); + } + function markStateUpdateScheduled(fiber, lane) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markStateUpdateScheduled && + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); + } + function clz32Fallback(x) { + x >>>= 0; + return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; + } + function getLabelForLane(lane) { + if (lane & SyncHydrationLane) return "SyncHydrationLane"; + if (lane & SyncLane) return "Sync"; + if (lane & InputContinuousHydrationLane) + return "InputContinuousHydration"; + if (lane & InputContinuousLane) return "InputContinuous"; + if (lane & DefaultHydrationLane) return "DefaultHydration"; + if (lane & DefaultLane) return "Default"; + if (lane & TransitionHydrationLane) return "TransitionHydration"; + if (lane & TransitionLanes) return "Transition"; + if (lane & RetryLanes) return "Retry"; + if (lane & SelectiveHydrationLane) return "SelectiveHydration"; + if (lane & IdleHydrationLane) return "IdleHydration"; + if (lane & IdleLane) return "Idle"; + if (lane & OffscreenLane) return "Offscreen"; + if (lane & DeferredLane) return "Deferred"; + } + function getHighestPriorityLanes(lanes) { + var pendingSyncLanes = lanes & SyncUpdateLanes; + if (0 !== pendingSyncLanes) return pendingSyncLanes; + switch (lanes & -lanes) { + case SyncHydrationLane: + return SyncHydrationLane; + case SyncLane: + return SyncLane; + case InputContinuousHydrationLane: + return InputContinuousHydrationLane; + case InputContinuousLane: + return InputContinuousLane; + case DefaultHydrationLane: + return DefaultHydrationLane; + case DefaultLane: + return DefaultLane; + case TransitionHydrationLane: + return TransitionHydrationLane; + case 128: + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + return lanes & TransitionLanes; + case 4194304: + case 8388608: + case 16777216: + case 33554432: + return lanes & RetryLanes; + case SelectiveHydrationLane: + return SelectiveHydrationLane; + case IdleHydrationLane: + return IdleHydrationLane; + case IdleLane: + return IdleLane; + case OffscreenLane: + return OffscreenLane; + case DeferredLane: + return 0; + default: + return ( + error$jscomp$0( + "Should have found matching lanes. This is a bug in React." + ), + lanes + ); + } + } + function getNextLanes(root, wipLanes) { + var pendingLanes = root.pendingLanes; + if (0 === pendingLanes) return 0; + var nextLanes = 0, + suspendedLanes = root.suspendedLanes; + root = root.pingedLanes; + 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))); + return 0 === nextLanes + ? 0 + : 0 !== wipLanes && + wipLanes !== nextLanes && + 0 === (wipLanes & suspendedLanes) && + ((suspendedLanes = nextLanes & -nextLanes), + (root = wipLanes & -wipLanes), + suspendedLanes >= root || + (suspendedLanes === DefaultLane && 0 !== (root & TransitionLanes))) + ? wipLanes + : nextLanes; + } + function computeExpirationTime(lane, currentTime) { + switch (lane) { + case SyncHydrationLane: + case SyncLane: + case InputContinuousHydrationLane: + case InputContinuousLane: + return currentTime + 250; + case DefaultHydrationLane: + case DefaultLane: + case TransitionHydrationLane: + case 128: + case 256: + case 512: + case 1024: + case 2048: + case 4096: + case 8192: + case 16384: + case 32768: + case 65536: + case 131072: + case 262144: + case 524288: + case 1048576: + case 2097152: + return currentTime + 5e3; + case 4194304: + case 8388608: + case 16777216: + case 33554432: + return -1; + case SelectiveHydrationLane: + case IdleHydrationLane: + case IdleLane: + case OffscreenLane: + case DeferredLane: + return -1; + default: + return ( + error$jscomp$0( + "Should have found matching lanes. This is a bug in React." + ), + -1 + ); + } + } + function getLanesToRetrySynchronouslyOnError( + root, + originallyAttemptedLanes + ) { + if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; + root = root.pendingLanes & ~OffscreenLane; + return 0 !== root ? root : root & OffscreenLane ? OffscreenLane : 0; + } + function claimNextTransitionLane() { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & TransitionLanes) && + (nextTransitionLane = 128); + return lane; + } + function claimNextRetryLane() { + var lane = nextRetryLane; + nextRetryLane <<= 1; + 0 === (nextRetryLane & RetryLanes) && (nextRetryLane = 4194304); + return lane; + } + function createLaneMap(initial) { + for (var laneMap = [], i = 0; i < TotalLanes; i++) laneMap.push(initial); + return laneMap; + } + function markRootFinished(root, remainingLanes, spawnedLane) { + var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; + root.pendingLanes = remainingLanes; + root.suspendedLanes = 0; + root.pingedLanes = 0; + root.expiredLanes &= remainingLanes; + root.entangledLanes &= remainingLanes; + root.errorRecoveryDisabledLanes &= remainingLanes; + root.shellSuspendCounter = 0; + remainingLanes = root.entanglements; + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { + var index = 31 - clz32(noLongerPendingLanes), + lane = 1 << index; + remainingLanes[index] = 0; + expirationTimes[index] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index]; + if (null !== hiddenUpdatesForLane) + for ( + hiddenUpdates[index] = null, index = 0; + index < hiddenUpdatesForLane.length; + index++ + ) { + var update = hiddenUpdatesForLane[index]; + null !== update && (update.lane &= ~OffscreenLane); + } + noLongerPendingLanes &= ~lane; + } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); + } + function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | + DeferredLane | + (entangledLanes & UpdateLanes); + } + function markRootEntangled(root, entangledLanes) { + var rootEntangledLanes = (root.entangledLanes |= entangledLanes); + for (root = root.entanglements; rootEntangledLanes; ) { + var index = 31 - clz32(rootEntangledLanes), + lane = 1 << index; + (lane & entangledLanes) | (root[index] & entangledLanes) && + (root[index] |= entangledLanes); + rootEntangledLanes &= ~lane; + } + } + function addFiberToLanesMap(root, fiber, lanes) { + if (isDevToolsPresent) + for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { + var index = 31 - clz32(lanes), + lane = 1 << index; + root[index].add(fiber); + lanes &= ~lane; + } + } + function movePendingFibersToMemoized(root, lanes) { + if (isDevToolsPresent) + for ( + var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap, + memoizedUpdaters = root.memoizedUpdaters; + 0 < lanes; + + ) { + var index = 31 - clz32(lanes); + root = 1 << index; + index = pendingUpdatersLaneMap[index]; + 0 < index.size && + (index.forEach(function (fiber) { + var alternate = fiber.alternate; + (null !== alternate && memoizedUpdaters.has(alternate)) || + memoizedUpdaters.add(fiber); + }), + index.clear()); + lanes &= ~root; + } + } + function lanesToEventPriority(lanes) { + lanes &= -lanes; + return 0 !== DiscreteEventPriority && DiscreteEventPriority < lanes + ? 0 !== ContinuousEventPriority && ContinuousEventPriority < lanes + ? 0 !== (lanes & 134217727) + ? DefaultEventPriority + : IdleEventPriority + : ContinuousEventPriority + : DiscreteEventPriority; + } + function resolveUpdatePriority() { + var updatePriority = ReactDOMSharedInternals.p; + if (0 !== updatePriority) return updatePriority; + updatePriority = window.event; + return void 0 === updatePriority + ? DefaultEventPriority + : getEventPriority(updatePriority.type); + } + function runWithPriority(priority, fn) { + var previousPriority = ReactDOMSharedInternals.p; + try { + return (ReactDOMSharedInternals.p = priority), fn(); + } finally { + ReactDOMSharedInternals.p = previousPriority; + } + } + function detachDeletedInstance(node) { + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; + } + function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + if (targetInst) return targetInst; + for (var parentNode = targetNode.parentNode; parentNode; ) { + if ( + (targetInst = + parentNode[internalContainerInstanceKey] || + parentNode[internalInstanceKey]) + ) { + parentNode = targetInst.alternate; + if ( + null !== targetInst.child || + (null !== parentNode && null !== parentNode.child) + ) + for ( + targetNode = getParentSuspenseInstance(targetNode); + null !== targetNode; + + ) { + if ((parentNode = targetNode[internalInstanceKey])) + return parentNode; + targetNode = getParentSuspenseInstance(targetNode); + } + return targetInst; + } + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + return null; } - - lastFrameIdx = frames.indexOf(callLazyInitFrame); - - if (lastFrameIdx === -1) { - if (callIteratorFrame === null) { - callIteratorFrame = initCallRenderFrame(); + function getInstanceFromNode(node) { + if ( + (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) + ) { + var tag = node.tag; + if ( + 5 === tag || + 6 === tag || + 13 === tag || + 26 === tag || + 27 === tag || + 3 === tag + ) + return node; } - - lastFrameIdx = frames.indexOf(callIteratorFrame); + return null; } - } - - if (lastFrameIdx !== -1) { - // Cut off everything after our "callComponent" slot since it'll be Fiber internals. - frames.length = lastFrameIdx; - } else { - // We didn't find any internal callsite out to user space. - // This means that this was called outside an owner or the owner is fully internal. - // To keep things light we exclude the entire trace in this case. - return ''; - } - - return frames.filter(isNotExternal).join('\n'); -} - -function formatOwnerStack(ownerStackTrace) { - return filterDebugStack(ownerStackTrace); -} - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; - } -} - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } + function getNodeFromInstance(inst) { + var tag = inst.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) + return inst.stateNode; + throw Error("getNodeFromInstance: Invalid argument."); + } + function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + resources || + (resources = root[internalRootNodeResourcesKey] = + { hoistableStyles: new Map(), hoistableScripts: new Map() }); + return resources; + } + function markNodeAsHoistable(node) { + node[internalHoistableMarker] = !0; + } + function registerTwoPhaseEvent(registrationName, dependencies) { + registerDirectEvent(registrationName, dependencies); + registerDirectEvent(registrationName + "Capture", dependencies); + } + function registerDirectEvent(registrationName, dependencies) { + registrationNameDependencies[registrationName] && + error$jscomp$0( + "EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.", + registrationName + ); + registrationNameDependencies[registrationName] = dependencies; + var lowerCasedName = registrationName.toLowerCase(); + possibleRegistrationNames[lowerCasedName] = registrationName; + "onDoubleClick" === registrationName && + (possibleRegistrationNames.ondblclick = registrationName); + for ( + registrationName = 0; + registrationName < dependencies.length; + registrationName++ + ) + allNativeEvents.add(dependencies[registrationName]); + } + function checkControlledValueProps(tagName, props) { + hasReadOnlyValue[props.type] || + props.onChange || + props.onInput || + props.readOnly || + props.disabled || + null == props.value || + ("select" === tagName + ? error$jscomp$0( + "You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set `onChange`." + ) + : error$jscomp$0( + "You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`." + )); + props.onChange || + props.readOnly || + props.disabled || + null == props.checked || + error$jscomp$0( + "You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`." + ); + } + function isAttributeNameSafe(attributeName) { + if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) + return !0; + if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) + return !1; + if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) + return (validatedAttributeNameCache[attributeName] = !0); + illegalAttributeNameCache[attributeName] = !0; + error$jscomp$0("Invalid attribute name: `%s`", attributeName); + return !1; + } + function getValueForAttributeOnCustomComponent(node, name, expected) { + if (isAttributeNameSafe(name)) { + if (!node.hasAttribute(name)) { + switch (typeof expected) { + case "symbol": + case "object": + return expected; + case "function": + return expected; + case "boolean": + if (!1 === expected) return expected; + } + return void 0 === expected ? void 0 : null; + } + node = node.getAttribute(name); + if ("" === node && !0 === expected) return !0; + checkAttributeStringCoercion(expected, name); + return node === "" + expected ? expected : node; + } + } + function setValueForAttribute(node, name, value) { + if (isAttributeNameSafe(name)) + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + node.removeAttribute(name); + return; + case "boolean": + var prefix = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix && "aria-" !== prefix) { + node.removeAttribute(name); + return; + } } + checkAttributeStringCoercion(value, name); + node.setAttribute(name, "" + value); } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } -} - -function describeFunctionComponentFrameWithoutLineNumber(fn) { - // We use this because we don't actually want to describe the line of the component - // but just the component name. - var name = fn ? fn.displayName || fn.name : ''; - return name ? describeBuiltInComponentFrame(name) : ''; -} - -function getOwnerStackByFiberInDev(workInProgress, topStack) { - - try { - var info = ''; - - if (topStack) { - // Prefix with a filtered version of the currently executing - // stack. This information will be available in the native - // stack regardless but it's hidden since we're reprinting - // the stack on top of it. - var formattedTopStack = formatOwnerStack(topStack); - - if (formattedTopStack !== '') { - info += '\n' + formattedTopStack; - } } - - if (workInProgress.tag === HostText) { - // Text nodes never have an owner/stack because they're not created through JSX. - // We use the parent since text nodes are always created through a host parent. - workInProgress = workInProgress.return; - } // The owner stack of the current fiber will be where it was created, i.e. inside its owner. - // There's no actual name of the currently executing component. Instead, that is available - // on the regular stack that's currently executing. However, for built-ins there is no such - // named stack frame and it would be ignored as being internal anyway. Therefore we add - // add one extra frame just to describe the "current" built-in component by name. - // Similarly, if there is no owner at all, then there's no stack frame so we add the name - // of the root component to the stack to know which component is currently executing. - - - switch (workInProgress.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - info += describeBuiltInComponentFrame(workInProgress.type); - break; - - case SuspenseComponent: - info += describeBuiltInComponentFrame('Suspense'); - break; - - case SuspenseListComponent: - info += describeBuiltInComponentFrame('SuspenseList'); - break; - - case FunctionComponent: - case SimpleMemoComponent: - case ClassComponent: - if (!workInProgress._debugOwner && info === '') { - // Only if we have no other data about the callsite do we add - // the component name as the single stack frame. - info += describeFunctionComponentFrameWithoutLineNumber(workInProgress.type); + function setValueForKnownAttribute(node, name, value) { + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + case "boolean": + node.removeAttribute(name); + return; } - - break; - - case ForwardRef: - if (!workInProgress._debugOwner && info === '') { - info += describeFunctionComponentFrameWithoutLineNumber(workInProgress.type.render); + checkAttributeStringCoercion(value, name); + node.setAttribute(name, "" + value); + } + } + function setValueForNamespacedAttribute(node, namespace, name, value) { + if (null === value) node.removeAttribute(name); + else { + switch (typeof value) { + case "undefined": + case "function": + case "symbol": + case "boolean": + node.removeAttribute(name); + return; } - - break; + checkAttributeStringCoercion(value, name); + node.setAttributeNS(namespace, name, "" + value); + } } - - var owner = workInProgress; - - while (owner) { - if (typeof owner.tag === 'number') { - var fiber = owner; - owner = fiber._debugOwner; - var debugStack = fiber._debugStack; // If we don't actually print the stack if there is no owner of this JSX element. - // In a real app it's typically not useful since the root app is always controlled - // by the framework. These also tend to have noisy stacks because they're not rooted - // in a React render but in some imperative bootstrapping code. It could be useful - // if the element was created in module scope. E.g. hoisted. We could add a a single - // stack frame for context for example but it doesn't say much if that's a wrapper. - - if (owner && debugStack) { - if (typeof debugStack !== 'string') { - // Stash the formatted stack so that we can avoid redoing the filtering. - fiber._debugStack = debugStack = formatOwnerStack(debugStack); + function getToStringValue(value) { + switch (typeof value) { + case "bigint": + case "boolean": + case "number": + case "string": + case "undefined": + return value; + case "object": + return checkFormFieldValueStringCoercion(value), value; + default: + return ""; + } + } + function isCheckable(elem) { + var type = elem.type; + return ( + (elem = elem.nodeName) && + "input" === elem.toLowerCase() && + ("checkbox" === type || "radio" === type) + ); + } + function trackValueOnNode(node) { + var valueField = isCheckable(node) ? "checked" : "value", + descriptor = Object.getOwnPropertyDescriptor( + node.constructor.prototype, + valueField + ); + checkFormFieldValueStringCoercion(node[valueField]); + var currentValue = "" + node[valueField]; + if ( + !node.hasOwnProperty(valueField) && + "undefined" !== typeof descriptor && + "function" === typeof descriptor.get && + "function" === typeof descriptor.set + ) { + var get = descriptor.get, + set = descriptor.set; + Object.defineProperty(node, valueField, { + configurable: !0, + get: function () { + return get.call(this); + }, + set: function (value) { + checkFormFieldValueStringCoercion(value); + currentValue = "" + value; + set.call(this, value); } - - if (debugStack !== '') { - info += '\n' + debugStack; + }); + Object.defineProperty(node, valueField, { + enumerable: descriptor.enumerable + }); + return { + getValue: function () { + return currentValue; + }, + setValue: function (value) { + checkFormFieldValueStringCoercion(value); + currentValue = "" + value; + }, + stopTracking: function () { + node._valueTracker = null; + delete node[valueField]; } - } - } else if (typeof owner.stack === 'string') { - // Server Component - // The Server Component stack can come from a different VM that formats it different. - // Likely V8. Since Chrome based browsers support createTask which is going to use - // another code path anyway. I.e. this is likely NOT a V8 based browser. - // This will cause some of the stack to have different formatting. - // TODO: Normalize server component stacks to the client formatting. - if (owner.stack !== '') { - info += '\n' + owner.stack; - } - - var componentInfo = owner; - owner = componentInfo.owner; - } else { - break; + }; } } - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } -} - -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; + function track(node) { + node._valueTracker || (node._valueTracker = trackValueOnNode(node)); + } + function updateValueIfChanged(node) { + if (!node) return !1; + var tracker = node._valueTracker; + if (!tracker) return !0; + var lastValue = tracker.getValue(); + var value = ""; + node && + (value = isCheckable(node) + ? node.checked + ? "true" + : "false" + : node.value); + node = value; + return node !== lastValue ? (tracker.setValue(node), !0) : !1; + } + function getActiveElement(doc) { + doc = doc || ("undefined" !== typeof document ? document : void 0); + if ("undefined" === typeof doc) return null; + try { + return doc.activeElement || doc.body; + } catch (e) { + return doc.body; + } } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); + function escapeSelectorAttributeValueInsideDoubleQuotes(value) { + return value.replace( + escapeSelectorAttributeValueInsideDoubleQuotesRegex, + function (ch) { + return "\\" + ch.charCodeAt(0).toString(16) + " "; + } + ); } - } - - return null; -} -function getCurrentParentStackInDev() { - // This is used to get the parent stack even with owner stacks turned on. - { - if (current === null) { - return ''; + function validateInputProps(element, props) { + void 0 === props.checked || + void 0 === props.defaultChecked || + didWarnCheckedDefaultChecked || + (error$jscomp$0( + "%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://react.dev/link/controlled-components", + getCurrentFiberOwnerNameInDevOrNull() || "A component", + props.type + ), + (didWarnCheckedDefaultChecked = !0)); + void 0 === props.value || + void 0 === props.defaultValue || + didWarnValueDefaultValue$1 || + (error$jscomp$0( + "%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://react.dev/link/controlled-components", + getCurrentFiberOwnerNameInDevOrNull() || "A component", + props.type + ), + (didWarnValueDefaultValue$1 = !0)); + } + function updateInput( + element, + value, + defaultValue, + lastDefaultValue, + checked, + defaultChecked, + type, + name + ) { + element.name = ""; + null != type && + "function" !== typeof type && + "symbol" !== typeof type && + "boolean" !== typeof type + ? (checkAttributeStringCoercion(type, "type"), (element.type = type)) + : element.removeAttribute("type"); + if (null != value) + if ("number" === type) { + if ((0 === value && "" === element.value) || element.value != value) + element.value = "" + getToStringValue(value); + } else + element.value !== "" + getToStringValue(value) && + (element.value = "" + getToStringValue(value)); + else + ("submit" !== type && "reset" !== type) || + element.removeAttribute("value"); + null != value + ? setDefaultValue(element, type, getToStringValue(value)) + : null != defaultValue + ? setDefaultValue(element, type, getToStringValue(defaultValue)) + : null != lastDefaultValue && element.removeAttribute("value"); + null == checked && + null != defaultChecked && + (element.defaultChecked = !!defaultChecked); + null != checked && + (element.checked = + checked && + "function" !== typeof checked && + "symbol" !== typeof checked); + null != name && + "function" !== typeof name && + "symbol" !== typeof name && + "boolean" !== typeof name + ? (checkAttributeStringCoercion(name, "name"), + (element.name = "" + getToStringValue(name))) + : element.removeAttribute("name"); + } + function initInput( + element, + value, + defaultValue, + checked, + defaultChecked, + type, + name, + isHydrating + ) { + null != type && + "function" !== typeof type && + "symbol" !== typeof type && + "boolean" !== typeof type && + (checkAttributeStringCoercion(type, "type"), (element.type = type)); + if (null != value || null != defaultValue) { + if ( + !( + ("submit" !== type && "reset" !== type) || + (void 0 !== value && null !== value) + ) + ) + return; + defaultValue = + null != defaultValue ? "" + getToStringValue(defaultValue) : ""; + value = null != value ? "" + getToStringValue(value) : defaultValue; + isHydrating || value === element.value || (element.value = value); + element.defaultValue = value; + } + checked = null != checked ? checked : defaultChecked; + checked = + "function" !== typeof checked && + "symbol" !== typeof checked && + !!checked; + element.checked = isHydrating ? element.checked : !!checked; + element.defaultChecked = !!checked; + null != name && + "function" !== typeof name && + "symbol" !== typeof name && + "boolean" !== typeof name && + (checkAttributeStringCoercion(name, "name"), (element.name = name)); + } + function setDefaultValue(node, type, value) { + ("number" === type && getActiveElement(node.ownerDocument) === node) || + node.defaultValue === "" + value || + (node.defaultValue = "" + value); + } + function validateOptionProps(element, props) { + null == props.value && + ("object" === typeof props.children && null !== props.children + ? React.Children.forEach(props.children, function (child) { + null == child || + "string" === typeof child || + "number" === typeof child || + "bigint" === typeof child || + didWarnInvalidChild || + ((didWarnInvalidChild = !0), + error$jscomp$0( + "Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to