failproofai 1.0.11-beta.0 → 1.0.11-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +109 -9
- package/.next/standalone/.next/prerender-manifest.json +6 -6
- package/.next/standalone/.next/required-server-files.json +17 -2
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +2 -3
- package/.next/standalone/.next/server/app/_global-error/page.js +13 -8
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +17 -13
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +19 -15
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +17 -13
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +2 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +2 -3
- package/.next/standalone/.next/server/app/_not-found/page.js +17 -12
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +32 -21
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +32 -21
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +37 -27
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js +11 -7
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js +38 -11
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js +6 -4
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js +10 -6
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js +11 -7
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js +11 -6
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js +11 -6
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +6 -4
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +4 -6
- package/.next/standalone/.next/server/app/audit/page.js +26 -19
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +30 -20
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +34 -25
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +30 -20
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +3 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +2 -3
- package/.next/standalone/.next/server/app/page.js +20 -14
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +28 -42
- package/.next/standalone/.next/server/app/policies/page.js +30 -21
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +2 -3
- package/.next/standalone/.next/server/app/project/[name]/page.js +44 -20
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +4 -6
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +39 -23
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +2 -3
- package/.next/standalone/.next/server/app/projects/page.js +24 -16
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +8 -6
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +16 -24
- package/.next/standalone/.next/server/app/settings/page.js +30 -22
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/1oeh_server_app_api_download_[project]_[session]_route_actions_1is7vs762er-g.js +3 -0
- package/.next/standalone/.next/server/chunks/[externals]__08d8xc5bifn8z._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[externals]__0h0p9dm._.js → [externals]__0h0p9dmv_e7r7._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__0hjaw70._.js → [externals]__0hjaw70fchx66._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1oenfmn._.js → [externals]__0qkp92tjfvw8r._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[externals]__105ihae9i2b_d._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[externals]__0sds_16._.js → [externals]__1_407huhlmj1m._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[externals]__1k8s9m68ew993._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[externals]__0d7i9ea._.js → [externals]__1rlxpymm37wel._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[externals]__1s462yl._.js → [externals]__1s462ylxpc7-5._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[externals]_node_net_1yam_zj43-40b._.js +3 -0
- package/.next/standalone/.next/server/chunks/{[externals]_node_os_0by37l-._.js → [externals]_node_os_0by37l-11q5ls._.js} +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__07l68zv0hqdiu._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__08dchfudh2_4f._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0xu5zkw15bs._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0car70pylmvor._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0jz5xqu-p_lfc._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0spt0kv8azrpl._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0swiyzbmvja2d._.js +327 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0u3i025_setk_._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__10a2f6s636yc7._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__168oo8wb5n23f._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ey11fel2q2qw._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1izwqj_ij_9x_._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qt5u58xrcuk6._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1r7kbfkiw2xmu._.js +322 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ztigqa01tigq._.js +3 -0
- package/.next/standalone/.next/server/chunks/[turbopack]_runtime.js +146 -16
- package/.next/standalone/.next/server/chunks/_09dz7xva4ce_2._.js +27 -0
- package/.next/standalone/.next/server/chunks/_0hf5q4xzyg40j._.js +3 -0
- package/.next/standalone/.next/server/chunks/_0p53ge1jmkucy._.js +3 -0
- package/.next/standalone/.next/server/chunks/_0tovk6q0miud6._.js +3 -0
- package/.next/standalone/.next/server/chunks/_0trp3ycqv17cl._.js +3 -0
- package/.next/standalone/.next/server/chunks/_1-2owkp-1_987._.js +3 -0
- package/.next/standalone/.next/server/chunks/_13ltj8a9z92o8._.js +3 -0
- package/.next/standalone/.next/server/chunks/_15k37au70vjvg._.js +3 -0
- package/.next/standalone/.next/server/chunks/_18rfu4__wjhwb._.js +3 -0
- package/.next/standalone/.next/server/chunks/_19011-u44143j._.js +3 -0
- package/.next/standalone/.next/server/chunks/_1ek68lnh2daur._.js +33 -0
- package/.next/standalone/.next/server/chunks/_1fz8m31sndkcu._.js +3 -0
- package/.next/standalone/.next/server/chunks/_1ixl-kxq_ctsa._.js +3 -0
- package/.next/standalone/.next/server/chunks/_1ogwigfb0163w._.js +3 -0
- package/.next/standalone/.next/server/chunks/_1vslkoe35wok6._.js +3 -0
- package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_audit_invite_route_actions_0-2n5sy.js → _next-internal_server_app_api_audit_invite_route_actions_0-2n5sycrn1ab.js} +1 -1
- package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_audit_run_route_actions_1qgp9io.js → _next-internal_server_app_api_audit_run_route_actions_1qgp9iombfpdn.js} +1 -1
- package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_audit_status_route_actions_1f7pjof.js → _next-internal_server_app_api_audit_status_route_actions_1f7pjofwh4n7b.js} +1 -1
- package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_login-request_route_actions_1c49co0.js → _next-internal_server_app_api_auth_login-request_route_actions_1c49co0x3-dl8.js} +1 -1
- package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_login-verify_route_actions_1r3slzk.js → _next-internal_server_app_api_auth_login-verify_route_actions_1r3slzk0v320p.js} +1 -1
- package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_logout_route_actions_0regwyr.js → _next-internal_server_app_api_auth_logout_route_actions_0regwyrnie28t.js} +1 -1
- package/.next/standalone/.next/server/chunks/{_next-internal_server_app_api_auth_status_route_actions_1aho9zu.js → _next-internal_server_app_api_auth_status_route_actions_1aho9zu4gx9_5.js} +1 -1
- package/.next/standalone/.next/server/chunks/lib_11qmqmccehybz._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_1sezqnatvr8j-._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_antigravity-projects_ts_0hdx6fkrln72c._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_antigravity-sessions_ts_0jayregp7h3h5._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_auth_api-server-client_ts_1r1w6kn8-org8._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_auth_auth-store_ts_03o40zz0emkkg._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_codex-projects_ts_0di6zenec7h7n._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_codex-sessions_ts_17znrhpys8lz9._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_copilot-projects_ts_00-tojoja20ke._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_copilot-sessions_ts_200_qjwcll3_i._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_cursor-projects_ts_1carno5mv3ix_._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_cursor-sessions_ts_1lq8fkhczl3_y._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_devin-sessions_ts_0kirblxnhsnmd._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_factory-projects_ts_1eo_bk-vm4wdz._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_factory-sessions_ts_0lwe8buimuthh._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_goose-sessions_ts_15jnf4alr5isl._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_hermes-profiles_ts_0jki1620x7wxh._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_hermes-projects_ts_0h9ny-woruqft._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_hermes-sessions_ts_1bo14h38efuti._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_log-entries_ts_0e1mnh5npsol1._.js +3 -0
- package/.next/standalone/.next/server/chunks/{lib_logger_ts_07e65t5._.js → lib_logger_ts_07e65t5sy13vi._.js} +1 -1
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0faqz9x._.js → lib_openclaw-db_ts_0nax8ld9h9ii8._.js} +5 -5
- package/.next/standalone/.next/server/chunks/lib_openclaw-projects_ts_0gc-p24z7gzy8._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_openclaw-sessions_ts_06lc8rgfj4huq._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_opencode-projects_ts_1r-bu98cz4660._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_opencode-sessions_ts_0fdxj6q_np7ll._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_pi-projects_ts_1_cy5lfxd21kv._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_pi-sessions_ts_09ha0x-gi38y1._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_projects_ts_01v279z8xccq4._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_telemetry-id_ts_1k8gj9ot530oy._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw_s81oo._.js +3 -0
- package/.next/standalone/.next/server/chunks/lib_telemetry_ts_1cx7iwiprqsm6._.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oigsgz07._.js +4 -0
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_077n_4ip5__fu._.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p77cu37y._.js +4 -0
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mqvvxcn6v0op._.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0pb7ds5g0vzgn._.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1gasm5xkeqmm3._.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1q1heqmkhh8l4._.js +3 -0
- package/.next/standalone/.next/server/chunks/{package_json_[json]_cjs_1nxcc4v._.js → package_json_[json]_cjs_1nxcc4vkpxxu7._.js} +2 -2
- package/.next/standalone/.next/server/chunks/src_hooks_1aveq0uhs2t1b._.js +5 -0
- package/.next/standalone/.next/server/chunks/src_hooks_1eem5a7cyqlb2._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3h94wnn._.js +12 -0
- package/.next/standalone/.next/server/chunks/src_hooks_daemon-client_ts_0il_yu1zc0291._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_hooks_fp-config_ts_0ow57t1myy6o_._.js +3 -0
- package/.next/standalone/.next/server/chunks/src_hooks_fp-home_ts_09kv0bn_4twyh._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{[externals]__0ilfh9m._.js → [externals]__0ilfh9mfnzsth._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[externals]__0ohnuzs._.js → [externals]__0ohnuzsaozaca._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[externals]__0vmspq5._.js → [externals]__12qr51qgrrt6o._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[externals]_fs_promises_03norioyty3bq._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[externals]_node_net_1yam_zj43-40b._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__075uro8t92s0_._.js +14 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0888k4s6spfmh._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08ch3staq3ejw._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08t6vt57mg_42._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_bflu046ep5j._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bigvy9xmv2ka._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0fdwgktjfhedo._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h1jw32uvrhh0._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h86bl2qf0k_o._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hvw4ifjuhdn7._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pia5h3p8re4c._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s4deza787asx._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vcyntk4snf0f._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-9s1nsw-5q8o._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1-ey9fgesfbc0._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11ujqychsg_3_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__123o89o2a1ht0._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13whohpm024qr._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15bi9em2xe0x2._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15usvs-ms-0hf._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16gb3_92zvk5x._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__18qe-hu0gwqm4._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1_p_9xe520fex._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1_xbg2kx30wp-._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1avi2kypusyb_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1czstykkitjd8._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1fmhm8_s9i4re._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1g76awtnmimd1._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1l1qgu5mfapkh._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ob2uzmms1adf._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pczevlpk5lxh._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r7drlqli-ado._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1vxwetblyf8vp._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[turbopack]_runtime.js +146 -16
- package/.next/standalone/.next/server/chunks/ssr/_0-f9uotv7v2n9._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_00e4_rvim31u_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_00qm74p9x8cwt._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0bseae9u7g98r._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0eoura3_9gjb-._.js +25 -0
- package/.next/standalone/.next/server/chunks/ssr/_0kqw2_f1ywmpo._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0mouhaflye1ro._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0pedwblqdoh58._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0tfqha481f033._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/_1_ozgifqv1ssi._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1a516zcgtqius._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1ddpc5gj57uuf._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1djqs9i27e4kg._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1ew6ra24vt-ij._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1gb0ifpkowwub._.js +234 -0
- package/.next/standalone/.next/server/chunks/ssr/_1or8gixmrpv5i._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1s8zk-upxzp00._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1u9tpla2o6utw._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1v4_ul3sj2lq_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_1y3xzro8ca8t6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_20hn4gn87nsjc._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo5_vm5f.js +17 -0
- package/.next/standalone/.next/server/chunks/ssr/app_087bt9wus25zs._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_0trz6ik19xz5_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_1fvisnppn1unv._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_209u41o446my6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9snixb5fd-._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_audit_0hku_y73ischw._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{app_audit__components_audit-dashboard_tsx_0p9ud47._.js → app_audit__components_audit-dashboard_tsx_0p9ud47q0xq5w._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{app_audit_loading_tsx_1j1kc6j._.js → app_audit_loading_tsx_1j1kc6j4v4-rl._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr0vt64h._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_components_sessions-list_tsx_0gysftd_pn1m8._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_error_tsx_15zfp7nrwf_b6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0w002m_ccu8zg._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x33jqb6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpcz0uxur._.js +8 -0
- package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_error_tsx_08qg6ncy93-17._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{app_project_[name]_loading_tsx_05-l4uf._.js → app_project_[name]_loading_tsx_05-l4uf5vgzpv._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_session_[sessionId]_error_tsx_0rf4j1nefwesi._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{app_project_[name]_session_[sessionId]_loading_tsx_0l4aixs._.js → app_project_[name]_session_[sessionId]_loading_tsx_0l4aixs89x_2g._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{app_projects_loading_tsx_20-3u8b._.js → app_projects_loading_tsx_20-3u8bb2wqz2._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h47jmhhd._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_16jvhmthj_k3a._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_antigravity-projects_ts_0_6zf11xjo990._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_antigravity-sessions_ts_1xf7so6xrlevb._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_codex-projects_ts_0pqlw37q6qrb-._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_copilot-projects_ts_19wl7tpiv2zyg._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_cursor-projects_ts_18-iwyks4twze._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_devin-projects_ts_0a64qdyjacs0k._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_devin-sessions_ts_02u5rpzqjmxdw._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_factory-projects_ts_1uyaahq_zte1q._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_factory-sessions_ts_1tx9qelwapqun._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_format-duration_ts_09vnd_qdginp7._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_goose-projects_ts_0zkscrisyu15q._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_goose-sessions_ts_0-aebo0qkd1z9._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_hermes-profiles_ts_01q9fd6hz34il._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_hermes-projects_ts_05b8-itvkrig2._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_hermes-sessions_ts_076dzms3cnx9r._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_log-entries_ts_0vp7lm0yx4iba._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-projects_ts_0qxq3bp7gsa2t._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-sessions_ts_1f78qf2fle0uv._.js +22 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_opencode-db_ts_18dv-h5ry0uo9._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_opencode-projects_ts_15bjxkmp2wls4._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_pi-projects_ts_1wikofbccx6w1._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/lib_projects_ts_0f-jqrg5ftipx._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{lib_utils_ts_0az0sfq._.js → lib_utils_ts_0az0sfq5wo-3f._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_05vgn62--7c5e._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_09s4n108bqreq._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_0dad4au22rq0p._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_0gxlxpuufujz9._.js +33 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_html-to-image_es_index_15q9vt1a-slcq.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_html-to-image_es_index_1ao30b1.js → node_modules_html-to-image_es_index_1ao30b1e-jmzy.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_0zuikgt2xho-v._.js +271 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0janj0i6dqko7._.js +6 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_158jo-9mwvgad._.js +291 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_19r82zsxo2jj1._.js +291 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1dupwucoqt5qm._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1et9oq9q9-y3v._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j32_ibz4._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js → node_modules_next_dist_client_components_builtin_forbidden_0symwr9mbf-fh.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js → node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0xky89qu.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_compiled_@edge-runtime_cookies_index_1kiz_an963mbg.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0-uvagv_giw2o.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_03c7gi5rntgf9.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_09p-8omsyjg4b.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0dwo94s84hht0.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0v-kfiu0qiy63.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0xrgzyzq__1k6.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1806lsc28_bd0.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1j6dd-erq474h.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1sa65r-crehoe.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_shared_lib_03w27x2kh17_8._.js +23 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0dagmbznysrc2._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuznb72p7z._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/package_json_[json]_cjs_013tntikdft59._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_audit_dashboard-cache_ts_1-v0y_pr_b4vx._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0-q0ummbuhlg5._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_06kzv9ddabn3_._.js +12 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0g194syq7r7ql._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4l1tzrm._.js +12 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1kx9e0dx_1-8o._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_daemon-client_ts_0k41_i7jg6ndv._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_daemon-service_ts_0ibufora3s_bw._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_effective-reviewers_ts_1h4wtvo55j16x._.js +5 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589gp4p60j._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv_2e7f7._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_hook-activity-store_ts_178ewqzp9cvrg._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me658zqmh_._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_semantic_pack-policies_ts_0gh_bu_3oswax._.js +3 -0
- package/.next/standalone/.next/server/instrumentation.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +109 -9
- package/.next/standalone/.next/server/middleware.js +2 -2
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/preview-props.json +5 -0
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +54 -85
- package/.next/standalone/.next/static/chunks/08fodmjweitv-.js +6 -0
- package/.next/standalone/.next/static/chunks/0dr6b-sp478i9.js +1 -0
- package/.next/standalone/.next/static/chunks/0m-tv1y6ghhtk.js +1 -0
- package/.next/standalone/.next/static/chunks/0qeojb9uu_8_e.js +1 -0
- package/.next/standalone/.next/static/chunks/0zw6_ase89dfk.js +1 -0
- package/.next/standalone/.next/static/chunks/1024g0jaymm46.js +1 -0
- package/.next/standalone/.next/static/chunks/165ezyyx0j1ft.js +22 -0
- package/.next/standalone/.next/static/chunks/{1mylcr99gccyz.js → 1v1mi4-0ziecn.js} +2 -2
- package/.next/standalone/.next/static/chunks/{3_e_wg5_oay87.css → 26c4gmdpsthv6.css} +1 -1
- package/.next/standalone/.next/static/chunks/276ifklxc2-x4.js +1 -0
- package/.next/standalone/.next/static/chunks/281u-2vtn53n5.js +1 -0
- package/.next/standalone/.next/static/chunks/2_sj5ssr_m_wm.js +1 -0
- package/.next/standalone/.next/static/chunks/2cn0x2d6tyiuq.js +31 -0
- package/.next/standalone/.next/static/chunks/{34jpdb2xjm-x7.js → 2j5zpvs3pd7mw.js} +1 -1
- package/.next/standalone/.next/static/chunks/2l7j1dpmejuqn.js +1 -0
- package/.next/standalone/.next/static/chunks/2ojf3r8g4tn7s.js +1 -0
- package/.next/standalone/.next/static/chunks/2zyrjasvbmwpq.js +1 -0
- package/.next/standalone/.next/static/chunks/31fan-ze541d1.js +1 -0
- package/.next/standalone/.next/static/chunks/32s3y34p0t2pe.js +1 -0
- package/.next/standalone/.next/static/chunks/36re0fegaocq-.js +1 -0
- package/.next/standalone/.next/static/chunks/3fhk60ouw_ae6.js +1 -0
- package/.next/standalone/.next/static/chunks/3oin924a_3ohe.js +1 -0
- package/.next/standalone/.next/static/chunks/{3zkg2s2vzxc3d.js → 3vpfbqzaue6_i.js} +1 -1
- package/.next/standalone/.next/static/chunks/3xhybr6ywsmdf.js +1 -0
- package/.next/standalone/.next/static/chunks/turbopack-3-ry682tkyiqk.js +1 -0
- package/.next/standalone/fp-cloud-cli/uv.lock +6 -6
- package/.next/standalone/hermes-plugin/plugin.yaml +1 -1
- package/.next/standalone/node_modules/@next/env/package.json +1 -1
- package/.next/standalone/node_modules/next/dist/build/define-env.js +12 -18
- package/.next/standalone/node_modules/next/dist/build/next-config-ts/transpile-config.js +1 -5
- package/.next/standalone/node_modules/next/dist/build/nft.js +119 -0
- package/.next/standalone/node_modules/next/dist/build/segment-config/app/app-segment-config.js +19 -5
- package/.next/standalone/node_modules/next/dist/build/segment-config/app/app-segments.js +120 -29
- package/.next/standalone/node_modules/next/dist/build/segment-config/app/collect-root-param-keys.js +1 -5
- package/.next/standalone/node_modules/next/dist/build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree.js +8 -2
- package/.next/standalone/node_modules/next/dist/build/static-paths/app.js +230 -133
- package/.next/standalone/node_modules/next/dist/build/static-paths/pages.js +8 -40
- package/.next/standalone/node_modules/next/dist/build/static-paths/param-matching.js +200 -0
- package/.next/standalone/node_modules/next/dist/build/swc/index.js +92 -162
- package/.next/standalone/node_modules/next/dist/build/utils.js +180 -90
- package/.next/standalone/node_modules/next/dist/cli/next-test.js +4 -0
- package/.next/standalone/node_modules/next/dist/client/app-call-server.js +16 -18
- package/.next/standalone/node_modules/next/dist/client/components/app-router-instance.js +43 -187
- package/.next/standalone/node_modules/next/dist/client/components/{segment-cache/navigation.js → app-router-state.js} +88 -334
- package/.next/standalone/node_modules/next/dist/client/components/app-router-utils.js +1 -5
- package/.next/standalone/node_modules/next/dist/client/components/app-router.js +83 -74
- package/.next/standalone/node_modules/next/dist/client/components/dev-root-http-access-fallback-boundary.js +1 -5
- package/.next/standalone/node_modules/next/dist/client/components/forbidden.js +2 -10
- package/.next/standalone/node_modules/next/dist/client/components/handle-isr-error.js +19 -4
- package/.next/standalone/node_modules/next/dist/client/components/instant-samples.js +4 -11
- package/.next/standalone/node_modules/next/dist/client/components/links.js +6 -7
- package/.next/standalone/node_modules/next/dist/client/components/navigation-dynamic-rendering.js +3 -3
- package/.next/standalone/node_modules/next/dist/client/components/navigation-untracked.js +1 -2
- package/.next/standalone/node_modules/next/dist/client/components/navigation.js +2 -6
- package/.next/standalone/node_modules/next/dist/client/components/navigation.react-server.js +1 -5
- package/.next/standalone/node_modules/next/dist/client/components/navigator.js +73 -0
- package/.next/standalone/node_modules/next/dist/client/components/not-found.js +1 -5
- package/.next/standalone/node_modules/next/dist/client/components/prefetch.js +83 -0
- package/.next/standalone/node_modules/next/dist/client/components/readonly-url-search-params.js +0 -5
- package/.next/standalone/node_modules/next/dist/client/components/redirect.js +3 -15
- package/.next/standalone/node_modules/next/dist/client/components/{router-reducer/ppr-navigations.js → render-tree.js} +365 -400
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/compute-changed-path.js +13 -5
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +67 -54
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-router-cache-key.js +1 -7
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/create-segment-key.js +42 -0
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +71 -50
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/is-navigating-to-new-root-layout.js +4 -4
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/hmr-refresh-reducer.js +2 -2
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +5 -5
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +11 -8
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +12 -9
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +30 -29
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +5 -5
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer.js +2 -10
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/bfcache.js +11 -21
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/cache.js +1168 -1181
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/decode-server-response.js +419 -0
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/navigation-testing-lock.js +1 -1
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/optimistic-routes.js +77 -82
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/scheduler.js +464 -425
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/types.js +12 -3
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/vary-path.js +140 -126
- package/.next/standalone/node_modules/next/dist/client/components/sequential-router-queue.js +163 -0
- package/.next/standalone/node_modules/next/dist/client/components/unauthorized.js +2 -10
- package/.next/standalone/node_modules/next/dist/client/components/unstable-rethrow.js +1 -2
- package/.next/standalone/node_modules/next/dist/client/components/use-action-queue.js +2 -10
- package/.next/standalone/node_modules/next/dist/client/dev/debug-channel.js +6 -323
- package/.next/standalone/node_modules/next/dist/client/flight-data-helpers.js +41 -94
- package/.next/standalone/node_modules/next/dist/client/route-params.js +34 -12
- package/.next/standalone/node_modules/next/dist/client/sequential-call-server.js +45 -0
- package/.next/standalone/node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +203 -59
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +203 -59
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +5 -3
- package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +13 -13
- package/.next/standalone/node_modules/next/dist/compiled/react-is/package.json +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/stacktrace-parser/stack-trace-parser.cjs.js +1 -1
- package/.next/standalone/node_modules/next/dist/experimental/testmode/fetch.js +2 -10
- package/.next/standalone/node_modules/next/dist/export/helpers/create-incremental-cache.js +21 -16
- package/.next/standalone/node_modules/next/dist/export/utils.js +37 -0
- package/.next/standalone/node_modules/next/dist/lib/batcher.js +2 -2
- package/.next/standalone/node_modules/next/dist/lib/dist-dir.js +88 -0
- package/.next/standalone/node_modules/next/dist/lib/download-swc.js +2 -10
- package/.next/standalone/node_modules/next/dist/lib/fallback.js +3 -15
- package/.next/standalone/node_modules/next/dist/lib/find-pages-dir.js +2 -10
- package/.next/standalone/node_modules/next/dist/lib/helpers/get-cache-directory.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/helpers/get-npx-command.js +1 -1
- package/.next/standalone/node_modules/next/dist/lib/helpers/get-registry.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/helpers/git.js +52 -7
- package/.next/standalone/node_modules/next/dist/lib/inline-static-env.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/is-error.js +3 -15
- package/.next/standalone/node_modules/next/dist/lib/is-serializable-props.js +6 -35
- package/.next/standalone/node_modules/next/dist/lib/metadata/index.js +18 -0
- package/.next/standalone/node_modules/next/dist/lib/metadata/metadata-elements.js +1498 -0
- package/.next/standalone/node_modules/next/dist/lib/metadata/metadata-parallel.js +175 -0
- package/.next/standalone/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js +467 -0
- package/.next/standalone/node_modules/next/dist/lib/metadata/metadata.js +30 -1516
- package/.next/standalone/node_modules/next/dist/lib/metadata/resolve-metadata-parallel.js +632 -0
- package/.next/standalone/node_modules/next/dist/lib/metadata/resolve-metadata.js +15 -414
- package/.next/standalone/node_modules/next/dist/lib/mkcert.js +4 -20
- package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +4 -8
- package/.next/standalone/node_modules/next/dist/lib/picocolors.js +10 -0
- package/.next/standalone/node_modules/next/dist/lib/pretty-bytes.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/recursive-delete.js +50 -11
- package/.next/standalone/node_modules/next/dist/lib/resolve-build-paths.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/resolve-from.js +2 -10
- package/.next/standalone/node_modules/next/dist/lib/static-env.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +3 -15
- package/.next/standalone/node_modules/next/dist/lib/typescript/missingDependencyError.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeCheck.js +1 -9
- package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeCheckCli.js +0 -1
- package/.next/standalone/node_modules/next/dist/lib/typescript/runTypeScriptCli.js +4 -16
- package/.next/standalone/node_modules/next/dist/lib/verify-partytown-setup.js +1 -5
- package/.next/standalone/node_modules/next/dist/lib/warn-missing-react-dependencies.js +33 -0
- package/.next/standalone/node_modules/next/dist/lib/worker.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/accept-header.js +3 -15
- package/.next/standalone/node_modules/next/dist/server/after/after-context.js +5 -25
- package/.next/standalone/node_modules/next/dist/server/after/after.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/after/awaiter.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/after/run-with-after.js +2 -2
- package/.next/standalone/node_modules/next/dist/server/api-utils/index.js +1 -10
- package/.next/standalone/node_modules/next/dist/server/api-utils/node/api-resolver.js +10 -50
- package/.next/standalone/node_modules/next/dist/server/api-utils/node/parse-body.js +3 -15
- package/.next/standalone/node_modules/next/dist/server/app-render/action-async-storage-instance.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/action-handler.js +104 -141
- package/.next/standalone/node_modules/next/dist/server/app-render/after-task-async-storage-instance.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +6 -30
- package/.next/standalone/node_modules/next/dist/server/app-render/app-render-render-utils.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/app-render/app-render-scheduling.js +3 -15
- package/.next/standalone/node_modules/next/dist/server/app-render/app-render.js +1346 -1211
- package/.next/standalone/node_modules/next/dist/server/app-render/async-local-storage.js +11 -6
- package/.next/standalone/node_modules/next/dist/server/app-render/blocking-route-messages.js +119 -70
- package/.next/standalone/node_modules/next/dist/server/app-render/cache-signal.js +61 -35
- package/.next/standalone/node_modules/next/dist/server/app-render/collect-segment-data.js +326 -260
- package/.next/standalone/node_modules/next/dist/server/app-render/console-async-storage-instance.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/create-component-tree.js +136 -160
- package/.next/standalone/node_modules/next/dist/server/app-render/create-error-handler.js +12 -6
- package/.next/standalone/node_modules/next/dist/server/app-render/create-transport-tree-from-loader-tree.js +190 -0
- package/.next/standalone/node_modules/next/dist/server/app-render/debug-channel-server.web.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/app-render/dev-validation-error-delivery.js +1 -10
- package/.next/standalone/node_modules/next/dist/server/app-render/dev-validation-scheduler.js +4 -5
- package/.next/standalone/node_modules/next/dist/server/app-render/dev-validation-worker-snapshot.js +3 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js +26 -3
- package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-rendering-client.js +124 -0
- package/.next/standalone/node_modules/next/dist/server/app-render/dynamic-rendering.js +260 -329
- package/.next/standalone/node_modules/next/dist/server/app-render/encryption-utils.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/app-render/encryption.js +4 -17
- package/.next/standalone/node_modules/next/dist/server/app-render/entry-base.js +1 -6
- package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-impl.js +3 -12
- package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js +2 -2
- package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-config.js +4 -12
- package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js +13 -62
- package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-validation.js +145 -206
- package/.next/standalone/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/app-render/manifests-singleton.js +110 -38
- package/.next/standalone/node_modules/next/dist/server/app-render/module-loading/track-dynamic-import.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js +3 -15
- package/.next/standalone/node_modules/next/dist/server/app-render/postponed-state.js +87 -51
- package/.next/standalone/node_modules/next/dist/server/app-render/prospective-render-utils.js +2 -6
- package/.next/standalone/node_modules/next/dist/server/app-render/render-in-browser.js +27 -0
- package/.next/standalone/node_modules/next/dist/server/app-render/required-scripts.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/app-render/rsc/taint.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/app-render/segment-config/ensure-static.js +206 -0
- package/.next/standalone/node_modules/next/dist/server/app-render/staged-rendering.js +46 -54
- package/.next/standalone/node_modules/next/dist/server/app-render/stream-ops.node.js +18 -12
- package/.next/standalone/node_modules/next/dist/server/app-render/stream-ops.web.js +4 -20
- package/.next/standalone/node_modules/next/dist/server/app-render/sync-io-messages.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/app-render/types.js +2 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/use-flight-response.js +4 -17
- package/.next/standalone/node_modules/next/dist/server/app-render/vary-params.js +12 -11
- package/.next/standalone/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +95 -97
- package/.next/standalone/node_modules/next/dist/server/app-render/work-async-storage-instance.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +36 -26
- package/.next/standalone/node_modules/next/dist/server/async-storage/draft-mode-provider.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/async-storage/request-store.js +6 -5
- package/.next/standalone/node_modules/next/dist/server/async-storage/work-store.js +24 -26
- package/.next/standalone/node_modules/next/dist/server/base-http/node.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/base-http/web.js +4 -12
- package/.next/standalone/node_modules/next/dist/server/base-server.js +346 -155
- package/.next/standalone/node_modules/next/dist/server/client-component-renderer-logger.js +129 -28
- package/.next/standalone/node_modules/next/dist/server/config-schema.js +61 -9
- package/.next/standalone/node_modules/next/dist/server/config-shared.js +26 -4
- package/.next/standalone/node_modules/next/dist/server/config.js +154 -332
- package/.next/standalone/node_modules/next/dist/server/dev/debug-channel.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/dev/dev-validation-worker-pool.js +1 -0
- package/.next/standalone/node_modules/next/dist/server/dev/get-source-map-from-file.js +5 -25
- package/.next/standalone/node_modules/next/dist/server/dev/hot-middleware.js +27 -1
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +338 -200
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-types.js +3 -0
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +26 -20
- package/.next/standalone/node_modules/next/dist/server/dev/messages.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/dev/middleware-turbopack.js +4 -20
- package/.next/standalone/node_modules/next/dist/server/dev/middleware-webpack.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/dev/node-stack-frames.js +2 -19
- package/.next/standalone/node_modules/next/dist/server/dev/on-demand-entry-handler.js +12 -12
- package/.next/standalone/node_modules/next/dist/server/dev/runtime-error-state.js +220 -0
- package/.next/standalone/node_modules/next/dist/server/dev/serialized-errors.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/dev/static-paths-worker.js +16 -15
- package/.next/standalone/node_modules/next/dist/server/dev/turbopack-utils.js +20 -36
- package/.next/standalone/node_modules/next/dist/server/dev/use-cache-probe-pool.js +1 -0
- package/.next/standalone/node_modules/next/dist/server/dev/use-cache-probe-worker.js +4 -3
- package/.next/standalone/node_modules/next/dist/server/dynamic-rendering-utils.js +298 -55
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/detect-content-type.js +229 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/extract-etag.js +53 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/get-image-size.js +25 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/get-max-age.js +41 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/get-previously-cached-image-or-null.js +22 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/image-error.js +23 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/image-type.js +86 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer/transform.js +227 -0
- package/.next/standalone/node_modules/next/dist/server/image-optimizer.js +78 -674
- package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +19 -9
- package/.next/standalone/node_modules/next/dist/server/lib/cache-handlers/default.js +9 -13
- package/.next/standalone/node_modules/next/dist/server/lib/chrome-devtools-workspace.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/dedupe-fetch.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/dev-bundler-service.js +6 -6
- package/.next/standalone/node_modules/next/dist/server/lib/generate-agent-files.js +158 -35
- package/.next/standalone/node_modules/next/dist/server/lib/i18n-provider.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +14 -20
- package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/index.js +19 -29
- package/.next/standalone/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/lazy-module.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/lru-cache.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/mock-request.js +24 -120
- package/.next/standalone/node_modules/next/dist/server/lib/module-loader/node-module-loader.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/module-loader/route-module-loader.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/params-utils.js +0 -18
- package/.next/standalone/node_modules/next/dist/server/lib/patch-fetch.js +44 -38
- package/.next/standalone/node_modules/next/dist/server/lib/postponed-request-body.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/render-server.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/lib/router-server.js +106 -36
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/build-data-route.js +26 -3
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/cache-life-type-utils.js +14 -45
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/decode-path-params.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/filesystem.js +212 -31
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/instrumentation-globals.external.js +61 -1
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/instrumentation-node-extensions.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/normalize-catchall-routes.js +320 -0
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/proxy-request.js +2 -2
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +17 -11
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/strict-route-matching-config.js +28 -0
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/typegen.js +56 -10
- package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +48 -38
- package/.next/standalone/node_modules/next/dist/server/lib/trace/constants.js +40 -0
- package/.next/standalone/node_modules/next/dist/server/lib/trace/request-insights-identity.js +1 -3
- package/.next/standalone/node_modules/next/dist/server/lib/trace/tracer.js +10 -10
- package/.next/standalone/node_modules/next/dist/server/lib/utils.js +66 -15
- package/.next/standalone/node_modules/next/dist/server/lib/worker-utils.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/load-components.js +7 -2
- package/.next/standalone/node_modules/next/dist/server/load-manifest.external.js +16 -17
- package/.next/standalone/node_modules/next/dist/server/mcp/tools/utils/browser-communication.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/mcp/tools/utils/format-errors.js +5 -5
- package/.next/standalone/node_modules/next/dist/server/next-server.js +130 -124
- package/.next/standalone/node_modules/next/dist/server/next.js +25 -37
- package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/console-dim.external.js +1 -2
- package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +115 -62
- package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/global-behaviors.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/io-utils.js +11 -10
- package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/process-error-handlers.js +0 -9
- package/.next/standalone/node_modules/next/dist/server/node-environment-extensions/unhandled-rejection.external.js +1 -12
- package/.next/standalone/node_modules/next/dist/server/normalizers/built/app/app-page-normalizer.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/normalizers/request/base-path.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/normalizers/request/next-data.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/normalizers/request/prefix.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/og/cache-image-response.js +2 -7
- package/.next/standalone/node_modules/next/dist/server/patch-error-inspect.js +19 -11
- package/.next/standalone/node_modules/next/dist/server/pipe-readable.js +42 -30
- package/.next/standalone/node_modules/next/dist/server/render-result.js +5 -17
- package/.next/standalone/node_modules/next/dist/server/render.js +37 -183
- package/.next/standalone/node_modules/next/dist/server/request/cache-stages.js +250 -0
- package/.next/standalone/node_modules/next/dist/server/request/connection.js +9 -40
- package/.next/standalone/node_modules/next/dist/server/request/cookies.js +11 -46
- package/.next/standalone/node_modules/next/dist/server/request/draft-mode.js +14 -60
- package/.next/standalone/node_modules/next/dist/server/request/fallback-params.js +23 -9
- package/.next/standalone/node_modules/next/dist/server/request/headers.js +10 -44
- package/.next/standalone/node_modules/next/dist/server/request/io.js +2 -11
- package/.next/standalone/node_modules/next/dist/server/request/params.js +62 -196
- package/.next/standalone/node_modules/next/dist/server/request/pathname.js +9 -61
- package/.next/standalone/node_modules/next/dist/server/request/root-params.js +25 -81
- package/.next/standalone/node_modules/next/dist/server/request/search-params.js +42 -119
- package/.next/standalone/node_modules/next/dist/server/request/utils.js +3 -10
- package/.next/standalone/node_modules/next/dist/server/response-cache/index.js +54 -32
- package/.next/standalone/node_modules/next/dist/server/response-cache/utils.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/response-cache/web.js +5 -2
- package/.next/standalone/node_modules/next/dist/server/resume-data-cache/cache-store.js +18 -0
- package/.next/standalone/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +51 -49
- package/.next/standalone/node_modules/next/dist/server/revalidation-utils.js +15 -13
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/dev-render-context.js +23 -0
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/helpers/prerender-manifest-matcher.js +5 -4
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/module.js +13 -1
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/module.render.js +26 -11
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/parse-request-headers.js +58 -0
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/entrypoints.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/entrypoints.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/helpers/auto-implement-methods.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/route-modules/app-route/module.js +399 -432
- package/.next/standalone/node_modules/next/dist/server/route-modules/pages/module.render.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/route-modules/pages/pages-handler.js +20 -16
- package/.next/standalone/node_modules/next/dist/server/route-modules/pages-api/module.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/route-modules/route-module.js +57 -61
- package/.next/standalone/node_modules/next/dist/server/serve-static.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/setup-http-agent-env.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/stream-utils/encoded-tags.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +7 -11
- package/.next/standalone/node_modules/next/dist/server/typescript/constant.js +2 -0
- package/.next/standalone/node_modules/next/dist/server/typescript/rules/config.js +29 -2
- package/.next/standalone/node_modules/next/dist/server/use-cache/cache-life-profile.js +6 -30
- package/.next/standalone/node_modules/next/dist/server/use-cache/cache-life.js +9 -32
- package/.next/standalone/node_modules/next/dist/server/use-cache/cache-tag.js +6 -12
- package/.next/standalone/node_modules/next/dist/server/use-cache/constants.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/use-cache/handlers.js +27 -36
- package/.next/standalone/node_modules/next/dist/server/use-cache/tiered-cache-handler.js +6 -4
- package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-errors.js +18 -19
- package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-messages.js +190 -0
- package/.next/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +485 -407
- package/.next/standalone/node_modules/next/dist/server/web/adapter.js +14 -35
- package/.next/standalone/node_modules/next/dist/server/web/edge-route-module-wrapper.js +6 -7
- package/.next/standalone/node_modules/next/dist/server/web/error.js +0 -15
- package/.next/standalone/node_modules/next/dist/server/web/globals.js +3 -15
- package/.next/standalone/node_modules/next/dist/server/web/next-url.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/web/sandbox/context.js +10 -34
- package/.next/standalone/node_modules/next/dist/server/web/sandbox/sandbox.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/headers.js +0 -5
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js +0 -5
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/fetch-event.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/image-response.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/response.js +2 -10
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/revalidate.js +28 -66
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/unstable-cache.js +14 -22
- package/.next/standalone/node_modules/next/dist/server/web/spec-extension/unstable-no-store.js +1 -2
- package/.next/standalone/node_modules/next/dist/server/web/utils.js +1 -5
- package/.next/standalone/node_modules/next/dist/server/web/web-on-close.js +2 -10
- package/.next/standalone/node_modules/next/dist/shared/lib/app-router-types.js +38 -28
- package/.next/standalone/node_modules/next/dist/shared/lib/constants.js +5 -0
- package/.next/standalone/node_modules/next/dist/shared/lib/deployment-id.js +1 -1
- package/.next/standalone/node_modules/next/dist/shared/lib/errors/code-frame.js +3 -2
- package/.next/standalone/node_modules/next/dist/shared/lib/errors/empty-generate-static-params-error.js +1 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/errors/ensure-static-gsp-errors.js +30 -0
- package/.next/standalone/node_modules/next/dist/shared/lib/errors/hard-deprecated-config-error.js +0 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/html-context.shared-runtime.js +1 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/image-config.js +52 -1
- package/.next/standalone/node_modules/next/dist/shared/lib/instant-messages.js +2 -10
- package/.next/standalone/node_modules/next/dist/shared/lib/invariant-error.js +0 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/lazy-dynamic/react-browser-bailout.js +45 -0
- package/.next/standalone/node_modules/next/dist/shared/lib/magic-identifier.js +198 -0
- package/.next/standalone/node_modules/next/dist/shared/lib/match-remote-pattern.js +1 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/router/routes/app.js +3 -15
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/app-paths.js +6 -1
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +4 -12
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/interception-routes.js +63 -20
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js +1 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/prepare-destination.js +1 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/querystring.js +31 -0
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/resolve-param-value.js +1 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/route-matcher.js +1 -5
- package/.next/standalone/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js +11 -55
- package/.next/standalone/node_modules/next/dist/shared/lib/rsc-transport.js +108 -0
- package/.next/standalone/node_modules/next/dist/shared/lib/segment-cache/segment-value-encoding.js +0 -13
- package/.next/standalone/node_modules/next/dist/shared/lib/segment-cache/vary-params-decoding.js +48 -27
- package/.next/standalone/node_modules/next/dist/shared/lib/segment.js +1 -13
- package/.next/standalone/node_modules/next/dist/shared/lib/turbopack/internal-error.js +2 -7
- package/.next/standalone/node_modules/next/dist/shared/lib/utils.js +2 -11
- package/.next/standalone/node_modules/next/dist/shared/lib/zod.js +2 -6
- package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/detached-flush.js +8 -15
- package/.next/standalone/node_modules/next/dist/telemetry/events/build.js +1 -2
- package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/.next/standalone/node_modules/next/dist/telemetry/post-telemetry-payload.js +1 -5
- package/.next/standalone/node_modules/next/dist/telemetry/storage.js +31 -19
- package/.next/standalone/node_modules/next/dist/trace/report/index.js +5 -2
- package/.next/standalone/node_modules/next/dist/trace/report/to-json-build.js +4 -2
- package/.next/standalone/node_modules/next/dist/trace/report/to-json.js +141 -97
- package/.next/standalone/node_modules/next/dist/trace/trace.js +14 -9
- package/.next/standalone/node_modules/next/package.json +11 -10
- package/.next/standalone/package.json +11 -11
- package/.next/standalone/sdk/python/uv.lock +30 -115
- package/.next/standalone/sdk/typescript/CHANGELOG.md +11 -0
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package-lock.json +16 -4
- package/.next/standalone/sdk/typescript/integration/fixtures/mastra-1/package.json +3 -0
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +2 -2
- package/dist/cli.mjs +27125 -26785
- package/dist/worker.mjs +117 -111
- package/hermes-plugin/plugin.yaml +1 -1
- package/package.json +11 -11
- package/scripts/skew-log-filter.ts +5 -1
- package/src/hooks/cloud-connection.ts +86 -17
- package/src/hooks/cloud-enrollment.ts +4 -3
- package/src/hooks/cloud-managed-policies.ts +15 -11
- package/src/hooks/codex-system-hooks.ts +687 -0
- package/src/hooks/collector-config.ts +5 -4
- package/src/hooks/config-status.ts +47 -114
- package/src/hooks/configure-wizard.ts +55 -65
- package/src/hooks/credential-recovery.ts +36 -0
- package/src/hooks/daemon-service.ts +2 -2
- package/src/hooks/delivery-health.ts +20 -9
- package/src/hooks/fp-config.ts +17 -5
- package/src/hooks/fp-home.ts +1 -1
- package/src/hooks/integrations.ts +16 -0
- package/src/hooks/manager.ts +62 -2
- package/src/hooks/otel-cli.ts +51 -20
- package/src/hooks/otel-writers.ts +26 -17
- package/src/hooks/uninstall-cli.ts +28 -7
- package/.next/standalone/.next/server/chunks/[externals]__1_9ze9b._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0--lkk6._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__03r-lqq._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__08dchfu._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__08w4wmd._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_0xu5z._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0f7mikp._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g6bbuw._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ga9hs7._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l3yhx4._.js +0 -160
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0moxohc._.js +0 -22
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q-v9z2._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q0qzx1._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rv7m0k._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z2ll-a._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zlqo2t._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__12021ot._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__17g9wh7._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1adacul._.js +0 -165
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1anxb5k._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1autwno._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ffkmds._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1jm9fw6._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1l71g3y._.js +0 -22
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1legmza._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ou2ehh._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qb590j._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1shcqgr._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1v25n-6._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1w9zl9-._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1xuedea._.js +0 -3
- package/.next/standalone/.next/server/chunks/_09dz7xv._.js +0 -27
- package/.next/standalone/.next/server/chunks/_0p53ge1._.js +0 -3
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +0 -3
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +0 -3
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +0 -33
- package/.next/standalone/.next/server/chunks/_1fz8m31._.js +0 -3
- package/.next/standalone/.next/server/chunks/_1jrv3hg._.js +0 -3
- package/.next/standalone/.next/server/chunks/_1nx8fim._.js +0 -3
- package/.next/standalone/.next/server/chunks/_1ogwigf._.js +0 -3
- package/.next/standalone/.next/server/chunks/_1q27azx._.js +0 -3
- package/.next/standalone/.next/server/chunks/_1vslkoe._.js +0 -3
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_download_[project]_[session]_route_actions_1is7vs7.js +0 -3
- package/.next/standalone/.next/server/chunks/lib_16xa545._.js +0 -3
- package/.next/standalone/.next/server/chunks/lib_factory-projects_ts_1eo_bk-._.js +0 -3
- package/.next/standalone/.next/server/chunks/lib_openclaw-projects_ts_0gc-p24._.js +0 -3
- package/.next/standalone/.next/server/chunks/lib_telemetry-id_ts_1k8gj9o._.js +0 -3
- package/.next/standalone/.next/server/chunks/lib_telemetry_ts_0dctyyw._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +0 -4
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +0 -4
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0ol5pa3._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1rqmk27._.js +0 -3
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_1w7tiq4._.js +0 -3
- package/.next/standalone/.next/server/chunks/src_hooks_1aveq0u._.js +0 -5
- package/.next/standalone/.next/server/chunks/src_hooks_1eem5a7._.js +0 -3
- package/.next/standalone/.next/server/chunks/src_hooks_custom-hooks-loader_ts_0lnb3n3._.js +0 -12
- package/.next/standalone/.next/server/chunks/src_hooks_fp-home_ts_09kv0bn._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0502lat._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0576iuy._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__059yza8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05r_17v._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__06pflha._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0_gn5iz._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e2l3c1._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0eip4_k._.js +0 -22
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0er05u0._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0f765xr._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h38gzz._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hci7t3._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0hoaz1g._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0mxmwtx._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p84xee._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0qcb0mg._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0sjzdjg._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0uescqv._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13d-wb6._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1484zv2._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__19dutr7._.js +0 -14
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1_qv8oh._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ab4ifb._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1b2dbet._.js +0 -33
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1dinjii._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1fbrk56._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1kaotix._.js +0 -22
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1py795m._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qapotl._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1qiz0e4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1um4yxn._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1v185mo._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1wb4yt2._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1y3n3cn._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1zl_r0t._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0-yi74u._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0lnpwk8._.js +0 -23
- package/.next/standalone/.next/server/chunks/ssr/_0uyu3jf._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0wso5d3._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1-3unkg._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_15y8myg._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1_ozgif._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1gb0ifp._.js +0 -232
- package/.next/standalone/.next/server/chunks/ssr/_1o95rf0._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1q46vxx._.js +0 -22
- package/.next/standalone/.next/server/chunks/ssr/_1thr5rf._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1y3xzro._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_1ylae7o._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +0 -16
- package/.next/standalone/.next/server/chunks/ssr/app_087bt9w._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_1fvisnp._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_209u41o._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_components_project-list_tsx_1ke6anr._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_error_tsx_15zfp7n._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0w002m_._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +0 -8
- package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_error_tsx_08qg6nc._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_project_[name]_session_[sessionId]_error_tsx_0rf4j1n._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_1cf5ya2._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_antigravity-projects_ts_0_6zf11._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_codex-projects_ts_0pqlw37._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_copilot-projects_ts_19wl7tp._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_cursor-projects_ts_18-iwyk._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_devin-projects_ts_0a64qdy._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_factory-projects_ts_1uyaahq._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_goose-projects_ts_0zkscri._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_hermes-projects_ts_05b8-it._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_openclaw-projects_ts_0qxq3bp._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_opencode-projects_ts_15bjxkm._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/lib_pi-projects_ts_1wikofb._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_1hl81y4._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_0aiy-os._.js +0 -131
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0nkkbfv._.js +0 -6
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_0w6mzq5._.js +0 -151
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_18_d8l1._.js +0 -151
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_1v8aef8._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0-q0umm._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_06kzv9d._.js +0 -12
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_0g194sy._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1cv9_c4._.js +0 -12
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_1kx9e0d._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_effective-reviewers_ts_1h4wtvo._.js +0 -5
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-config_ts_04t589g._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_fp-home_ts_0je3xkv._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_pack-cli_ts_0t7me65._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_semantic_pack-policies_ts_0gh_bu_._.js +0 -3
- package/.next/standalone/.next/static/chunks/0pra9i676pym1.js +0 -1
- package/.next/standalone/.next/static/chunks/1-lpi0m-hc1kb.js +0 -1
- package/.next/standalone/.next/static/chunks/17yvyyblr_eb5.js +0 -1
- package/.next/standalone/.next/static/chunks/1c6aptmytnu6q.js +0 -1
- package/.next/standalone/.next/static/chunks/1eyl7fzkmnkf_.js +0 -1
- package/.next/standalone/.next/static/chunks/1wozchtn2etvh.js +0 -1
- package/.next/standalone/.next/static/chunks/1xacnwjkbekn7.js +0 -1
- package/.next/standalone/.next/static/chunks/23thtelz1a-ur.js +0 -6
- package/.next/standalone/.next/static/chunks/2bc17tohgs4bs.js +0 -1
- package/.next/standalone/.next/static/chunks/2hg_bp8z_vm2g.js +0 -1
- package/.next/standalone/.next/static/chunks/2xq-ejo8kti18.js +0 -1
- package/.next/standalone/.next/static/chunks/2yuzx8716maf0.js +0 -1
- package/.next/standalone/.next/static/chunks/3-_pth_c9n938.js +0 -1
- package/.next/standalone/.next/static/chunks/35fgpd_feci6x.js +0 -1
- package/.next/standalone/.next/static/chunks/3n46e45atic-m.js +0 -22
- package/.next/standalone/.next/static/chunks/3q7sndqftqhw9.js +0 -1
- package/.next/standalone/.next/static/chunks/3qfoeqhy5l10x.js +0 -1
- package/.next/standalone/.next/static/chunks/3sg07wnn969xq.js +0 -31
- package/.next/standalone/.next/static/chunks/3xpjn3cdgm-7m.js +0 -1
- package/.next/standalone/.next/static/chunks/4448_qq7bd963.js +0 -1
- package/.next/standalone/.next/static/chunks/turbopack-1opxka4dtjbc5.js +0 -1
- package/.next/standalone/node_modules/next/dist/client/components/match-segments.js +0 -32
- package/.next/standalone/node_modules/next/dist/client/components/router-reducer/reducers/find-head-in-cache.js +0 -63
- package/.next/standalone/node_modules/next/dist/client/components/segment-cache/prefetch.js +0 -32
- package/.next/standalone/node_modules/next/dist/lib/detached-promise.js +0 -32
- package/.next/standalone/node_modules/next/dist/lib/error-telemetry-utils.js +0 -42
- package/.next/standalone/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js +0 -154
- package/.next/standalone/node_modules/next/dist/server/app-render/rsc/postpone.js +0 -18
- package/.next/standalone/node_modules/next/dist/server/lib/experimental/ppr.js +0 -47
- package/.next/standalone/node_modules/next/dist/server/lib/router-utils/is-postpone.js +0 -16
- package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/default-route-matcher-manager.js +0 -239
- package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/dev-route-matcher-manager.js +0 -120
- package/.next/standalone/node_modules/next/dist/server/route-matcher-managers/route-matcher-manager.js +0 -6
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/app-page-route-matcher-provider.js +0 -55
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/app-route-route-matcher-provider.js +0 -43
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-page-route-matcher-provider.js +0 -91
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-route-route-matcher-provider.js +0 -112
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-api-route-matcher-provider.js +0 -77
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-route-matcher-provider.js +0 -77
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/file-cache-route-matcher-provider.js +0 -28
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/batched-file-reader.js +0 -106
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/default-file-reader.js +0 -42
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/file-reader.js +0 -6
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/cached-route-matcher-provider.js +0 -30
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/manifest-loader.js +0 -6
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/node-manifest-loader.js +0 -34
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/server-manifest-loader.js +0 -20
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/manifest-route-matcher-provider.js +0 -21
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/pages-api-route-matcher-provider.js +0 -55
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/pages-route-matcher-provider.js +0 -64
- package/.next/standalone/node_modules/next/dist/server/route-matcher-providers/route-matcher-provider.js +0 -6
- package/.next/standalone/node_modules/next/dist/server/route-matchers/app-page-route-matcher.js +0 -18
- package/.next/standalone/node_modules/next/dist/server/route-matchers/app-route-route-matcher.js +0 -15
- package/.next/standalone/node_modules/next/dist/server/route-matchers/locale-route-matcher.js +0 -68
- package/.next/standalone/node_modules/next/dist/server/route-matchers/pages-api-route-matcher.js +0 -30
- package/.next/standalone/node_modules/next/dist/server/route-matchers/pages-route-matcher.js +0 -30
- package/.next/standalone/node_modules/next/dist/server/route-matchers/route-matcher.js +0 -54
- /package/.next/standalone/.next/static/{xtcpqBNBdjQVerPMkI2HI → RrRjb2981tB2X7pKdNBUm}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{xtcpqBNBdjQVerPMkI2HI → RrRjb2981tB2X7pKdNBUm}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{xtcpqBNBdjQVerPMkI2HI → RrRjb2981tB2X7pKdNBUm}/_ssgManifest.js +0 -0
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
0 && (module.exports = {
|
|
6
6
|
PrefetchingMode: null,
|
|
7
|
+
prerenderToHTMLOrFlight: null,
|
|
7
8
|
renderToHTMLOrFlight: null,
|
|
8
9
|
runValidationInDevFromSnapshot: null,
|
|
9
10
|
toValidationRenderContext: null
|
|
@@ -18,6 +19,9 @@ _export(exports, {
|
|
|
18
19
|
PrefetchingMode: function() {
|
|
19
20
|
return PrefetchingMode;
|
|
20
21
|
},
|
|
22
|
+
prerenderToHTMLOrFlight: function() {
|
|
23
|
+
return prerenderToHTMLOrFlight;
|
|
24
|
+
},
|
|
21
25
|
renderToHTMLOrFlight: function() {
|
|
22
26
|
return renderToHTMLOrFlight;
|
|
23
27
|
},
|
|
@@ -33,15 +37,17 @@ const _approutertypes = require("../../shared/lib/app-router-types");
|
|
|
33
37
|
const _workasyncstorageexternal = require("../app-render/work-async-storage.external");
|
|
34
38
|
const _getpagefiles = require("../get-page-files");
|
|
35
39
|
const _entryconstants = require("../../shared/lib/entry-constants");
|
|
40
|
+
const _constants = require("../use-cache/constants");
|
|
36
41
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
37
42
|
const _renderresult = /*#__PURE__*/ _interop_require_default(require("../render-result"));
|
|
38
43
|
const _streamops = require("./stream-ops");
|
|
44
|
+
const _renderinbrowser = require("./render-in-browser");
|
|
39
45
|
const _instanttestbootstrap = require("./instant-test-bootstrap");
|
|
40
46
|
const _internalutils = require("../internal-utils");
|
|
47
|
+
const _querystring = require("../../shared/lib/router/utils/querystring");
|
|
41
48
|
const _approuterheaders = require("../../client/components/app-router-headers");
|
|
42
49
|
const _metadatacontext = require("../../lib/metadata/metadata-context");
|
|
43
50
|
const _requeststore = require("../async-storage/request-store");
|
|
44
|
-
const _isrscrequest = require("../lib/is-rsc-request");
|
|
45
51
|
const _workstore = require("../async-storage/work-store");
|
|
46
52
|
const _devvalidationevents = require("./dev-validation-events");
|
|
47
53
|
const _asynclocalstorage = require("./async-local-storage");
|
|
@@ -51,7 +57,7 @@ const _httpaccessfallback = require("../../client/components/http-access-fallbac
|
|
|
51
57
|
const _redirect = require("../../client/components/redirect");
|
|
52
58
|
const _redirecterror = require("../../client/components/redirect-error");
|
|
53
59
|
const _implicittags = require("../lib/implicit-tags");
|
|
54
|
-
const
|
|
60
|
+
const _constants1 = require("../lib/trace/constants");
|
|
55
61
|
const _requestinsightsidentity = require("../lib/trace/request-insights-identity");
|
|
56
62
|
const _tracer = require("../lib/trace/tracer");
|
|
57
63
|
const _localspanrecorder = require("../lib/trace/local-span-recorder");
|
|
@@ -60,11 +66,10 @@ const _flightrenderresult = require("./flight-render-result");
|
|
|
60
66
|
const _createerrorhandler = require("./create-error-handler");
|
|
61
67
|
const _getshortdynamicparamtype = require("./get-short-dynamic-param-type");
|
|
62
68
|
const _getsegmentparam = require("../../shared/lib/router/utils/get-segment-param");
|
|
63
|
-
const
|
|
64
|
-
const _parseandvalidateflightrouterstate = require("./parse-and-validate-flight-router-state");
|
|
65
|
-
const _createflightrouterstatefromloadertree = require("./create-flight-router-state-from-loader-tree");
|
|
69
|
+
const _createtransporttreefromloadertree = require("./create-transport-tree-from-loader-tree");
|
|
66
70
|
const _actionhandler = require("./action-handler");
|
|
67
71
|
const _bailouttocsr = require("../../shared/lib/lazy-dynamic/bailout-to-csr");
|
|
72
|
+
const _reactbrowserbailout = require("../../shared/lib/lazy-dynamic/react-browser-bailout");
|
|
68
73
|
const _log = require("../../build/output/log");
|
|
69
74
|
const _requestcookies = require("../web/spec-extension/adapters/request-cookies");
|
|
70
75
|
const _headers = require("../web/spec-extension/adapters/headers");
|
|
@@ -78,10 +83,10 @@ const _getassetquerystring = require("./get-asset-query-string");
|
|
|
78
83
|
const _manifestssingleton = require("./manifests-singleton");
|
|
79
84
|
const _postponedstate = require("./postponed-state");
|
|
80
85
|
const _hooksservercontext = require("../../client/components/hooks-server-context");
|
|
86
|
+
const _serveractionrequestmeta = require("../lib/server-action-request-meta");
|
|
81
87
|
const _useflightresponse = require("./use-flight-response");
|
|
82
88
|
const _staticgenerationbailout = require("../../client/components/static-generation-bailout");
|
|
83
89
|
const _formatservererror = require("../../lib/format-server-error");
|
|
84
|
-
const _errortelemetryutils = require("../../lib/error-telemetry-utils");
|
|
85
90
|
const _dynamicrendering = require("./dynamic-rendering");
|
|
86
91
|
const _blockingroutemessages = require("./blocking-route-messages");
|
|
87
92
|
const _clientcomponentrendererlogger = require("../client-component-renderer-logger");
|
|
@@ -91,7 +96,6 @@ const _devvalidationscheduler = require("./dev-validation-scheduler");
|
|
|
91
96
|
const _nextrequest = require("../web/spec-extension/adapters/next-request");
|
|
92
97
|
const _parserelativeurl = require("../../shared/lib/router/utils/parse-relative-url");
|
|
93
98
|
const _approuter = /*#__PURE__*/ _interop_require_default(require("../../client/components/app-router"));
|
|
94
|
-
const _serveractionrequestmeta = require("../lib/server-action-request-meta");
|
|
95
99
|
const _createinitialrouterstate = require("../../client/components/router-reducer/create-initial-router-state");
|
|
96
100
|
const _approuterinstance = require("../../client/components/app-router-instance");
|
|
97
101
|
const _utils = require("../instrumentation/utils");
|
|
@@ -104,17 +108,18 @@ const _scheduler = require("../../lib/scheduler");
|
|
|
104
108
|
const _workunitasyncstorageexternal = require("./work-unit-async-storage.external");
|
|
105
109
|
const _consoleasyncstorageexternal = require("./console-async-storage.external");
|
|
106
110
|
const _cachesignal = require("./cache-signal");
|
|
111
|
+
const _fastsetimmediateexternal = require("../node-environment-extensions/fast-set-immediate.external");
|
|
107
112
|
const _varyparams = require("./vary-params");
|
|
108
113
|
const _utils1 = require("../lib/trace/utils");
|
|
109
114
|
const _invarianterror = require("../../shared/lib/invariant-error");
|
|
110
115
|
const _staletime = require("./stale-time");
|
|
111
|
-
const
|
|
116
|
+
const _constants2 = require("../../lib/constants");
|
|
112
117
|
const _createcomponentstylesandscripts = require("./create-component-styles-and-scripts");
|
|
113
118
|
const _parseloadertree = require("../../shared/lib/router/utils/parse-loader-tree");
|
|
114
119
|
const _resumedatacache = require("../resume-data-cache/resume-data-cache");
|
|
115
|
-
const
|
|
120
|
+
const _cachestore = require("../resume-data-cache/cache-store");
|
|
121
|
+
const _iserror = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/is-error"));
|
|
116
122
|
const _createserverinsertedmetadata = require("./metadata-insertion/create-server-inserted-metadata");
|
|
117
|
-
const _serverutils = require("../server-utils");
|
|
118
123
|
const _revalidationutils = require("../revalidation-utils");
|
|
119
124
|
const _trackmoduleloadingexternal = require("./module-loading/track-module-loading.external");
|
|
120
125
|
const _reactlargeshellerror = require("./react-large-shell-error");
|
|
@@ -125,6 +130,7 @@ const _imageconfigcontextsharedruntime = require("../../shared/lib/image-config-
|
|
|
125
130
|
const _imageconfig = require("../../shared/lib/image-config");
|
|
126
131
|
const _stagedrendering = require("./staged-rendering");
|
|
127
132
|
const _instantconfig = require("./instant-validation/instant-config");
|
|
133
|
+
const _ensurestatic = require("./segment-config/ensure-static");
|
|
128
134
|
const _warnonce = require("../../shared/lib/utils/warn-once");
|
|
129
135
|
const _debugchannelserver = require("./debug-channel-server");
|
|
130
136
|
const _streamutils = require("./instant-validation/stream-utils");
|
|
@@ -133,7 +139,6 @@ const _cookies = require("../web/spec-extension/cookies");
|
|
|
133
139
|
const _instantvalidationerror = require("./instant-validation/instant-validation-error");
|
|
134
140
|
const _promisewithresolvers = require("../../shared/lib/promise-with-resolvers");
|
|
135
141
|
const _dynamicrenderingutils = require("../dynamic-rendering-utils");
|
|
136
|
-
const _paramsutils = require("../lib/params-utils");
|
|
137
142
|
function _interop_require_default(obj) {
|
|
138
143
|
return obj && obj.__esModule ? obj : {
|
|
139
144
|
default: obj
|
|
@@ -192,47 +197,6 @@ const flightDataPathHeadKey = 'h';
|
|
|
192
197
|
const getFlightViewportKey = (requestId)=>requestId + 'v';
|
|
193
198
|
const getFlightMetadataKey = (requestId)=>requestId + 'm';
|
|
194
199
|
const filterStackFrame = process.env.NODE_ENV !== 'production' ? require('../lib/source-maps').filterStackFrameDEV : undefined;
|
|
195
|
-
function parseRequestHeaders(headers, options) {
|
|
196
|
-
const isRSCRequest = (0, _isrscrequest.isRSCRequestHeader)(headers[_approuterheaders.RSC_HEADER]);
|
|
197
|
-
// runtime prefetch requests are *not* treated as prefetch requests
|
|
198
|
-
// (TODO: this is confusing, we should refactor this to express this better)
|
|
199
|
-
const isPrefetchRequest = isRSCRequest && headers[_approuterheaders.NEXT_ROUTER_PREFETCH_HEADER] === '1';
|
|
200
|
-
const isAppShellPrefetchRequest = isRSCRequest && headers[_approuterheaders.NEXT_ROUTER_PREFETCH_HEADER] === '3';
|
|
201
|
-
// App Shell prefetches are a subtype of runtime prefetch — same code path,
|
|
202
|
-
// but with less resolved content (omitting link data)
|
|
203
|
-
const isRuntimePrefetchRequest = isRSCRequest && (headers[_approuterheaders.NEXT_ROUTER_PREFETCH_HEADER] === '2' || isAppShellPrefetchRequest);
|
|
204
|
-
const isHmrRefresh = headers[_approuterheaders.NEXT_HMR_REFRESH_HEADER] !== undefined;
|
|
205
|
-
const shouldProvideFlightRouterState = isRSCRequest && (!isPrefetchRequest || !options.isRoutePPREnabled);
|
|
206
|
-
const flightRouterState = shouldProvideFlightRouterState ? (0, _parseandvalidateflightrouterstate.parseAndValidateFlightRouterState)(headers[_approuterheaders.NEXT_ROUTER_STATE_TREE_HEADER]) : undefined;
|
|
207
|
-
// Checks if this is a prefetch of the Route Tree by the Segment Cache
|
|
208
|
-
const isRouteTreePrefetchRequest = isRSCRequest && headers[_approuterheaders.NEXT_ROUTER_SEGMENT_PREFETCH_HEADER] === '/_tree';
|
|
209
|
-
const csp = headers['content-security-policy'] || headers['content-security-policy-report-only'];
|
|
210
|
-
const nonce = typeof csp === 'string' ? (0, _getscriptnoncefromheader.getScriptNonceFromHeader)(csp) : undefined;
|
|
211
|
-
const previouslyRevalidatedTags = (0, _serverutils.getPreviouslyRevalidatedTags)(headers, options.previewModeId);
|
|
212
|
-
let requestId;
|
|
213
|
-
let htmlRequestId;
|
|
214
|
-
if (process.env.__NEXT_DEV_SERVER) {
|
|
215
|
-
// The request IDs are only used for the dev server to send debug
|
|
216
|
-
// information to the matching client (identified by the HTML request ID
|
|
217
|
-
// that was sent to the client with the HTML document) for the current
|
|
218
|
-
// request (identified by the request ID, as defined by the client).
|
|
219
|
-
requestId = typeof headers[_approuterheaders.NEXT_REQUEST_ID_HEADER] === 'string' ? headers[_approuterheaders.NEXT_REQUEST_ID_HEADER] : undefined;
|
|
220
|
-
htmlRequestId = typeof headers[_approuterheaders.NEXT_HTML_REQUEST_ID_HEADER] === 'string' ? headers[_approuterheaders.NEXT_HTML_REQUEST_ID_HEADER] : undefined;
|
|
221
|
-
}
|
|
222
|
-
return {
|
|
223
|
-
flightRouterState,
|
|
224
|
-
isPrefetchRequest,
|
|
225
|
-
isRuntimePrefetchRequest,
|
|
226
|
-
isAppShellPrefetchRequest,
|
|
227
|
-
isRouteTreePrefetchRequest,
|
|
228
|
-
isHmrRefresh,
|
|
229
|
-
isRSCRequest,
|
|
230
|
-
nonce,
|
|
231
|
-
previouslyRevalidatedTags,
|
|
232
|
-
requestId,
|
|
233
|
-
htmlRequestId
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
200
|
/**
|
|
237
201
|
* Walks the loader tree to find the minimum `unstable_dynamicStaleTime` exported by
|
|
238
202
|
* any page module. Returns null if no page exports the config.
|
|
@@ -330,13 +294,11 @@ function NonIndex({ createElement, pagePath, statusCode, isPossibleServerAction
|
|
|
330
294
|
* This function is only called on "dynamic" requests (ie, there wasn't already a static response).
|
|
331
295
|
* It uses request headers (namely `next-router-state-tree`) to determine where to start rendering.
|
|
332
296
|
*/ async function generateDynamicRSCPayload(ctx, options) {
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
//
|
|
336
|
-
//
|
|
337
|
-
|
|
338
|
-
// action reducer sees a falsy value, it'll simply resolve the action with no data.
|
|
339
|
-
let flightData = '';
|
|
297
|
+
// Transport data that is going to be passed to the browser. Undefined when
|
|
298
|
+
// the response renders nothing: server actions, if the server action
|
|
299
|
+
// handler instructs this function to skip rendering. When the server action
|
|
300
|
+
// reducer sees an absent tree, it resolves the action with no data.
|
|
301
|
+
let transportData = undefined;
|
|
340
302
|
const { componentMod: { routeModule: { userland: { loaderTree } }, createElement, createMetadataComponents, Fragment }, query, requestId, flightRouterState, workStore, url } = ctx;
|
|
341
303
|
const serveStreamingMetadata = !!ctx.renderOpts.serveStreamingMetadata;
|
|
342
304
|
if (!(options == null ? void 0 : options.skipPageRendering)) {
|
|
@@ -367,7 +329,7 @@ function NonIndex({ createElement, pagePath, statusCode, isPossibleServerAction
|
|
|
367
329
|
}), createElement(Metadata, {
|
|
368
330
|
key: getFlightMetadataKey(requestId)
|
|
369
331
|
}));
|
|
370
|
-
|
|
332
|
+
const responseTree = needsFullTree ? await (0, _walktreewithflightrouterstate.createFullTreeForNavigation)({
|
|
371
333
|
ctx,
|
|
372
334
|
loaderTree,
|
|
373
335
|
rscHead,
|
|
@@ -389,8 +351,17 @@ function NonIndex({ createElement, pagePath, statusCode, isPossibleServerAction
|
|
|
389
351
|
preloadCallbacks,
|
|
390
352
|
MetadataOutlet,
|
|
391
353
|
hintTree: ((_ctx_renderOpts_prefetchHints = ctx.renderOpts.prefetchHints) == null ? void 0 : _ctx_renderOpts_prefetchHints[ctx.pagePath]) ?? null
|
|
392
|
-
})
|
|
393
|
-
|
|
354
|
+
});
|
|
355
|
+
if (responseTree !== null) {
|
|
356
|
+
transportData = {
|
|
357
|
+
t: responseTree.tree,
|
|
358
|
+
h: {
|
|
359
|
+
r: responseTree.head,
|
|
360
|
+
p: responseTree.isHeadPartial,
|
|
361
|
+
v: (0, _varyparams.getMetadataVaryParamsAccumulator)()
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
}
|
|
394
365
|
}
|
|
395
366
|
// In dev, the Vary header may not reliably reflect whether a route can
|
|
396
367
|
// be intercepted, because interception routes are compiled on demand.
|
|
@@ -401,22 +372,30 @@ function NonIndex({ createElement, pagePath, statusCode, isPossibleServerAction
|
|
|
401
372
|
// We can rely on this because `ActionResult` will always be a promise, even if
|
|
402
373
|
// the result is falsey.
|
|
403
374
|
if (options == null ? void 0 : options.actionResult) {
|
|
404
|
-
|
|
375
|
+
const actionResponse = {
|
|
405
376
|
a: options.actionResult,
|
|
406
|
-
|
|
407
|
-
q: getRenderedSearch(query),
|
|
377
|
+
q: (0, _querystring.getRenderedSearch)(query),
|
|
408
378
|
i: !!couldBeIntercepted
|
|
409
|
-
}
|
|
379
|
+
};
|
|
380
|
+
if (transportData !== undefined) {
|
|
381
|
+
actionResponse.t = transportData;
|
|
382
|
+
}
|
|
383
|
+
return maybeAppendBuildIdToRSCPayload(ctx, actionResponse);
|
|
410
384
|
}
|
|
411
385
|
// Otherwise, it's a regular RSC response.
|
|
412
386
|
const baseResponse = maybeAppendBuildIdToRSCPayload(ctx, {
|
|
413
|
-
|
|
414
|
-
q: getRenderedSearch(query),
|
|
387
|
+
q: (0, _querystring.getRenderedSearch)(query),
|
|
415
388
|
i: !!couldBeIntercepted,
|
|
416
|
-
|
|
417
|
-
|
|
389
|
+
// Tells the client whether this route supports per-segment prefetching.
|
|
390
|
+
// With Cache Components, all routes support it. Without it, only fully
|
|
391
|
+
// static pages do, because their per-segment prefetch responses are
|
|
392
|
+
// generated during static generation (build or ISR).
|
|
393
|
+
S: ctx.renderCapabilities.supportsPerSegmentPrefetching,
|
|
418
394
|
r: (0, _varyparams.getRootParamsVaryParamsAccumulator)() ?? undefined
|
|
419
395
|
});
|
|
396
|
+
if (transportData !== undefined) {
|
|
397
|
+
baseResponse.t = transportData;
|
|
398
|
+
}
|
|
420
399
|
if ((options == null ? void 0 : options.staleTimeIterable) !== undefined) {
|
|
421
400
|
baseResponse.s = options.staleTimeIterable;
|
|
422
401
|
}
|
|
@@ -427,42 +406,51 @@ function NonIndex({ createElement, pagePath, statusCode, isPossibleServerAction
|
|
|
427
406
|
baseResponse.a = options.shellByteLengthPromise;
|
|
428
407
|
}
|
|
429
408
|
if ((options == null ? void 0 : options.shellUsedSessionDataPromise) !== undefined) {
|
|
430
|
-
baseResponse.
|
|
409
|
+
baseResponse.w = options.shellUsedSessionDataPromise;
|
|
431
410
|
}
|
|
432
411
|
if ((options == null ? void 0 : options.runtimePrefetchStream) !== undefined) {
|
|
433
412
|
baseResponse.p = options.runtimePrefetchStream;
|
|
434
413
|
}
|
|
435
|
-
// Include the per-page dynamic stale time from unstable_dynamicStaleTime
|
|
436
|
-
// for dynamic
|
|
437
|
-
//
|
|
414
|
+
// Include the per-page dynamic stale time from unstable_dynamicStaleTime. This
|
|
415
|
+
// function only generates payloads for dynamic requests, and the client treats
|
|
416
|
+
// the field's presence as authoritative.
|
|
438
417
|
// TODO: Move this to the prefetch hints file so we don't have to walk the
|
|
439
418
|
// tree on every render.
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
baseResponse.d = dynamicStaleTime;
|
|
444
|
-
}
|
|
419
|
+
const dynamicStaleTime = await getDynamicStaleTime(ctx.componentMod.routeModule.userland.loaderTree);
|
|
420
|
+
if (dynamicStaleTime !== null) {
|
|
421
|
+
baseResponse.d = dynamicStaleTime;
|
|
445
422
|
}
|
|
446
423
|
return baseResponse;
|
|
447
424
|
}
|
|
448
|
-
function
|
|
425
|
+
function createRequestErrorContext(ctx, renderSource) {
|
|
426
|
+
return createErrorContext(ctx, renderSource, (0, _utils.getRevalidateReason)({
|
|
427
|
+
isOnDemandRevalidate: ctx.workStore.isOnDemandRevalidate
|
|
428
|
+
}));
|
|
429
|
+
}
|
|
430
|
+
function createPrerenderErrorContext(ctx, renderSource) {
|
|
431
|
+
return createErrorContext(ctx, renderSource, (0, _utils.getRevalidateReason)({
|
|
432
|
+
isOnDemandRevalidate: ctx.workStore.isOnDemandRevalidate,
|
|
433
|
+
isStaticGeneration: true
|
|
434
|
+
}));
|
|
435
|
+
}
|
|
436
|
+
function createErrorContext(ctx, renderSource, revalidateReason) {
|
|
449
437
|
return {
|
|
450
438
|
routerKind: 'App Router',
|
|
451
439
|
routePath: ctx.pagePath,
|
|
452
440
|
// TODO: is this correct if `isPossibleServerAction` is a false positive?
|
|
453
441
|
routeType: ctx.isPossibleServerAction ? 'action' : 'render',
|
|
454
442
|
renderSource,
|
|
455
|
-
revalidateReason
|
|
443
|
+
revalidateReason
|
|
456
444
|
};
|
|
457
445
|
}
|
|
458
446
|
/**
|
|
459
447
|
* Produces a RenderResult containing the Flight data for the given request. See
|
|
460
448
|
* `generateDynamicRSCPayload` for information on the contents of the render result.
|
|
461
|
-
*/ async function generateDynamicFlightRenderResult(
|
|
449
|
+
*/ async function generateDynamicFlightRenderResult(ctx, requestStore, options) {
|
|
462
450
|
const { htmlRequestId, renderOpts, requestId, workStore } = ctx;
|
|
463
451
|
const { onInstrumentationRequestError, setReactDebugChannel, isBuildTimePrerendering = false } = renderOpts;
|
|
464
452
|
function onFlightDataRenderError(err, silenceLog) {
|
|
465
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
453
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, createRequestErrorContext(ctx, 'react-server-components-payload'), silenceLog);
|
|
466
454
|
}
|
|
467
455
|
const onError = (0, _createerrorhandler.createReactServerErrorHandler)(process.env.NODE_ENV === 'development', isBuildTimePrerendering, workStore.reactServerErrorsByDigest, onFlightDataRenderError);
|
|
468
456
|
// With Server Components HMR cancellation enabled, a superseded HMR refresh
|
|
@@ -511,28 +499,28 @@ function createErrorContext(ctx, renderSource) {
|
|
|
511
499
|
* Production-only staged dynamic flight render for cache components (Node.js
|
|
512
500
|
* streams). Uses staged rendering to separate static (RDC-backed) from
|
|
513
501
|
* runtime/dynamic content.
|
|
514
|
-
*/ async function generateStagedDynamicFlightRenderResultNode(
|
|
502
|
+
*/ async function generateStagedDynamicFlightRenderResultNode(ctx, requestStore) {
|
|
515
503
|
const { componentMod, workStore, renderOpts } = ctx;
|
|
516
504
|
const { routeModule } = componentMod;
|
|
517
505
|
const { loaderTree } = routeModule.userland;
|
|
518
506
|
const { onInstrumentationRequestError, experimental } = renderOpts;
|
|
519
507
|
function onFlightDataRenderError(err, silenceLog) {
|
|
520
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
508
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, createRequestErrorContext(ctx, 'react-server-components-payload'), silenceLog);
|
|
521
509
|
}
|
|
522
510
|
const onError = (0, _createerrorhandler.createReactServerErrorHandler)(false, false, workStore.reactServerErrorsByDigest, onFlightDataRenderError);
|
|
523
511
|
const selectStaleTime = (0, _staletime.createSelectStaleTime)(experimental);
|
|
524
512
|
const staleTimeIterable = new _staletime.StaleTimeIterable();
|
|
513
|
+
const prefetchMode = await getPrefetchingModeForPage(renderOpts, loaderTree);
|
|
525
514
|
const stageController = new _stagedrendering.StagedRenderingController({
|
|
526
515
|
abortSignal: null,
|
|
527
516
|
abandonController: null,
|
|
528
|
-
//
|
|
529
|
-
//
|
|
530
|
-
|
|
531
|
-
syncIO: _stagedrendering.SyncIOMode.Untracked,
|
|
517
|
+
// Synchronous request-time data ends the static stage before its result can
|
|
518
|
+
// enter the Cached Navigation.
|
|
519
|
+
syncIO: getSyncIOMode(prefetchMode),
|
|
532
520
|
finalStage: null
|
|
533
521
|
});
|
|
534
522
|
// Initialize stale time tracking on the request store.
|
|
535
|
-
requestStore.stale =
|
|
523
|
+
requestStore.stale = _constants2.INFINITE_CACHE;
|
|
536
524
|
requestStore.stagedRendering = stageController;
|
|
537
525
|
requestStore.varyParamsAccumulator = (0, _varyparams.createResponseVaryParamsAccumulator)();
|
|
538
526
|
requestStore.asyncApiPromises = createAsyncApiPromises(stageController, requestStore.cookies, requestStore.mutableCookies, requestStore.headers);
|
|
@@ -540,18 +528,25 @@ function createErrorContext(ctx, renderSource) {
|
|
|
540
528
|
const shellByteLengthDeferred = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
541
529
|
const staticStageByteLengthDeferred = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
542
530
|
let runtimePrefetchStream;
|
|
531
|
+
let startRuntimePrefetchRender;
|
|
532
|
+
// Partial prefetching waits for cacheReady() before starting an embedded
|
|
533
|
+
// runtime prefetch. Track React's native immediates so that this wait
|
|
534
|
+
// includes Flight work that can discover more cache reads. Other prefetch
|
|
535
|
+
// modes do not wait for cacheReady() here.
|
|
536
|
+
const immediateTracker = prefetchMode === 2 ? new _fastsetimmediateexternal.ImmediateTracker() : null;
|
|
543
537
|
// Check if this route should runtime-cache its navigation. This happens when
|
|
544
538
|
// Partial Prefetching is enabled for the route, either per segment (a
|
|
545
|
-
// `prefetch` of 'partial'
|
|
539
|
+
// `prefetch` of 'partial') or globally (the
|
|
546
540
|
// `partialPrefetching` config). If so, we piggyback on the dynamic render to
|
|
547
541
|
// fill caches and then spawn a final runtime prerender whose result stream
|
|
548
542
|
// is embedded in the RSC payload. This is gated because it adds extra server
|
|
549
543
|
// processing and increases the response payload size.
|
|
550
|
-
if (
|
|
544
|
+
if (prefetchMode === 2) {
|
|
551
545
|
// Create a mutable cache that gets filled during the dynamic render.
|
|
552
|
-
const prerenderResumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)(
|
|
546
|
+
const prerenderResumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)(// Prefill the mutable cache from the RDC if available.
|
|
547
|
+
requestStore.resumeDataCache ?? undefined);
|
|
553
548
|
requestStore.resumeDataCache = prerenderResumeDataCache;
|
|
554
|
-
const cacheSignal = new _cachesignal.CacheSignal();
|
|
549
|
+
const cacheSignal = new _cachesignal.CacheSignal(immediateTracker);
|
|
555
550
|
(0, _trackmoduleloadingexternal.trackPendingModules)(cacheSignal);
|
|
556
551
|
requestStore.cacheSignal = cacheSignal;
|
|
557
552
|
// Create a deferred stream for the runtime prefetch result. Its readable
|
|
@@ -560,18 +555,20 @@ function createErrorContext(ctx, renderSource) {
|
|
|
560
555
|
// render has filled all caches.
|
|
561
556
|
const runtimePrefetchTransform = new TransformStream();
|
|
562
557
|
runtimePrefetchStream = runtimePrefetchTransform.readable;
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
558
|
+
startRuntimePrefetchRender = async ()=>{
|
|
559
|
+
await cacheSignal.cacheReady();
|
|
560
|
+
return spawnRuntimePrefetchWithFilledCaches(runtimePrefetchTransform.writable, ctx, prerenderResumeDataCache, requestStore, onError);
|
|
561
|
+
};
|
|
566
562
|
}
|
|
567
|
-
const rscPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, generateDynamicRSCPayload, ctx, {
|
|
563
|
+
const rscPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, immediateTracker === null ? generateDynamicRSCPayload : _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, generateDynamicRSCPayload), ctx, {
|
|
568
564
|
staleTimeIterable,
|
|
569
565
|
staticStageByteLengthPromise: staticStageByteLengthDeferred.promise,
|
|
570
566
|
shellByteLengthPromise: shellByteLengthDeferred.promise,
|
|
571
567
|
runtimePrefetchStream
|
|
572
568
|
});
|
|
573
569
|
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
574
|
-
const
|
|
570
|
+
const runRenderTasks = immediateTracker === null ? _apprenderrenderutils.runInSequentialTasks : _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, _apprenderrenderutils.runInSequentialTasks);
|
|
571
|
+
const flightStream = await runRenderTasks(()=>{
|
|
575
572
|
stageController.advanceStage(_stagedrendering.RenderStage.ShellStatic);
|
|
576
573
|
const sourceStream = _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.renderToNodeFlightStream, ctx.componentMod, rscPayload, clientModules, {
|
|
577
574
|
onError,
|
|
@@ -585,9 +582,8 @@ function createErrorContext(ctx, renderSource) {
|
|
|
585
582
|
shellByteLengthDeferred.resolve(byteLengths[_stagedrendering.RenderStage.ShellStatic]);
|
|
586
583
|
});
|
|
587
584
|
return dynamicStream;
|
|
588
|
-
},
|
|
589
|
-
|
|
590
|
-
}, ()=>{
|
|
585
|
+
}, // Fold `PrefetchStatic_prefetchApi` into `PrefetchStatic` - no discrimination needed here
|
|
586
|
+
()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>{
|
|
591
587
|
// This is a separate task that doesn't advance a stage. It forces
|
|
592
588
|
// draining the immediate queue so that the stale time iterable and vary
|
|
593
589
|
// params accumulators are flushed before we advance to the dynamic stage.
|
|
@@ -595,9 +591,8 @@ function createErrorContext(ctx, renderSource) {
|
|
|
595
591
|
if (requestStore.varyParamsAccumulator) {
|
|
596
592
|
(0, _varyparams.finishAccumulatingVaryParams)(requestStore.varyParamsAccumulator);
|
|
597
593
|
}
|
|
598
|
-
}, ()=>
|
|
599
|
-
|
|
600
|
-
});
|
|
594
|
+
}, ()=>stageController.advanceStage(_stagedrendering.RenderStage.Dynamic));
|
|
595
|
+
void (startRuntimePrefetchRender == null ? void 0 : startRuntimePrefetchRender());
|
|
601
596
|
return new _flightrenderresult.FlightRenderResult(flightStream, {
|
|
602
597
|
fetchMetrics: workStore.fetchMetrics
|
|
603
598
|
});
|
|
@@ -614,13 +609,13 @@ function createErrorContext(ctx, renderSource) {
|
|
|
614
609
|
const staleTimeIterable = new _staletime.StaleTimeIterable();
|
|
615
610
|
// We want to be able to rewind the result to a session shell.
|
|
616
611
|
const mode = {
|
|
617
|
-
type: '
|
|
612
|
+
type: 'navigation',
|
|
618
613
|
shellUsedSessionDataDeferred: (0, _promisewithresolvers.createPromiseWithResolvers)(),
|
|
619
614
|
shellByteLengthDeferred: (0, _promisewithresolvers.createPromiseWithResolvers)()
|
|
620
615
|
};
|
|
621
616
|
const { result } = await finalRuntimeServerPrerender(mode, ctx, generateDynamicRSCPayload.bind(null, ctx, {
|
|
622
617
|
staleTimeIterable,
|
|
623
|
-
shellByteLengthPromise: mode.
|
|
618
|
+
shellByteLengthPromise: mode.shellByteLengthDeferred.promise,
|
|
624
619
|
shellUsedSessionDataPromise: mode.shellUsedSessionDataDeferred.promise
|
|
625
620
|
}), prerenderResumeDataCache, rootParams, requestStore.headers, requestStore.cookies, requestStore.draftMode, onError, staleTimeIterable, // This path is only reached on the production Cache Components + Cached
|
|
626
621
|
// Navigations renders (the staged Flight response and the HTML hydration
|
|
@@ -665,42 +660,39 @@ async function stagedRenderWithoutCachesInDevNode(ctx, requestStore, getPayload,
|
|
|
665
660
|
...options,
|
|
666
661
|
environmentName
|
|
667
662
|
});
|
|
668
|
-
}, ()=>
|
|
669
|
-
stageController.advanceStage(_stagedrendering.RenderStage.Static);
|
|
670
|
-
}, ()=>{
|
|
671
|
-
stageController.advanceStage(_stagedrendering.RenderStage.Dynamic);
|
|
672
|
-
});
|
|
663
|
+
}, ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic_prefetchApi), ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>stageController.advanceStage(_stagedrendering.RenderStage.Dynamic));
|
|
673
664
|
}
|
|
674
665
|
function getEnvironmentNameForStageWithoutCaches(stage) {
|
|
675
666
|
switch(stage){
|
|
676
667
|
case _stagedrendering.RenderStage.Before:
|
|
677
668
|
case _stagedrendering.RenderStage.ShellStatic:
|
|
669
|
+
case _stagedrendering.RenderStage.PrefetchStatic_prefetchApi:
|
|
670
|
+
case _stagedrendering.RenderStage.PrefetchStatic:
|
|
671
|
+
case _stagedrendering.RenderStage.NavigationStatic:
|
|
678
672
|
case _stagedrendering.RenderStage.Static:
|
|
679
673
|
return 'Prerender';
|
|
680
674
|
case _stagedrendering.RenderStage.ShellRuntime:
|
|
681
|
-
case _stagedrendering.RenderStage.
|
|
675
|
+
case _stagedrendering.RenderStage.PrefetchRuntime_prefetchApi:
|
|
676
|
+
case _stagedrendering.RenderStage.PrefetchRuntime:
|
|
677
|
+
case _stagedrendering.RenderStage.NavigationRuntime:
|
|
682
678
|
case _stagedrendering.RenderStage.Dynamic:
|
|
683
679
|
case _stagedrendering.RenderStage.Abandoned:
|
|
684
680
|
return 'Server';
|
|
685
681
|
default:
|
|
686
682
|
stage;
|
|
687
|
-
throw
|
|
688
|
-
value: "E881",
|
|
689
|
-
enumerable: false,
|
|
690
|
-
configurable: true
|
|
691
|
-
});
|
|
683
|
+
throw new _invarianterror.InvariantError(`Invalid render stage: ${stage}`);
|
|
692
684
|
}
|
|
693
685
|
}
|
|
694
686
|
/**
|
|
695
687
|
* Fork of `generateDynamicFlightRenderResult` that renders using `renderWithRestartOnCacheMissInDev`
|
|
696
688
|
* to ensure correct separation of environments Prerender/Server (for use in Cache Components)
|
|
697
|
-
*/ async function generateDynamicFlightRenderResultWithStagesInDev(
|
|
689
|
+
*/ async function generateDynamicFlightRenderResultWithStagesInDev(ctx, initialRequestStore, createRequestStore, stagedFallbackParams) {
|
|
698
690
|
const { htmlRequestId, renderOpts, requestId, workStore, componentMod: { createElement, routeModule: { userland: { loaderTree } } }, url } = ctx;
|
|
699
691
|
const { onInstrumentationRequestError, setReactDebugChannel, setCacheStatus, isBuildTimePrerendering = false } = renderOpts;
|
|
700
692
|
let didErrorObservably = false;
|
|
701
693
|
function onFlightDataRenderError(err, silenceLog) {
|
|
702
694
|
didErrorObservably = true;
|
|
703
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
695
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, createRequestErrorContext(ctx, 'react-server-components-payload'), silenceLog);
|
|
704
696
|
}
|
|
705
697
|
const onError = (0, _createerrorhandler.createReactServerErrorHandler)(process.env.NODE_ENV === 'development', isBuildTimePrerendering, workStore.reactServerErrorsByDigest, onFlightDataRenderError);
|
|
706
698
|
// We validate RSC requests for HMR refreshes and client navigations when
|
|
@@ -736,23 +728,28 @@ function getEnvironmentNameForStageWithoutCaches(stage) {
|
|
|
736
728
|
setCacheStatus('ready', htmlRequestId);
|
|
737
729
|
}
|
|
738
730
|
const prefetchMode = await getPrefetchingModeForPage(renderOpts, loaderTree);
|
|
739
|
-
|
|
740
|
-
//
|
|
741
|
-
//
|
|
742
|
-
//
|
|
743
|
-
//
|
|
744
|
-
//
|
|
745
|
-
//
|
|
731
|
+
const ensureStaticLevel = await (0, _ensurestatic.resolveEnsureStaticLevel)(loaderTree, /* partialPrefetching */ prefetchMode === 2);
|
|
732
|
+
// We try to match the client router's prefetching behavior in dev
|
|
733
|
+
// by avoiding showing contents that would've been prefetched.
|
|
734
|
+
// (see stream blocking logic in `streamStagedRenderInDev` for more).
|
|
735
|
+
// Determine how much content would've been prefetched, which varies
|
|
736
|
+
// between Cache Components and PartialPrefetching.
|
|
737
|
+
// (HMR refreshes act like a full page navigation, which would use the static PPR shell)
|
|
746
738
|
let prefetchStage;
|
|
747
739
|
if (initialRequestStore.isHmrRefresh === true) {
|
|
748
740
|
prefetchStage = _stagedrendering.RenderStage.Static;
|
|
749
741
|
} else {
|
|
750
742
|
if (prefetchMode === 2) {
|
|
751
|
-
// TODO(app-shells): model `partialPrefetching: "unstable_eager"`
|
|
752
743
|
// TODO(app-shells): if this navigation came from <Link prefetch={true} />,
|
|
753
|
-
// we should show the
|
|
744
|
+
// we should show the content for a speculative prefetch
|
|
754
745
|
// (which can have more data than the app shell)
|
|
755
|
-
|
|
746
|
+
if (ensureStaticLevel >= _ensurestatic.EnsureStaticLevel.Shell) {
|
|
747
|
+
// TODO(ensure-static): this is overly conservative and may show less content
|
|
748
|
+
// than we would in practice
|
|
749
|
+
prefetchStage = _stagedrendering.RenderStage.ShellStatic;
|
|
750
|
+
} else {
|
|
751
|
+
prefetchStage = _stagedrendering.RenderStage.ShellRuntime;
|
|
752
|
+
}
|
|
756
753
|
} else {
|
|
757
754
|
prefetchStage = _stagedrendering.RenderStage.Static;
|
|
758
755
|
}
|
|
@@ -787,7 +784,7 @@ function getEnvironmentNameForStageWithoutCaches(stage) {
|
|
|
787
784
|
getPayload,
|
|
788
785
|
onError,
|
|
789
786
|
shouldValidate,
|
|
790
|
-
fallbackRouteParams:
|
|
787
|
+
fallbackRouteParams: stagedFallbackParams,
|
|
791
788
|
getDevRenderDidError: ()=>didErrorObservably,
|
|
792
789
|
navigationKind: {
|
|
793
790
|
type: 'prefetched-client',
|
|
@@ -818,12 +815,12 @@ function getEnvironmentNameForStageWithoutCaches(stage) {
|
|
|
818
815
|
fetchMetrics: workStore.fetchMetrics
|
|
819
816
|
});
|
|
820
817
|
}
|
|
821
|
-
async function generateRuntimePrefetchResult(
|
|
818
|
+
async function generateRuntimePrefetchResult(ctx, requestStore, isShellPrefetch) {
|
|
822
819
|
const { workStore, renderOpts, htmlRequestId, requestId } = ctx;
|
|
823
820
|
const { isBuildTimePrerendering = false, onInstrumentationRequestError, setReactDebugChannel } = renderOpts;
|
|
824
821
|
function onFlightDataRenderError(err, silenceLog) {
|
|
825
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
826
|
-
|
|
822
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, // TODO(runtime-ppr): should we use a different value?
|
|
823
|
+
createRequestErrorContext(ctx, 'react-server-components-payload'), silenceLog);
|
|
827
824
|
}
|
|
828
825
|
const onError = (0, _createerrorhandler.createReactServerErrorHandler)(false, isBuildTimePrerendering, workStore.reactServerErrorsByDigest, onFlightDataRenderError);
|
|
829
826
|
const metadata = {};
|
|
@@ -832,8 +829,8 @@ async function generateRuntimePrefetchResult(req, ctx, requestStore, isShellPref
|
|
|
832
829
|
const rootParams = (0, _createcomponenttree.getRootParams)(loaderTree, getDynamicParamFromSegment);
|
|
833
830
|
// We need to share caches between the prospective prerender and the final prerender,
|
|
834
831
|
// but we're not going to persist this anywhere.
|
|
835
|
-
const prerenderResumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)(
|
|
836
|
-
|
|
832
|
+
const prerenderResumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)(// Prefill the mutable cache from the RDC if available.
|
|
833
|
+
requestStore.resumeDataCache ?? undefined);
|
|
837
834
|
const mode = isShellPrefetch ? {
|
|
838
835
|
type: 'session-shell-only',
|
|
839
836
|
shellUsedSessionDataDeferred: (0, _promisewithresolvers.createPromiseWithResolvers)()
|
|
@@ -842,6 +839,7 @@ async function generateRuntimePrefetchResult(req, ctx, requestStore, isShellPref
|
|
|
842
839
|
shellUsedSessionDataDeferred: (0, _promisewithresolvers.createPromiseWithResolvers)(),
|
|
843
840
|
shellByteLengthDeferred: (0, _promisewithresolvers.createPromiseWithResolvers)()
|
|
844
841
|
};
|
|
842
|
+
await prospectiveRuntimeServerPrerender(ctx, getFinalStageForRuntimePrerenderMode(mode), generateDynamicRSCPayload.bind(null, ctx), prerenderResumeDataCache, rootParams, requestStore.headers, requestStore.cookies, requestStore.draftMode);
|
|
845
843
|
const debugChannel = setReactDebugChannel ? (0, _debugchannelserver.createWebDebugChannel)() : undefined;
|
|
846
844
|
if (debugChannel && setReactDebugChannel) {
|
|
847
845
|
setReactDebugChannel(debugChannel.clientSide, htmlRequestId, requestId);
|
|
@@ -855,7 +853,7 @@ async function generateRuntimePrefetchResult(req, ctx, requestStore, isShellPref
|
|
|
855
853
|
metadata.fetchMetrics = ctx.workStore.fetchMetrics;
|
|
856
854
|
return new _flightrenderresult.FlightRenderResult(response.result.prelude, metadata);
|
|
857
855
|
}
|
|
858
|
-
async function prospectiveRuntimeServerPrerender(ctx,
|
|
856
|
+
async function prospectiveRuntimeServerPrerender(ctx, finalStage, getPayload, resumeDataCache, rootParams, headers, cookies, draftMode) {
|
|
859
857
|
const { implicitTags, renderOpts, workStore } = ctx;
|
|
860
858
|
const { ComponentMod } = renderOpts;
|
|
861
859
|
// Prerender controller represents the lifetime of the prerender.
|
|
@@ -869,7 +867,8 @@ async function prospectiveRuntimeServerPrerender(ctx, isShellPrefetch, getPayloa
|
|
|
869
867
|
const initialServerRenderController = new AbortController();
|
|
870
868
|
// The cacheSignal helps us track whether caches are still filling or we are ready
|
|
871
869
|
// to cut the render off.
|
|
872
|
-
const
|
|
870
|
+
const immediateTracker = new _fastsetimmediateexternal.ImmediateTracker();
|
|
871
|
+
const cacheSignal = new _cachesignal.CacheSignal(immediateTracker);
|
|
873
872
|
const initialServerPrerenderStore = {
|
|
874
873
|
type: 'prerender-runtime',
|
|
875
874
|
phase: 'render',
|
|
@@ -887,7 +886,7 @@ async function prospectiveRuntimeServerPrerender(ctx, isShellPrefetch, getPayloa
|
|
|
887
886
|
// so we set `expire` and `revalidate` to their minimum values just in case.
|
|
888
887
|
revalidate: 1,
|
|
889
888
|
expire: 0,
|
|
890
|
-
stale:
|
|
889
|
+
stale: _constants2.INFINITE_CACHE,
|
|
891
890
|
tags: [
|
|
892
891
|
...implicitTags.tags
|
|
893
892
|
],
|
|
@@ -895,9 +894,10 @@ async function prospectiveRuntimeServerPrerender(ctx, isShellPrefetch, getPayloa
|
|
|
895
894
|
hmrRefreshHash: undefined,
|
|
896
895
|
// We don't track vary params during initial prerender, only the final one
|
|
897
896
|
varyParamsAccumulator: null,
|
|
898
|
-
//
|
|
897
|
+
// We don't use sequencing needed for prospective renders, but we need to
|
|
898
|
+
// track where the final prerender is going to end to avoid warming too much.
|
|
899
899
|
stagedRendering: null,
|
|
900
|
-
|
|
900
|
+
finalStage,
|
|
901
901
|
// These are not present in regular prerenders, but allowed in a runtime
|
|
902
902
|
// prerender.
|
|
903
903
|
// Any cache keyed on headers() or cookies() needs to be invalidated.
|
|
@@ -909,7 +909,7 @@ async function prospectiveRuntimeServerPrerender(ctx, isShellPrefetch, getPayloa
|
|
|
909
909
|
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
910
910
|
// We're not going to use the result of this render because the only time it could be used
|
|
911
911
|
// is if it completes in a microtask and that's likely very rare for any non-trivial app
|
|
912
|
-
const initialServerPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPrerenderStore, getPayload);
|
|
912
|
+
const initialServerPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPrerenderStore, _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, getPayload));
|
|
913
913
|
const prerenderOptions = {
|
|
914
914
|
filterStackFrame,
|
|
915
915
|
onError: (err)=>{
|
|
@@ -930,7 +930,7 @@ async function prospectiveRuntimeServerPrerender(ctx, isShellPrefetch, getPayloa
|
|
|
930
930
|
// transitioning out of the prerender environment
|
|
931
931
|
signal: initialServerRenderController.signal
|
|
932
932
|
};
|
|
933
|
-
const pendingInitialServerResult = _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPrerenderStore, (0, _streamops.getServerPrerender)(ComponentMod), initialServerPayload, clientModules, prerenderOptions);
|
|
933
|
+
const pendingInitialServerResult = _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPrerenderStore, _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, (0, _streamops.getServerPrerender)(ComponentMod)), initialServerPayload, clientModules, prerenderOptions);
|
|
934
934
|
// Wait for all caches to be finished filling and for async imports to resolve
|
|
935
935
|
(0, _trackmoduleloadingexternal.trackPendingModules)(cacheSignal);
|
|
936
936
|
await cacheSignal.cacheReady();
|
|
@@ -974,16 +974,16 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
974
974
|
let resultIsPartial = false;
|
|
975
975
|
const finalServerController = new AbortController();
|
|
976
976
|
const serverDynamicTracking = (0, _dynamicrendering.createDynamicTrackingState)(isDebugDynamicAccesses);
|
|
977
|
-
const
|
|
977
|
+
const finalStage = getFinalStageForRuntimePrerenderMode(mode);
|
|
978
|
+
const stageController = new _stagedrendering.StagedRenderingController({
|
|
978
979
|
abortSignal: finalServerController.signal,
|
|
979
980
|
abandonController: null,
|
|
980
|
-
// In dynamic renders, we allow Sync IO in
|
|
981
|
+
// In dynamic renders, we allow Sync IO in runtime stages
|
|
981
982
|
// if partialPrefetching is not enabled. However, a runtime prerender
|
|
982
983
|
// (or App Shell) is stricter and never allows sync IO in any stage
|
|
983
984
|
// that we go through here (i.e. < Dynamic)
|
|
984
985
|
syncIO: _stagedrendering.SyncIOMode.AllowedInDynamic,
|
|
985
|
-
|
|
986
|
-
finalStage: mode.type === 'session-shell-only' ? _stagedrendering.RenderStage.ShellRuntime : _stagedrendering.RenderStage.Runtime
|
|
986
|
+
finalStage
|
|
987
987
|
});
|
|
988
988
|
const varyParamsAccumulator = (0, _varyparams.createResponseVaryParamsAccumulator)();
|
|
989
989
|
const finalServerPrerenderStore = {
|
|
@@ -1000,15 +1000,15 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
1000
1000
|
// so we set `expire` and `revalidate` to their minimum values just in case.
|
|
1001
1001
|
revalidate: 1,
|
|
1002
1002
|
expire: 0,
|
|
1003
|
-
stale:
|
|
1003
|
+
stale: _constants2.INFINITE_CACHE,
|
|
1004
1004
|
tags: [
|
|
1005
1005
|
...implicitTags.tags
|
|
1006
1006
|
],
|
|
1007
1007
|
resumeDataCache,
|
|
1008
1008
|
hmrRefreshHash: undefined,
|
|
1009
1009
|
varyParamsAccumulator,
|
|
1010
|
-
stagedRendering:
|
|
1011
|
-
|
|
1010
|
+
stagedRendering: stageController,
|
|
1011
|
+
finalStage,
|
|
1012
1012
|
// These are not present in regular prerenders, but allowed in a runtime
|
|
1013
1013
|
// prerender.
|
|
1014
1014
|
headers: _headers.HeadersAdapter.fresh(headers),
|
|
@@ -1023,7 +1023,7 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
1023
1023
|
const stageByteLengths = createStageByteLengths();
|
|
1024
1024
|
const collectChunk = (chunk)=>{
|
|
1025
1025
|
collectPrerenderChunk(collectedChunks, finalServerController.signal, chunk);
|
|
1026
|
-
increaseChunkByteLengths(stageByteLengths,
|
|
1026
|
+
increaseChunkByteLengths(stageByteLengths, stageController.currentStage, chunk.byteLength);
|
|
1027
1027
|
};
|
|
1028
1028
|
let didHandleUnexpectedAbort = false;
|
|
1029
1029
|
/**
|
|
@@ -1043,6 +1043,12 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
1043
1043
|
};
|
|
1044
1044
|
const onUnexpectedAbort = ()=>{
|
|
1045
1045
|
resultIsPartial = true;
|
|
1046
|
+
const syncInterruptReason = serverDynamicTracking.syncDynamicErrorWithStack;
|
|
1047
|
+
if (syncInterruptReason) {
|
|
1048
|
+
console.error(syncInterruptReason);
|
|
1049
|
+
} else {
|
|
1050
|
+
console.error(new _invarianterror.InvariantError('A runtime prerender was aborted synchronously, but Next.js could not determine the reason.'));
|
|
1051
|
+
}
|
|
1046
1052
|
// FIXME(NAR-810): If we're already aborted due to Sync IO, there should be no need to
|
|
1047
1053
|
// finish the accumulators. However, it seems like in `--debug-prerender`
|
|
1048
1054
|
// the stream will stay open if we don't close the iterable here.
|
|
@@ -1054,7 +1060,7 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
1054
1060
|
}
|
|
1055
1061
|
};
|
|
1056
1062
|
await (0, _apprenderrenderutils.runInSequentialTasks)(async ()=>{
|
|
1057
|
-
|
|
1063
|
+
stageController.advanceStage(_stagedrendering.RenderStage.ShellStatic);
|
|
1058
1064
|
let stream = _workunitasyncstorageexternal.workUnitAsyncStorage.run(finalServerPrerenderStore, ComponentMod.renderToReadableStream, finalRSCPayload, clientModules, {
|
|
1059
1065
|
filterStackFrame,
|
|
1060
1066
|
onError,
|
|
@@ -1066,39 +1072,53 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
1066
1072
|
await iterateStreamingPrerenderChunks(stream, finalServerController.signal, collectChunk, streamState);
|
|
1067
1073
|
}, ()=>{
|
|
1068
1074
|
if (checkUnexpectedAbort()) return;
|
|
1069
|
-
|
|
1075
|
+
// Fold `PrefetchStatic_prefetchApi` into `PrefetchStatic` - no discrimination needed here
|
|
1076
|
+
stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic);
|
|
1070
1077
|
}, ()=>{
|
|
1071
1078
|
if (checkUnexpectedAbort()) return;
|
|
1072
|
-
|
|
1079
|
+
stageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic);
|
|
1073
1080
|
}, ()=>{
|
|
1074
1081
|
if (checkUnexpectedAbort()) return;
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1082
|
+
stageController.advanceStage(_stagedrendering.RenderStage.Static);
|
|
1083
|
+
}, ()=>{
|
|
1084
|
+
if (checkUnexpectedAbort()) return;
|
|
1085
|
+
stageController.advanceStage(_stagedrendering.RenderStage.ShellRuntime);
|
|
1086
|
+
}, ()=>{
|
|
1087
|
+
if (checkUnexpectedAbort()) return;
|
|
1088
|
+
// We may not reach this stage depending on the mode.
|
|
1089
|
+
if (finalStage < _stagedrendering.RenderStage.PrefetchRuntime) return;
|
|
1090
|
+
// Fold `PrefetchRuntime_prefetchApi` into `PrefetchRuntime` - no discrimination needed here
|
|
1091
|
+
stageController.advanceStage(_stagedrendering.RenderStage.PrefetchRuntime);
|
|
1080
1092
|
}, ()=>{
|
|
1081
1093
|
if (checkUnexpectedAbort()) return;
|
|
1082
|
-
// Finish the accumulators. We need to wait for Flight to flush the result into the stream,
|
|
1083
|
-
// which is scheduled in a (fast) immediate, so we do this in a separate task
|
|
1084
|
-
// (fast immediates will be drained at the end of the task, so in the next task we know we're done flushing)
|
|
1085
1094
|
// Check if session data unblocked new content in the shell.
|
|
1086
1095
|
const didSessionDataUnblockNewContent = stageByteLengths[_stagedrendering.RenderStage.ShellRuntime] > stageByteLengths[_stagedrendering.RenderStage.Static];
|
|
1087
1096
|
mode.shellUsedSessionDataDeferred.resolve(didSessionDataUnblockNewContent);
|
|
1088
|
-
if (
|
|
1089
|
-
// If advancing to the
|
|
1097
|
+
if ('shellByteLengthDeferred' in mode) {
|
|
1098
|
+
// If advancing to the PrefetchRuntime stage didn't unblock new content,
|
|
1090
1099
|
// then the result does not depend on link data and can be used as a shell (indicated via `null`).
|
|
1091
1100
|
// Otherwise, send a byte length to indicate where the shell content ends.
|
|
1092
|
-
const didLinkDataUnblockNewContent = stageByteLengths[_stagedrendering.RenderStage.
|
|
1101
|
+
const didLinkDataUnblockNewContent = stageByteLengths[_stagedrendering.RenderStage.PrefetchRuntime] > stageByteLengths[_stagedrendering.RenderStage.ShellRuntime];
|
|
1093
1102
|
mode.shellByteLengthDeferred.resolve(didLinkDataUnblockNewContent ? stageByteLengths[_stagedrendering.RenderStage.ShellRuntime] : null);
|
|
1094
1103
|
}
|
|
1104
|
+
}, ()=>{
|
|
1105
|
+
if (checkUnexpectedAbort()) return;
|
|
1106
|
+
// We may not reach this stage depending on the mode.
|
|
1107
|
+
if (finalStage < _stagedrendering.RenderStage.NavigationRuntime) return;
|
|
1108
|
+
stageController.advanceStage(_stagedrendering.RenderStage.NavigationRuntime);
|
|
1109
|
+
}, ()=>{
|
|
1110
|
+
// Finish the accumulators. We need to wait for Flight to flush the result into the stream,
|
|
1111
|
+
// which is scheduled in a (fast) immediate, so we do this in a separate task
|
|
1112
|
+
// (fast immediates will be drained at the end of the task, so in the next task we know we're done flushing)
|
|
1095
1113
|
staleTimeIterable.close();
|
|
1096
1114
|
(0, _varyparams.finishAccumulatingVaryParams)(varyParamsAccumulator);
|
|
1097
1115
|
}, ()=>{
|
|
1098
1116
|
if (checkUnexpectedAbort()) return;
|
|
1099
1117
|
if (streamState.isPending) {
|
|
1100
|
-
// If the prerender is still pending then it must
|
|
1101
|
-
// (
|
|
1118
|
+
// If the prerender is still pending then it must be blocked by
|
|
1119
|
+
// - prefetch(), navigation(), or dynamic data (for shell prefetches)
|
|
1120
|
+
// - navigation() or dynamic data (for runtime prefetches)
|
|
1121
|
+
// - dynamic data (for runtime prefetch streams embedded in navigations)
|
|
1102
1122
|
resultIsPartial = true;
|
|
1103
1123
|
}
|
|
1104
1124
|
_workunitasyncstorageexternal.workUnitAsyncStorage.run(finalServerPrerenderStore, finalServerController.abort.bind(finalServerController));
|
|
@@ -1118,6 +1138,16 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
1118
1138
|
collectedTags: finalServerPrerenderStore.tags
|
|
1119
1139
|
};
|
|
1120
1140
|
}
|
|
1141
|
+
function getFinalStageForRuntimePrerenderMode(mode) {
|
|
1142
|
+
switch(mode.type){
|
|
1143
|
+
case 'session-shell-only':
|
|
1144
|
+
return _stagedrendering.RenderStage.ShellRuntime;
|
|
1145
|
+
case 'rewindable-session-shell':
|
|
1146
|
+
return _stagedrendering.RenderStage.PrefetchRuntime;
|
|
1147
|
+
case 'navigation':
|
|
1148
|
+
return _stagedrendering.RenderStage.NavigationRuntime;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1121
1151
|
/**
|
|
1122
1152
|
* Crawlers will inadvertently think the canonicalUrl in the RSC payload should be crawled
|
|
1123
1153
|
* when our intention is to just seed the router state with the current URL.
|
|
@@ -1126,37 +1156,10 @@ async function finalRuntimeServerPrerender(mode, ctx, getPayload, resumeDataCach
|
|
|
1126
1156
|
*/ function prepareInitialCanonicalUrl(url) {
|
|
1127
1157
|
return (url.pathname + url.search).split('/');
|
|
1128
1158
|
}
|
|
1129
|
-
function getRenderedSearch(query) {
|
|
1130
|
-
// Inlined implementation of querystring.encode, which is not available in
|
|
1131
|
-
// the Edge runtime.
|
|
1132
|
-
const pairs = [];
|
|
1133
|
-
for(const key in query){
|
|
1134
|
-
const value1 = query[key];
|
|
1135
|
-
if (value1 == null) continue;
|
|
1136
|
-
if (Array.isArray(value1)) {
|
|
1137
|
-
for (const v of value1){
|
|
1138
|
-
pairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(v))}`);
|
|
1139
|
-
}
|
|
1140
|
-
} else {
|
|
1141
|
-
pairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value1))}`);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
// The result should match the format of a web URL's `search` property, since
|
|
1145
|
-
// this is the format that's stored in the App Router state.
|
|
1146
|
-
// TODO: We're a bit inconsistent about this. The x-nextjs-rewritten-query
|
|
1147
|
-
// header omits the leading question mark. Should refactor to always do
|
|
1148
|
-
// that instead.
|
|
1149
|
-
if (pairs.length === 0) {
|
|
1150
|
-
// If the search string is empty, return an empty string.
|
|
1151
|
-
return '';
|
|
1152
|
-
}
|
|
1153
|
-
// Prepend '?' to the search params string.
|
|
1154
|
-
return '?' + pairs.join('&');
|
|
1155
|
-
}
|
|
1156
1159
|
// This is the data necessary to render <AppRouter /> when no SSR errors are encountered
|
|
1157
1160
|
async function getRSCPayload(tree, ctx, options) {
|
|
1158
1161
|
var _ctx_renderOpts_prefetchHints;
|
|
1159
|
-
const { is404, staleTimeIterable, staticStageByteLengthPromise, shellByteLengthPromise, runtimePrefetchStream } = options;
|
|
1162
|
+
const { is404, isPrerendering, staleTimeIterable, staticStageByteLengthPromise, shellByteLengthPromise, runtimePrefetchStream } = options;
|
|
1160
1163
|
const injectedCSS = new Set();
|
|
1161
1164
|
const injectedJS = new Set();
|
|
1162
1165
|
const injectedFontPreloadTags = new Set();
|
|
@@ -1165,10 +1168,8 @@ async function getRSCPayload(tree, ctx, options) {
|
|
|
1165
1168
|
if (process.env.__NEXT_DEV_SERVER) {
|
|
1166
1169
|
missingSlots = new Set();
|
|
1167
1170
|
}
|
|
1168
|
-
const {
|
|
1171
|
+
const { query, appUsingSizeAdjustment, componentMod: { createMetadataComponents, createElement, Fragment }, url } = ctx;
|
|
1169
1172
|
const hints = ((_ctx_renderOpts_prefetchHints = ctx.renderOpts.prefetchHints) == null ? void 0 : _ctx_renderOpts_prefetchHints[ctx.pagePath]) ?? null;
|
|
1170
|
-
const prefetchInliningEnabled = Boolean(ctx.renderOpts.experimental.prefetchInlining);
|
|
1171
|
-
const initialTree = await (0, _createflightrouterstatefromloadertree.createFlightRouterStateFromLoaderTree)(tree, hints, prefetchInliningEnabled, ctx.renderOpts.cacheComponents, ctx.renderOpts.partialPrefetching, workStore.isStaticGeneration, ctx.renderOpts.isBuildTimePrerendering ?? false, getDynamicParamFromSegment, query);
|
|
1172
1173
|
const serveStreamingMetadata = !!ctx.renderOpts.serveStreamingMetadata;
|
|
1173
1174
|
const hasGlobalNotFound = !!tree[2]['global-not-found'];
|
|
1174
1175
|
const { Viewport, Metadata, MetadataOutlet } = createMetadataComponents({
|
|
@@ -1186,7 +1187,7 @@ async function getRSCPayload(tree, ctx, options) {
|
|
|
1186
1187
|
serveStreamingMetadata
|
|
1187
1188
|
});
|
|
1188
1189
|
const preloadCallbacks = [];
|
|
1189
|
-
const
|
|
1190
|
+
const initialTree = await (0, _createcomponenttree.createFullComponentTree)({
|
|
1190
1191
|
ctx,
|
|
1191
1192
|
loaderTree: tree,
|
|
1192
1193
|
parentParams: {},
|
|
@@ -1199,7 +1200,9 @@ async function getRSCPayload(tree, ctx, options) {
|
|
|
1199
1200
|
missingSlots,
|
|
1200
1201
|
preloadCallbacks,
|
|
1201
1202
|
authInterrupts: ctx.renderOpts.experimental.authInterrupts,
|
|
1202
|
-
MetadataOutlet
|
|
1203
|
+
MetadataOutlet,
|
|
1204
|
+
isPrerendering,
|
|
1205
|
+
hintTree: hints
|
|
1203
1206
|
});
|
|
1204
1207
|
// When the `vary` response header is present with `Next-URL`, that means there's a chance
|
|
1205
1208
|
// it could respond differently if there's an interception route. We provide this information
|
|
@@ -1226,24 +1229,24 @@ async function getRSCPayload(tree, ctx, options) {
|
|
|
1226
1229
|
// client Segment Cache after a prefetch to determine if it can skip the
|
|
1227
1230
|
// second request to fill in the dynamic data.
|
|
1228
1231
|
//
|
|
1229
|
-
// See
|
|
1230
|
-
const isPossiblyPartialHead =
|
|
1232
|
+
// See AppRenderCapabilities.isPossiblyPartialResponse for more context.
|
|
1233
|
+
const isPossiblyPartialHead = ctx.renderCapabilities.isPossiblyPartialResponse;
|
|
1231
1234
|
return maybeAppendBuildIdToRSCPayload(ctx, {
|
|
1232
1235
|
// See the comment above the `Preloads` component (below) for why this is part of the payload
|
|
1233
1236
|
P: createElement(Preloads, {
|
|
1234
1237
|
preloadCallbacks: preloadCallbacks
|
|
1235
1238
|
}),
|
|
1236
1239
|
c: prepareInitialCanonicalUrl(url),
|
|
1237
|
-
q: getRenderedSearch(query),
|
|
1240
|
+
q: (0, _querystring.getRenderedSearch)(query),
|
|
1238
1241
|
i: !!couldBeIntercepted,
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1242
|
+
t: {
|
|
1243
|
+
t: initialTree,
|
|
1244
|
+
h: {
|
|
1245
|
+
r: initialHead,
|
|
1246
|
+
p: isPossiblyPartialHead,
|
|
1247
|
+
v: (0, _varyparams.getMetadataVaryParamsAccumulator)()
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1247
1250
|
m: missingSlots,
|
|
1248
1251
|
G: [
|
|
1249
1252
|
GlobalError,
|
|
@@ -1253,8 +1256,7 @@ async function getRSCPayload(tree, ctx, options) {
|
|
|
1253
1256
|
// With Cache Components, all routes support it. Without it, only fully
|
|
1254
1257
|
// static pages do, because their per-segment prefetch responses are
|
|
1255
1258
|
// generated during static generation (build or ISR).
|
|
1256
|
-
S:
|
|
1257
|
-
h: (0, _varyparams.getMetadataVaryParamsAccumulator)(),
|
|
1259
|
+
S: ctx.renderCapabilities.supportsPerSegmentPrefetching,
|
|
1258
1260
|
r: (0, _varyparams.getRootParamsVaryParamsAccumulator)() ?? undefined,
|
|
1259
1261
|
s: staleTimeIterable,
|
|
1260
1262
|
a: shellByteLengthPromise,
|
|
@@ -1265,7 +1267,7 @@ async function getRSCPayload(tree, ctx, options) {
|
|
|
1265
1267
|
// authoritative.
|
|
1266
1268
|
// TODO: Move this to the prefetch hints file so we don't have to walk
|
|
1267
1269
|
// the tree on every render.
|
|
1268
|
-
d: !
|
|
1270
|
+
d: !isPrerendering ? await getDynamicStaleTime(tree) ?? undefined : undefined
|
|
1269
1271
|
});
|
|
1270
1272
|
}
|
|
1271
1273
|
/**
|
|
@@ -1280,7 +1282,7 @@ async function getRSCPayload(tree, ctx, options) {
|
|
|
1280
1282
|
// This is the data necessary to render <AppRouter /> when an error state is triggered
|
|
1281
1283
|
async function getErrorRSCPayload(tree, ctx, ssrError, errorType, shouldRenderMetadataAndViewport) {
|
|
1282
1284
|
var _ctx_renderOpts_prefetchHints;
|
|
1283
|
-
const { getDynamicParamFromSegment, query, componentMod: { createMetadataComponents, createElement, Fragment }, url
|
|
1285
|
+
const { getDynamicParamFromSegment, query, componentMod: { createMetadataComponents, createElement, Fragment }, url } = ctx;
|
|
1284
1286
|
let Viewport = null;
|
|
1285
1287
|
let Metadata = null;
|
|
1286
1288
|
if (shouldRenderMetadataAndViewport) {
|
|
@@ -1310,45 +1312,43 @@ async function getErrorRSCPayload(tree, ctx, ssrError, errorType, shouldRenderMe
|
|
|
1310
1312
|
}), Metadata ? createElement(Metadata, null) : null);
|
|
1311
1313
|
const errorHints = ((_ctx_renderOpts_prefetchHints = ctx.renderOpts.prefetchHints) == null ? void 0 : _ctx_renderOpts_prefetchHints[ctx.pagePath]) ?? null;
|
|
1312
1314
|
const errorPrefetchInliningEnabled = Boolean(ctx.renderOpts.experimental.prefetchInlining);
|
|
1313
|
-
const initialTree = await (0, _createflightrouterstatefromloadertree.createFlightRouterStateFromLoaderTree)(tree, errorHints, errorPrefetchInliningEnabled, ctx.renderOpts.cacheComponents, ctx.renderOpts.partialPrefetching, workStore.isStaticGeneration, ctx.renderOpts.isBuildTimePrerendering ?? false, getDynamicParamFromSegment, query);
|
|
1314
1315
|
let err = undefined;
|
|
1315
1316
|
if (ssrError) {
|
|
1316
|
-
err = (0, _iserror.default)(ssrError) ? ssrError :
|
|
1317
|
-
value: "E394",
|
|
1318
|
-
enumerable: false,
|
|
1319
|
-
configurable: true
|
|
1320
|
-
});
|
|
1317
|
+
err = (0, _iserror.default)(ssrError) ? ssrError : new Error(ssrError + '');
|
|
1321
1318
|
}
|
|
1322
1319
|
// For metadata notFound error there's no global not found boundary on top
|
|
1323
1320
|
// so we create a not found page with AppRouter
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1321
|
+
const errorShell = createElement('html', {
|
|
1322
|
+
id: '__next_error__'
|
|
1323
|
+
}, createElement('head', null), createElement('body', null, process.env.__NEXT_DEV_SERVER && err ? createElement('template', {
|
|
1324
|
+
'data-next-error-message': err.message,
|
|
1325
|
+
'data-next-error-digest': 'digest' in err ? err.digest : '',
|
|
1326
|
+
'data-next-error-stack': err.stack
|
|
1327
|
+
}) : null));
|
|
1328
|
+
const partialPrefetching = Boolean(ctx.renderOpts.partialPrefetching) || await (0, _instantconfig.anySegmentHasPartialPrefetchingEnabled)(tree);
|
|
1329
|
+
const initialTree = await (0, _createtransporttreefromloadertree.createFullTransportTreeFromLoaderTree)(tree, errorHints, errorPrefetchInliningEnabled, ctx.missingPrefetchHintPolicy, partialPrefetching, getDynamicParamFromSegment, ctx.renderOpts.notFoundParams);
|
|
1330
|
+
// Attach the error shell as the root's render output. Vary params are not
|
|
1331
|
+
// tracked for error pages.
|
|
1332
|
+
initialTree.d = {
|
|
1333
|
+
r: errorShell,
|
|
1334
|
+
p: false,
|
|
1335
|
+
v: null
|
|
1336
|
+
};
|
|
1337
1337
|
const { GlobalError, styles: globalErrorStyles } = await getGlobalErrorStyles(tree, ctx);
|
|
1338
|
-
const isPossiblyPartialHead =
|
|
1338
|
+
const isPossiblyPartialHead = ctx.renderCapabilities.isPossiblyPartialResponse;
|
|
1339
1339
|
return maybeAppendBuildIdToRSCPayload(ctx, {
|
|
1340
1340
|
c: prepareInitialCanonicalUrl(url),
|
|
1341
|
-
q: getRenderedSearch(query),
|
|
1341
|
+
q: (0, _querystring.getRenderedSearch)(query),
|
|
1342
1342
|
m: undefined,
|
|
1343
1343
|
i: false,
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1344
|
+
t: {
|
|
1345
|
+
t: initialTree,
|
|
1346
|
+
h: {
|
|
1347
|
+
r: initialHead,
|
|
1348
|
+
p: isPossiblyPartialHead,
|
|
1349
|
+
v: (0, _varyparams.getMetadataVaryParamsAccumulator)()
|
|
1350
|
+
}
|
|
1351
|
+
},
|
|
1352
1352
|
G: [
|
|
1353
1353
|
GlobalError,
|
|
1354
1354
|
globalErrorStyles
|
|
@@ -1357,8 +1357,7 @@ async function getErrorRSCPayload(tree, ctx, ssrError, errorType, shouldRenderMe
|
|
|
1357
1357
|
// With Cache Components, all routes support it. Without it, only fully
|
|
1358
1358
|
// static pages do, because their per-segment prefetch responses are
|
|
1359
1359
|
// generated during static generation (build or ISR).
|
|
1360
|
-
S:
|
|
1361
|
-
h: (0, _varyparams.getMetadataVaryParamsAccumulator)(),
|
|
1360
|
+
S: ctx.renderCapabilities.supportsPerSegmentPrefetching,
|
|
1362
1361
|
r: (0, _varyparams.getRootParamsVaryParamsAccumulator)() ?? undefined
|
|
1363
1362
|
});
|
|
1364
1363
|
}
|
|
@@ -1421,13 +1420,13 @@ function ErrorApp({ reactServerStream, preinitScripts, ServerInsertedHTMLProvide
|
|
|
1421
1420
|
/* eslint-enable @next/internal/no-ambiguous-jsx -- React Client */ }
|
|
1422
1421
|
/**
|
|
1423
1422
|
* Extracted to a separate function to prevent V8 from retaining the entire
|
|
1424
|
-
*
|
|
1423
|
+
* the render initialization scope through globalThis.__next_require__.
|
|
1425
1424
|
* V8 shares a single Context object per scope for all closures; by creating
|
|
1426
1425
|
* these closures in their own function scope, the globalThis references only
|
|
1427
1426
|
* retain `instrumented` and `cacheComponents`, not request-specific data like
|
|
1428
1427
|
* req/res/workStore.
|
|
1429
|
-
*/ function installGlobalModuleLoadingHandlers(ComponentMod, cacheComponents
|
|
1430
|
-
const instrumented = (0, _clientcomponentrendererlogger.wrapClientComponentLoader)(ComponentMod
|
|
1428
|
+
*/ function installGlobalModuleLoadingHandlers(ComponentMod, cacheComponents) {
|
|
1429
|
+
const instrumented = (0, _clientcomponentrendererlogger.wrapClientComponentLoader)(ComponentMod);
|
|
1431
1430
|
// When we are prerendering if there is a cacheSignal for tracking
|
|
1432
1431
|
// cache reads we track calls to `loadChunk` and `require`. This allows us
|
|
1433
1432
|
// to treat chunk/module loading with similar semantics as cache reads to avoid
|
|
@@ -1451,11 +1450,10 @@ function ErrorApp({ reactServerStream, preinitScripts, ServerInsertedHTMLProvide
|
|
|
1451
1450
|
case 'cache':
|
|
1452
1451
|
case 'private-cache':
|
|
1453
1452
|
return true;
|
|
1454
|
-
case 'prerender-ppr':
|
|
1455
1453
|
case 'prerender-legacy':
|
|
1456
1454
|
case 'request':
|
|
1457
1455
|
case 'unstable-cache':
|
|
1458
|
-
case '
|
|
1456
|
+
case 'build-time-generator':
|
|
1459
1457
|
return false;
|
|
1460
1458
|
default:
|
|
1461
1459
|
workUnitStore;
|
|
@@ -1478,7 +1476,40 @@ function ErrorApp({ reactServerStream, preinitScripts, ServerInsertedHTMLProvide
|
|
|
1478
1476
|
return loadingChunk;
|
|
1479
1477
|
};
|
|
1480
1478
|
}
|
|
1481
|
-
|
|
1479
|
+
const generateRenderRequestId = ()=>{
|
|
1480
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
1481
|
+
return crypto.randomUUID();
|
|
1482
|
+
} else {
|
|
1483
|
+
return require('next/dist/compiled/nanoid').nanoid();
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
const generatePrerenderRequestId = async (req)=>{
|
|
1487
|
+
return Buffer.from(await crypto.subtle.digest('SHA-1', Buffer.from(req.url))).toString('hex');
|
|
1488
|
+
};
|
|
1489
|
+
function initializeClientComponentLoadTracking(renderOpts, workStore) {
|
|
1490
|
+
if (!renderOpts.ComponentMod.__next_app__) return undefined;
|
|
1491
|
+
// Capture the request's span before the HTML render creates its own span.
|
|
1492
|
+
const parentSpan = (0, _tracer.getTracer)().getActiveScopeSpan();
|
|
1493
|
+
const isTracingEnabled = (parentSpan == null ? void 0 : parentSpan.isRecording()) ?? false;
|
|
1494
|
+
let tracker;
|
|
1495
|
+
if ('performance' in globalThis && (process.env.NEXT_OTEL_PERFORMANCE_PREFIX || isTracingEnabled)) {
|
|
1496
|
+
tracker = new _clientcomponentrendererlogger.ClientComponentLoadTracker((metrics)=>{
|
|
1497
|
+
if (process.env.NEXT_RUNTIME !== 'edge' && isTracingEnabled && metrics && metrics.clientComponentLoadEnd >= metrics.clientComponentLoadStart) {
|
|
1498
|
+
(0, _tracer.getTracer)().startSpan(_constants1.NextNodeServerSpan.clientComponentLoading, {
|
|
1499
|
+
parentSpan,
|
|
1500
|
+
startTime: metrics.clientComponentLoadStart,
|
|
1501
|
+
attributes: {
|
|
1502
|
+
'next.clientComponentLoadCount': metrics.clientComponentLoadCount,
|
|
1503
|
+
'next.span_type': _constants1.NextNodeServerSpan.clientComponentLoading
|
|
1504
|
+
}
|
|
1505
|
+
}).end(metrics.clientComponentLoadEnd);
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
workStore.clientComponentLoadTracker = tracker;
|
|
1509
|
+
}
|
|
1510
|
+
return tracker;
|
|
1511
|
+
}
|
|
1512
|
+
async function prepareAppPageRender(req, res, url, pagePath, query, renderOpts, workStore, parsedRequestHeaders, sharedContext, interpolatedParams, fallbackRouteParams, routeMatch, generateRequestId, missingPrefetchHintPolicy, renderCapabilities) {
|
|
1482
1513
|
const isNotFoundPath = pagePath === '/404';
|
|
1483
1514
|
if (isNotFoundPath) {
|
|
1484
1515
|
res.statusCode = 404;
|
|
@@ -1488,21 +1519,7 @@ async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOp
|
|
|
1488
1519
|
// avoid that resources can be deduped by React Float if the same resource is
|
|
1489
1520
|
// rendered or preloaded multiple times: `<link href="a.css?v={Date.now()}"/>`.
|
|
1490
1521
|
const requestTimestamp = Date.now();
|
|
1491
|
-
const { ComponentMod, nextFontManifest,
|
|
1492
|
-
const { cachedNavigations } = renderOpts.experimental;
|
|
1493
|
-
// We need to expose the bundled `require` API globally for
|
|
1494
|
-
// react-server-dom-webpack. This is a hack until we find a better way.
|
|
1495
|
-
if (ComponentMod.__next_app__) {
|
|
1496
|
-
var _getTracer_getActiveScopeSpan;
|
|
1497
|
-
const isTracingEnabled = ((_getTracer_getActiveScopeSpan = (0, _tracer.getTracer)().getActiveScopeSpan()) == null ? void 0 : _getTracer_getActiveScopeSpan.isRecording()) ?? false;
|
|
1498
|
-
installGlobalModuleLoadingHandlers(ComponentMod, cacheComponents, isTracingEnabled);
|
|
1499
|
-
}
|
|
1500
|
-
if (process.env.__NEXT_DEV_SERVER && setIsrStatus && !cacheComponents) {
|
|
1501
|
-
// Reset the ISR status at start of request.
|
|
1502
|
-
const { pathname } = new URL(req.url || '/', 'http://n');
|
|
1503
|
-
setIsrStatus(pathname, // Only pages using the Node runtime can use ISR, Edge is always dynamic.
|
|
1504
|
-
process.env.NEXT_RUNTIME === 'edge' ? false : undefined);
|
|
1505
|
-
}
|
|
1522
|
+
const { ComponentMod, nextFontManifest, assetPrefix = '', enableTainting } = renderOpts;
|
|
1506
1523
|
if (// The type check here ensures that `req` is correctly typed, and the
|
|
1507
1524
|
// environment variable check provides dead code elimination.
|
|
1508
1525
|
process.env.NEXT_RUNTIME !== 'edge' && (0, _helpers.isNodeNextRequest)(req)) {
|
|
@@ -1511,22 +1528,6 @@ async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOp
|
|
|
1511
1528
|
// report them at that time.
|
|
1512
1529
|
workStore.shouldTrackFetchMetrics = false;
|
|
1513
1530
|
});
|
|
1514
|
-
req.originalRequest.on('end', ()=>{
|
|
1515
|
-
if ('performance' in globalThis) {
|
|
1516
|
-
const metrics = (0, _clientcomponentrendererlogger.getClientComponentLoaderMetrics)({
|
|
1517
|
-
reset: true
|
|
1518
|
-
});
|
|
1519
|
-
if (metrics) {
|
|
1520
|
-
(0, _tracer.getTracer)().startSpan(_constants.NextNodeServerSpan.clientComponentLoading, {
|
|
1521
|
-
startTime: metrics.clientComponentLoadStart,
|
|
1522
|
-
attributes: {
|
|
1523
|
-
'next.clientComponentLoadCount': metrics.clientComponentLoadCount,
|
|
1524
|
-
'next.span_type': _constants.NextNodeServerSpan.clientComponentLoading
|
|
1525
|
-
}
|
|
1526
|
-
}).end(metrics.clientComponentLoadStart + metrics.clientComponentLoadTimes);
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
1531
|
}
|
|
1531
1532
|
const metadata = {
|
|
1532
1533
|
statusCode: isNotFoundPath ? 404 : undefined,
|
|
@@ -1546,11 +1547,10 @@ async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOp
|
|
|
1546
1547
|
...query
|
|
1547
1548
|
};
|
|
1548
1549
|
(0, _internalutils.stripInternalQueries)(query);
|
|
1549
|
-
const { isStaticGeneration } = workStore;
|
|
1550
1550
|
let requestId;
|
|
1551
1551
|
let htmlRequestId;
|
|
1552
1552
|
const requestInsightsIdentity = process.env.__NEXT_REQUEST_INSIGHTS ? (0, _requestinsightsidentity.getRequestInsightsIdentity)() : undefined;
|
|
1553
|
-
const { flightRouterState, isPrefetchRequest,
|
|
1553
|
+
const { flightRouterState, isPrefetchRequest, nonce } = parsedRequestHeaders;
|
|
1554
1554
|
if (parsedRequestHeaders.requestId) {
|
|
1555
1555
|
// If the client has provided a request ID (in development mode), we use it.
|
|
1556
1556
|
requestId = parsedRequestHeaders.requestId;
|
|
@@ -1560,13 +1560,7 @@ async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOp
|
|
|
1560
1560
|
requestId = requestInsightsIdentity.requestId;
|
|
1561
1561
|
} else {
|
|
1562
1562
|
// Otherwise we generate a new request ID.
|
|
1563
|
-
|
|
1564
|
-
requestId = Buffer.from(await crypto.subtle.digest('SHA-1', Buffer.from(req.url))).toString('hex');
|
|
1565
|
-
} else if (process.env.NEXT_RUNTIME === 'edge') {
|
|
1566
|
-
requestId = crypto.randomUUID();
|
|
1567
|
-
} else {
|
|
1568
|
-
requestId = require('next/dist/compiled/nanoid').nanoid();
|
|
1569
|
-
}
|
|
1563
|
+
requestId = await generateRequestId(req);
|
|
1570
1564
|
}
|
|
1571
1565
|
// If the client has provided an HTML request ID, we use it to associate the
|
|
1572
1566
|
// request with the HTML document from which it originated, which is used to
|
|
@@ -1578,22 +1572,14 @@ async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOp
|
|
|
1578
1572
|
workStore.htmlRequestId = htmlRequestId;
|
|
1579
1573
|
const getDynamicParamFromSegment = makeGetDynamicParamFromSegment(interpolatedParams, fallbackRouteParams, renderOpts.experimental.optimisticRouting);
|
|
1580
1574
|
const isPossibleActionRequest = (0, _serveractionrequestmeta.getIsPossibleServerAction)(req);
|
|
1581
|
-
|
|
1582
|
-
// interpolated, is decoded, and has trailing slash removed.
|
|
1583
|
-
const resolvedPathname = (0, _requestmeta.getRequestMeta)(req, 'resolvedPathname');
|
|
1584
|
-
if (!resolvedPathname) {
|
|
1585
|
-
throw Object.defineProperty(new _invarianterror.InvariantError('resolvedPathname must be set in request metadata'), "__NEXT_ERROR_CODE", {
|
|
1586
|
-
value: "E981",
|
|
1587
|
-
enumerable: false,
|
|
1588
|
-
configurable: true
|
|
1589
|
-
});
|
|
1590
|
-
}
|
|
1591
|
-
const implicitTags = await (0, _implicittags.getImplicitTags)(workStore.page, resolvedPathname, fallbackRouteParams);
|
|
1575
|
+
const implicitTags = await (0, _implicittags.getImplicitTags)(workStore.page, routeMatch.resolvedPathname, fallbackRouteParams);
|
|
1592
1576
|
const ctx = {
|
|
1593
1577
|
componentMod: ComponentMod,
|
|
1594
1578
|
url,
|
|
1595
1579
|
renderOpts,
|
|
1596
1580
|
workStore,
|
|
1581
|
+
missingPrefetchHintPolicy,
|
|
1582
|
+
renderCapabilities,
|
|
1597
1583
|
parsedRequestHeaders,
|
|
1598
1584
|
getDynamicParamFromSegment,
|
|
1599
1585
|
interpolatedParams,
|
|
@@ -1615,156 +1601,232 @@ async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOp
|
|
|
1615
1601
|
implicitTags
|
|
1616
1602
|
};
|
|
1617
1603
|
(0, _tracer.getTracer)().setRootSpanAttribute('next.route', pagePath);
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
for (const access of (0, _dynamicrendering.formatDynamicAPIAccesses)(response.dynamicAccess)){
|
|
1634
|
-
(0, _log.warn)(access);
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
// If we encountered any unexpected errors during build we fail the
|
|
1638
|
-
// prerendering phase and the build.
|
|
1639
|
-
if (workStore.invalidDynamicUsageError) {
|
|
1640
|
-
(0, _dynamicrendering.logDisallowedDynamicError)(workStore, workStore.invalidDynamicUsageError);
|
|
1641
|
-
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
1642
|
-
}
|
|
1643
|
-
if (response.digestErrorsMap.size) {
|
|
1644
|
-
const buildFailingError = response.digestErrorsMap.values().next().value;
|
|
1645
|
-
if (buildFailingError) throw buildFailingError;
|
|
1604
|
+
return {
|
|
1605
|
+
req,
|
|
1606
|
+
ctx,
|
|
1607
|
+
metadata,
|
|
1608
|
+
loaderTree
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
async function prerenderAppPage({ ctx, metadata, loaderTree }) {
|
|
1612
|
+
const { res, pagePath, renderOpts, workStore, url, fallbackRouteParams } = ctx;
|
|
1613
|
+
// We're either building or revalidating. In either case we need to
|
|
1614
|
+
// prerender our page rather than render it.
|
|
1615
|
+
const prerenderToStreamWithTracing = (0, _tracer.getTracer)().wrap(_constants1.AppRenderSpan.getBodyResult, {
|
|
1616
|
+
spanName: `prerender route (app) ${pagePath}`,
|
|
1617
|
+
attributes: {
|
|
1618
|
+
'next.route': pagePath
|
|
1646
1619
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1620
|
+
}, prerenderToStream);
|
|
1621
|
+
const tracker = initializeClientComponentLoadTracking(renderOpts, workStore);
|
|
1622
|
+
metadata.clientComponentLoadTracker = tracker;
|
|
1623
|
+
let response;
|
|
1624
|
+
try {
|
|
1625
|
+
response = await prerenderToStreamWithTracing(res, ctx, metadata, loaderTree, fallbackRouteParams);
|
|
1626
|
+
} finally{
|
|
1627
|
+
tracker == null ? void 0 : tracker.finish();
|
|
1628
|
+
}
|
|
1629
|
+
// If we're debugging partial prerendering, print all the dynamic API accesses
|
|
1630
|
+
// that occurred during the render.
|
|
1631
|
+
// @TODO move into renderToStream function
|
|
1632
|
+
if (response.dynamicAccess && (0, _dynamicrendering.accessedDynamicData)(response.dynamicAccess) && renderOpts.isDebugDynamicAccesses) {
|
|
1633
|
+
(0, _log.warn)('The following dynamic usage was detected:');
|
|
1634
|
+
for (const access of (0, _dynamicrendering.formatDynamicAPIAccesses)(response.dynamicAccess)){
|
|
1635
|
+
(0, _log.warn)(access);
|
|
1651
1636
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1637
|
+
}
|
|
1638
|
+
if (workStore.invalidDynamicUsageError) {
|
|
1639
|
+
(0, _dynamicrendering.logDisallowedDynamicError)(workStore, workStore.invalidDynamicUsageError);
|
|
1640
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
1641
|
+
}
|
|
1642
|
+
let renderError = response.error;
|
|
1643
|
+
const firstReactServerError = response.digestErrorsMap.values().next();
|
|
1644
|
+
if (!firstReactServerError.done) {
|
|
1645
|
+
renderError = {
|
|
1646
|
+
thrownValue: firstReactServerError.value
|
|
1655
1647
|
};
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
renderOpts.waitUntil(revalidatesPromise);
|
|
1666
|
-
} else {
|
|
1667
|
-
options.waitUntil = revalidatesPromise;
|
|
1648
|
+
}
|
|
1649
|
+
// Pick first userland SSR error, which is also not a RSC error.
|
|
1650
|
+
if (renderError === undefined) {
|
|
1651
|
+
for (const ssrError of response.ssrErrors){
|
|
1652
|
+
if ((0, _createerrorhandler.isUserLandError)(ssrError, renderOpts.experimental.reactBrowserBailout)) {
|
|
1653
|
+
renderError = {
|
|
1654
|
+
thrownValue: ssrError
|
|
1655
|
+
};
|
|
1656
|
+
break;
|
|
1668
1657
|
}
|
|
1669
1658
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1659
|
+
}
|
|
1660
|
+
// Build failures still throw, even if recovery produced a usable response.
|
|
1661
|
+
if (renderError !== undefined && renderOpts.isBuildTimePrerendering) {
|
|
1662
|
+
throw renderError.thrownValue;
|
|
1663
|
+
}
|
|
1664
|
+
const options = {
|
|
1665
|
+
metadata,
|
|
1666
|
+
contentType: _constants2.HTML_CONTENT_TYPE_HEADER
|
|
1667
|
+
};
|
|
1668
|
+
// If we have pending revalidates, wait until they are all resolved.
|
|
1669
|
+
const maybeRevalidatesPromise = (0, _revalidationutils.executeRevalidates)(workStore);
|
|
1670
|
+
if (maybeRevalidatesPromise !== false) {
|
|
1671
|
+
const revalidatesPromise = maybeRevalidatesPromise.finally(()=>{
|
|
1672
|
+
if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {
|
|
1673
|
+
console.log('pending revalidates promise finished for:', url.href);
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1676
|
+
if (renderOpts.waitUntil) {
|
|
1677
|
+
renderOpts.waitUntil(revalidatesPromise);
|
|
1678
|
+
} else {
|
|
1679
|
+
options.waitUntil = revalidatesPromise;
|
|
1681
1680
|
}
|
|
1682
|
-
|
|
1681
|
+
}
|
|
1682
|
+
if (renderError !== undefined) {
|
|
1683
|
+
res.statusCode = 500;
|
|
1684
|
+
metadata.statusCode = 500;
|
|
1683
1685
|
} else {
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1686
|
+
applyMetadataFromPrerenderResult(response, metadata, workStore);
|
|
1687
|
+
}
|
|
1688
|
+
const streamString = await (0, _streamops.streamToString)(response.stream);
|
|
1689
|
+
// Copy only the delivery metadata. Partial recovery includes its resume data
|
|
1690
|
+
// cache in the serialized postponed state, so it needs no live cache below.
|
|
1691
|
+
if (renderError !== undefined) {
|
|
1692
|
+
return {
|
|
1693
|
+
error: (0, _iserror.getProperError)(renderError.thrownValue),
|
|
1694
|
+
result: new _renderresult.default(streamString, {
|
|
1695
|
+
contentType: _constants2.HTML_CONTENT_TYPE_HEADER,
|
|
1696
|
+
waitUntil: options.waitUntil,
|
|
1697
|
+
metadata: {
|
|
1698
|
+
headers: metadata.headers,
|
|
1699
|
+
flightData: metadata.flightData,
|
|
1700
|
+
fetchMetrics: metadata.fetchMetrics,
|
|
1701
|
+
postponed: metadata.postponed
|
|
1702
|
+
}
|
|
1703
|
+
})
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
if (response.renderResumeDataCache) {
|
|
1707
|
+
metadata.renderResumeDataCache = response.renderResumeDataCache;
|
|
1708
|
+
}
|
|
1709
|
+
const result = new _renderresult.default(streamString, options);
|
|
1710
|
+
// Run build-time instant validation if the page has instant configs
|
|
1711
|
+
// TODO(instant-validation-build): This is not a great place to wire this in.
|
|
1712
|
+
if (workStore.cacheComponentsEnabled && workStore.isBuildTimePrerendering && renderOpts.runInstantValidation && await (0, _instantconfig.anySegmentNeedsInstantValidationInBuild)(loaderTree)) {
|
|
1713
|
+
// Throws StaticGenBailoutError if validation failed.
|
|
1714
|
+
await validateInstantConfigsInBuild(ctx, response.renderResumeDataCache ?? null);
|
|
1715
|
+
}
|
|
1716
|
+
return result;
|
|
1717
|
+
}
|
|
1718
|
+
async function renderAppPage({ req, ctx, metadata, loaderTree }, postponedState, dev) {
|
|
1719
|
+
const { res, url, renderOpts, workStore, parsedRequestHeaders, componentMod: ComponentMod, implicitTags } = ctx;
|
|
1720
|
+
const { cacheComponents, setIsrStatus, serverActions } = renderOpts;
|
|
1721
|
+
const { cachedNavigations } = renderOpts.experimental;
|
|
1722
|
+
const { isHmrRefresh, isPrefetchRequest, isRSCRequest, isRuntimePrefetchRequest, isAppShellPrefetchRequest, isRouteTreePrefetchRequest } = parsedRequestHeaders;
|
|
1723
|
+
const isPossibleActionRequest = ctx.isPossibleServerAction;
|
|
1724
|
+
// We're rendering dynamically
|
|
1725
|
+
const renderResumeDataCache = renderOpts.renderResumeDataCache ?? (postponedState == null ? void 0 : postponedState.renderResumeDataCache) ?? null;
|
|
1726
|
+
const rootParams = (0, _createcomponenttree.getRootParams)(loaderTree, ctx.getDynamicParamFromSegment);
|
|
1727
|
+
// Keep the placeholder map for dev's separate prerender validation. The
|
|
1728
|
+
// request store only needs names to defer params during a staged render.
|
|
1729
|
+
const stagedFallbackParams = (0, _requestmeta.getRequestMeta)(req, 'stagedFallbackParams') ?? null;
|
|
1730
|
+
const stagedFallbackParamNames = (postponedState == null ? void 0 : postponedState.stagedFallbackParams) !== undefined ? postponedState.stagedFallbackParams : stagedFallbackParams ? new Set(stagedFallbackParams.keys()) : null;
|
|
1731
|
+
const createRequestStore = _requeststore.createRequestStoreForRender.bind(null, req, res, url, rootParams, implicitTags, renderOpts.onUpdateCookies, renderOpts.previewProps, isHmrRefresh, dev == null ? void 0 : dev.serverComponentsHmrCache, renderResumeDataCache, stagedFallbackParamNames, dev == null ? void 0 : dev.hmrRefreshHash);
|
|
1732
|
+
const requestStore = createRequestStore();
|
|
1733
|
+
const setDevIsrStatus = process.env.__NEXT_DEV_SERVER && setIsrStatus && !cacheComponents && !isPossibleActionRequest && !isPrefetchRequest && !isRuntimePrefetchRequest && !isAppShellPrefetchRequest && !isRouteTreePrefetchRequest ? setIsrStatus : undefined;
|
|
1734
|
+
if (setDevIsrStatus) {
|
|
1735
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
1736
|
+
// Edge routes cannot use ISR, so there is no dynamic transition to watch.
|
|
1737
|
+
setDevIsrStatus(url.pathname, false);
|
|
1738
|
+
} else {
|
|
1739
|
+
// The indicator remains pending until the output has finished rendering.
|
|
1740
|
+
setDevIsrStatus(url.pathname, undefined);
|
|
1701
1741
|
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1742
|
+
}
|
|
1743
|
+
// MARK: RSC request
|
|
1744
|
+
if (isRSCRequest) {
|
|
1745
|
+
if (isRuntimePrefetchRequest) {
|
|
1746
|
+
// MARK: RSC runtimePrefetch
|
|
1747
|
+
return generateRuntimePrefetchResult(ctx, requestStore, isAppShellPrefetchRequest);
|
|
1748
|
+
} else {
|
|
1749
|
+
if (process.env.__NEXT_DEV_SERVER && process.env.NEXT_RUNTIME !== 'edge' && cacheComponents) {
|
|
1750
|
+
// MARK: RSC devCacheComponents
|
|
1751
|
+
return generateDynamicFlightRenderResultWithStagesInDev(ctx, requestStore, createRequestStore, stagedFallbackParams);
|
|
1752
|
+
} else if (cacheComponents && cachedNavigations) {
|
|
1753
|
+
// MARK: RSC cacheComponents
|
|
1754
|
+
return generateStagedDynamicFlightRenderResultNode(ctx, requestStore);
|
|
1707
1755
|
} else {
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1756
|
+
// MARK: RSC dynamic
|
|
1757
|
+
const result = await generateDynamicFlightRenderResult(ctx, requestStore);
|
|
1758
|
+
if (setDevIsrStatus && process.env.NEXT_RUNTIME !== 'edge') {
|
|
1759
|
+
result.pipeThrough(new TransformStream({
|
|
1760
|
+
// Only a normally completed output can classify the route.
|
|
1761
|
+
// Stream errors and cancellation leave the indicator pending.
|
|
1762
|
+
flush () {
|
|
1763
|
+
setDevIsrStatus(url.pathname, !requestStore.usedDynamic && !workStore.forceDynamic);
|
|
1764
|
+
}
|
|
1765
|
+
}));
|
|
1717
1766
|
}
|
|
1767
|
+
return result;
|
|
1718
1768
|
}
|
|
1719
1769
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1770
|
+
}
|
|
1771
|
+
let didExecuteServerAction = false;
|
|
1772
|
+
let formState = null;
|
|
1773
|
+
if (isPossibleActionRequest) {
|
|
1774
|
+
// For action requests, we handle them differently with a special render result.
|
|
1775
|
+
const actionRequestResult = await (0, _actionhandler.handleAction)({
|
|
1776
|
+
req,
|
|
1777
|
+
res,
|
|
1778
|
+
ComponentMod,
|
|
1779
|
+
generateFlight: generateDynamicFlightRenderResult,
|
|
1780
|
+
workStore,
|
|
1781
|
+
requestStore,
|
|
1782
|
+
serverActions,
|
|
1783
|
+
ctx,
|
|
1784
|
+
metadata
|
|
1785
|
+
});
|
|
1786
|
+
if (actionRequestResult) {
|
|
1787
|
+
if (actionRequestResult.type === 'not-found') {
|
|
1788
|
+
const notFoundLoaderTree = createNotFoundLoaderTree(loaderTree);
|
|
1789
|
+
res.statusCode = 404;
|
|
1790
|
+
metadata.statusCode = 404;
|
|
1791
|
+
const tracker = initializeClientComponentLoadTracking(renderOpts, workStore);
|
|
1792
|
+
metadata.clientComponentLoadTracker = tracker;
|
|
1793
|
+
try {
|
|
1794
|
+
const stream = await renderToStream(requestStore, res, ctx, notFoundLoaderTree, formState, postponedState, metadata, undefined, stagedFallbackParams, tracker);
|
|
1741
1795
|
return new _renderresult.default(stream, {
|
|
1742
1796
|
metadata,
|
|
1743
|
-
contentType:
|
|
1797
|
+
contentType: _constants2.HTML_CONTENT_TYPE_HEADER
|
|
1744
1798
|
});
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1799
|
+
} catch (renderError) {
|
|
1800
|
+
// Failed setup may never reach the SSR readiness callback.
|
|
1801
|
+
tracker == null ? void 0 : tracker.finish();
|
|
1802
|
+
throw renderError;
|
|
1803
|
+
}
|
|
1804
|
+
} else if (actionRequestResult.type === 'done') {
|
|
1805
|
+
if (actionRequestResult.result) {
|
|
1806
|
+
actionRequestResult.result.assignMetadata(metadata);
|
|
1807
|
+
return actionRequestResult.result;
|
|
1808
|
+
} else if (actionRequestResult.formState) {
|
|
1809
|
+
formState = actionRequestResult.formState;
|
|
1752
1810
|
}
|
|
1753
1811
|
}
|
|
1754
|
-
didExecuteServerAction = true;
|
|
1755
1812
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1813
|
+
didExecuteServerAction = true;
|
|
1814
|
+
}
|
|
1815
|
+
const options = {
|
|
1816
|
+
metadata,
|
|
1817
|
+
contentType: _constants2.HTML_CONTENT_TYPE_HEADER
|
|
1818
|
+
};
|
|
1819
|
+
const tracker = initializeClientComponentLoadTracking(renderOpts, workStore);
|
|
1820
|
+
metadata.clientComponentLoadTracker = tracker;
|
|
1821
|
+
try {
|
|
1760
1822
|
const stream = await renderToStream(// NOTE: in Cache Components (dev), if the render is restarted, it will use a different requestStore
|
|
1761
1823
|
// than the one that we're passing in here.
|
|
1762
|
-
requestStore,
|
|
1824
|
+
requestStore, res, ctx, loaderTree, formState, postponedState, metadata, // If we're rendering HTML after an action, we don't want restartable-render behavior
|
|
1763
1825
|
// because the result should be dynamic, like it is in prod.
|
|
1764
1826
|
// Also, the request store might have been mutated by the action (e.g. enabling draftMode)
|
|
1765
1827
|
// and we currently we don't copy changes over when creating a new store,
|
|
1766
1828
|
// so the restarted render wouldn't be correct.
|
|
1767
|
-
didExecuteServerAction ? undefined : createRequestStore,
|
|
1829
|
+
didExecuteServerAction ? undefined : createRequestStore, stagedFallbackParams, tracker);
|
|
1768
1830
|
// Forward an invalid-dynamic-usage error recorded by `'use cache'` only
|
|
1769
1831
|
// when userland caught it (try/catch around the cache call). If userland
|
|
1770
1832
|
// didn't catch, the rejection propagated into the React render, and React's
|
|
@@ -1796,50 +1858,80 @@ async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOp
|
|
|
1796
1858
|
}
|
|
1797
1859
|
}
|
|
1798
1860
|
// Create the new render result for the response.
|
|
1799
|
-
|
|
1861
|
+
const result = new _renderresult.default(stream, options);
|
|
1862
|
+
if (setDevIsrStatus && process.env.NEXT_RUNTIME !== 'edge') {
|
|
1863
|
+
result.pipeThrough(new TransformStream({
|
|
1864
|
+
flush () {
|
|
1865
|
+
setDevIsrStatus(url.pathname, !requestStore.usedDynamic && !workStore.forceDynamic);
|
|
1866
|
+
}
|
|
1867
|
+
}));
|
|
1868
|
+
}
|
|
1869
|
+
return result;
|
|
1870
|
+
} catch (renderError) {
|
|
1871
|
+
// Returning a stream may precede SSR readiness, which finishes success.
|
|
1872
|
+
// Only failures finish here; a finally would seal successful renders early.
|
|
1873
|
+
tracker == null ? void 0 : tracker.finish();
|
|
1874
|
+
throw renderError;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
async function renderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOpts, workStore, parsedRequestHeaders, postponedState, dev, sharedContext, interpolatedParams, fallbackRouteParams, routeMatch) {
|
|
1878
|
+
if (renderOpts.ComponentMod.__next_app__) {
|
|
1879
|
+
installGlobalModuleLoadingHandlers(renderOpts.ComponentMod, renderOpts.cacheComponents);
|
|
1800
1880
|
}
|
|
1881
|
+
const prepared = await prepareAppPageRender(req, res, url, pagePath, query, renderOpts, workStore, parsedRequestHeaders, sharedContext, interpolatedParams, fallbackRouteParams, routeMatch, generateRenderRequestId, (0, _createtransporttreefromloadertree.getMissingPrefetchHintPolicy)(renderOpts.isBuildTimePrerendering ?? false, false, renderOpts.cacheComponents), {
|
|
1882
|
+
isPossiblyPartialResponse: false,
|
|
1883
|
+
supportsPerSegmentPrefetching: renderOpts.cacheComponents
|
|
1884
|
+
});
|
|
1885
|
+
return renderAppPage(prepared, postponedState, dev);
|
|
1801
1886
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1887
|
+
async function prerenderToHTMLOrFlightImpl(req, res, url, pagePath, query, renderOpts, workStore, parsedRequestHeaders, sharedContext, interpolatedParams, fallbackRouteParams, routeMatch) {
|
|
1888
|
+
if (renderOpts.ComponentMod.__next_app__) {
|
|
1889
|
+
installGlobalModuleLoadingHandlers(renderOpts.ComponentMod, renderOpts.cacheComponents);
|
|
1890
|
+
}
|
|
1891
|
+
const isRoutePPREnabled = renderOpts.experimental.isRoutePPREnabled === true;
|
|
1892
|
+
const prepared = await prepareAppPageRender(req, res, url, pagePath, query, renderOpts, workStore, parsedRequestHeaders, sharedContext, interpolatedParams, fallbackRouteParams, routeMatch, generatePrerenderRequestId, (0, _createtransporttreefromloadertree.getMissingPrefetchHintPolicy)(renderOpts.isBuildTimePrerendering ?? false, true, renderOpts.cacheComponents), {
|
|
1893
|
+
isPossiblyPartialResponse: isRoutePPREnabled,
|
|
1894
|
+
supportsPerSegmentPrefetching: true
|
|
1895
|
+
});
|
|
1896
|
+
return prerenderAppPage(prepared);
|
|
1897
|
+
}
|
|
1898
|
+
function prepareAppPage(req, pagePath, fallbackRouteParams, renderOpts) {
|
|
1804
1899
|
if (!req.url) {
|
|
1805
|
-
throw
|
|
1806
|
-
value: "E182",
|
|
1807
|
-
enumerable: false,
|
|
1808
|
-
configurable: true
|
|
1809
|
-
});
|
|
1900
|
+
throw new Error('Invalid URL');
|
|
1810
1901
|
}
|
|
1811
1902
|
const url = (0, _parserelativeurl.parseRelativeUrl)(req.url, undefined, false);
|
|
1812
|
-
|
|
1813
|
-
// base-server will strip them to opt into different rendering behavior.
|
|
1814
|
-
const parsedRequestHeaders = parseRequestHeaders(req.headers, {
|
|
1815
|
-
isRoutePPREnabled: renderOpts.experimental.isRoutePPREnabled === true,
|
|
1816
|
-
previewModeId: (_renderOpts_previewProps = renderOpts.previewProps) == null ? void 0 : _renderOpts_previewProps.previewModeId
|
|
1817
|
-
});
|
|
1818
|
-
const { isPrefetchRequest, previouslyRevalidatedTags, nonce } = parsedRequestHeaders;
|
|
1819
|
-
let interpolatedParams;
|
|
1820
|
-
let postponedState = null;
|
|
1903
|
+
const interpolatedParams = (0, _getdynamicparam.interpolateParallelRouteParams)(renderOpts.ComponentMod.routeModule.userland.loaderTree, renderOpts.params ?? {}, pagePath, fallbackRouteParams);
|
|
1821
1904
|
// If provided, the postpone state should be parsed so it can be provided to
|
|
1822
1905
|
// React.
|
|
1906
|
+
let postponedState = null;
|
|
1823
1907
|
if (typeof renderOpts.postponed === 'string') {
|
|
1824
1908
|
if (fallbackRouteParams) {
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1909
|
+
if (!(0, _serveractionrequestmeta.getServerActionRequestMetadata)(req).isFetchAction) {
|
|
1910
|
+
throw new _invarianterror.InvariantError('postponed state should not be provided when fallback params are provided');
|
|
1911
|
+
}
|
|
1912
|
+
// A fetch action with fallback params cannot render this page, so its
|
|
1913
|
+
// React postponed state cannot be resumed. The RDC is still useful while
|
|
1914
|
+
// executing cached functions in the action.
|
|
1915
|
+
postponedState = {
|
|
1916
|
+
type: _postponedstate.DynamicState.DATA,
|
|
1917
|
+
renderResumeDataCache: (0, _postponedstate.parseResumeDataCacheFromPostponedState)(renderOpts.postponed, renderOpts.experimental.maxPostponedStateSizeBytes, renderOpts.experimental.disableResumeDataCacheCompression)
|
|
1918
|
+
};
|
|
1919
|
+
} else {
|
|
1920
|
+
postponedState = (0, _postponedstate.parsePostponedState)(renderOpts.postponed, renderOpts.experimental.maxPostponedStateSizeBytes, renderOpts.experimental.disableResumeDataCacheCompression);
|
|
1830
1921
|
}
|
|
1831
|
-
interpolatedParams = (0, _getdynamicparam.interpolateParallelRouteParams)(renderOpts.ComponentMod.routeModule.userland.loaderTree, renderOpts.params ?? {}, pagePath, fallbackRouteParams);
|
|
1832
|
-
postponedState = (0, _postponedstate.parsePostponedState)(renderOpts.postponed, interpolatedParams, renderOpts.experimental.maxPostponedStateSizeBytes);
|
|
1833
|
-
} else {
|
|
1834
|
-
interpolatedParams = (0, _getdynamicparam.interpolateParallelRouteParams)(renderOpts.ComponentMod.routeModule.userland.loaderTree, renderOpts.params ?? {}, pagePath, fallbackRouteParams);
|
|
1835
1922
|
}
|
|
1836
1923
|
if ((postponedState == null ? void 0 : postponedState.renderResumeDataCache) && renderOpts.renderResumeDataCache) {
|
|
1837
|
-
throw
|
|
1838
|
-
value: "E589",
|
|
1839
|
-
enumerable: false,
|
|
1840
|
-
configurable: true
|
|
1841
|
-
});
|
|
1924
|
+
throw new _invarianterror.InvariantError('postponed state and dev warmup immutable resume data cache should not be provided together');
|
|
1842
1925
|
}
|
|
1926
|
+
return {
|
|
1927
|
+
url,
|
|
1928
|
+
interpolatedParams,
|
|
1929
|
+
postponedState
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
const renderToHTMLOrFlight = (req, res, pagePath, query, fallbackRouteParams, renderOpts, dev, sharedContext, routeMatch, parsedRequestHeaders)=>{
|
|
1933
|
+
const { url, interpolatedParams, postponedState } = prepareAppPage(req, pagePath, fallbackRouteParams, renderOpts);
|
|
1934
|
+
const { isPrefetchRequest, previouslyRevalidatedTags, nonce } = parsedRequestHeaders;
|
|
1843
1935
|
const workStore = (0, _workstore.createWorkStore)({
|
|
1844
1936
|
page: renderOpts.routeModule.definition.page,
|
|
1845
1937
|
renderOpts,
|
|
@@ -1850,9 +1942,22 @@ const renderToHTMLOrFlight = (req, res, pagePath, query, fallbackRouteParams, re
|
|
|
1850
1942
|
previouslyRevalidatedTags,
|
|
1851
1943
|
nonce
|
|
1852
1944
|
});
|
|
1853
|
-
return _workasyncstorageexternal.workAsyncStorage.run(workStore,
|
|
1854
|
-
|
|
1855
|
-
|
|
1945
|
+
return _workasyncstorageexternal.workAsyncStorage.run(workStore, renderToHTMLOrFlightImpl, req, res, url, pagePath, query, renderOpts, workStore, parsedRequestHeaders, postponedState, dev, sharedContext, interpolatedParams, fallbackRouteParams, routeMatch);
|
|
1946
|
+
};
|
|
1947
|
+
const prerenderToHTMLOrFlight = (req, res, pagePath, query, fallbackRouteParams, renderOpts, _dev, sharedContext, routeMatch, parsedRequestHeaders)=>{
|
|
1948
|
+
const { url, interpolatedParams } = prepareAppPage(req, pagePath, fallbackRouteParams, renderOpts);
|
|
1949
|
+
const { isPrefetchRequest, previouslyRevalidatedTags, nonce } = parsedRequestHeaders;
|
|
1950
|
+
const workStore = (0, _workstore.createPrerenderWorkStore)({
|
|
1951
|
+
page: renderOpts.routeModule.definition.page,
|
|
1952
|
+
renderOpts,
|
|
1953
|
+
// @TODO move to workUnitStore of type Request
|
|
1954
|
+
isPrefetchRequest,
|
|
1955
|
+
buildId: sharedContext.buildId,
|
|
1956
|
+
deploymentId: sharedContext.deploymentId,
|
|
1957
|
+
previouslyRevalidatedTags,
|
|
1958
|
+
nonce
|
|
1959
|
+
});
|
|
1960
|
+
return _workasyncstorageexternal.workAsyncStorage.run(workStore, prerenderToHTMLOrFlightImpl, req, res, url, pagePath, query, renderOpts, workStore, parsedRequestHeaders, sharedContext, interpolatedParams, fallbackRouteParams, routeMatch);
|
|
1856
1961
|
};
|
|
1857
1962
|
function applyMetadataFromPrerenderResult(response, metadata, workStore) {
|
|
1858
1963
|
if (response.collectedTags) {
|
|
@@ -1872,8 +1977,8 @@ function applyMetadataFromPrerenderResult(response, metadata, workStore) {
|
|
|
1872
1977
|
} else {
|
|
1873
1978
|
// Copy the cache control value onto the render result metadata.
|
|
1874
1979
|
metadata.cacheControl = {
|
|
1875
|
-
revalidate: response.collectedRevalidate >=
|
|
1876
|
-
expire: response.collectedExpire >=
|
|
1980
|
+
revalidate: response.collectedRevalidate >= _constants2.INFINITE_CACHE ? false : response.collectedRevalidate,
|
|
1981
|
+
expire: response.collectedExpire >= _constants2.INFINITE_CACHE ? undefined : response.collectedExpire
|
|
1877
1982
|
};
|
|
1878
1983
|
}
|
|
1879
1984
|
// provide bailout info for debugging
|
|
@@ -1884,11 +1989,12 @@ function applyMetadataFromPrerenderResult(response, metadata, workStore) {
|
|
|
1884
1989
|
};
|
|
1885
1990
|
}
|
|
1886
1991
|
}
|
|
1887
|
-
async function renderToStream(requestStore,
|
|
1992
|
+
async function renderToStream(requestStore, res, ctx, tree, formState, postponedState, metadata, createRequestStore, stagedFallbackParams, tracker) {
|
|
1888
1993
|
/* eslint-disable @next/internal/no-ambiguous-jsx -- React Client */ // MARK: renderToStream setup
|
|
1889
1994
|
const { assetPrefix, htmlRequestId, nonce, pagePath, renderOpts, requestId, workStore } = ctx;
|
|
1890
1995
|
const { basePath, buildManifest, ComponentMod: { createElement }, crossOrigin, experimental, isBuildTimePrerendering = false, onInstrumentationRequestError, page, reactMaxHeadersLength, setReactDebugChannel, subresourceIntegrityManifest, supportsDynamicResponse, cacheComponents } = renderOpts;
|
|
1891
1996
|
const { cachedNavigations } = renderOpts.experimental;
|
|
1997
|
+
const waitForAllReady = supportsDynamicResponse !== true;
|
|
1892
1998
|
const { ServerInsertedHTMLProvider, renderServerInsertedHTML } = (0, _serverinsertedhtml.createServerInsertedHTML)();
|
|
1893
1999
|
const getServerInsertedMetadata = (0, _createserverinsertedmetadata.createServerInsertedMetadata)(nonce);
|
|
1894
2000
|
const tracingMetadata = (0, _utils1.getTracedMetadata)((0, _tracer.getTracer)().getTracePropagationData(), experimental.clientTraceMetadata);
|
|
@@ -1928,10 +2034,14 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
1928
2034
|
const renderSpan = (0, _tracer.getTracer)().startSpan(`render route (app) ${pagePath}`, {
|
|
1929
2035
|
attributes: {
|
|
1930
2036
|
'next.span_name': `render route (app) ${pagePath}`,
|
|
1931
|
-
'next.span_type':
|
|
2037
|
+
'next.span_type': _constants1.AppRenderSpan.getBodyResult,
|
|
1932
2038
|
'next.route': pagePath
|
|
1933
2039
|
}
|
|
1934
2040
|
});
|
|
2041
|
+
const finishHtmlRender = ()=>{
|
|
2042
|
+
if (renderSpan.isRecording()) renderSpan.end();
|
|
2043
|
+
tracker == null ? void 0 : tracker.finish();
|
|
2044
|
+
};
|
|
1935
2045
|
// Helper to end the span with error status (used when throwing from catch blocks)
|
|
1936
2046
|
const endSpanWithError = (err)=>{
|
|
1937
2047
|
if (!renderSpan.isRecording()) return;
|
|
@@ -1954,17 +2064,17 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
1954
2064
|
let didErrorObservably = false;
|
|
1955
2065
|
function onHTMLRenderRSCError(err, silenceLog) {
|
|
1956
2066
|
didErrorObservably = true;
|
|
1957
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
2067
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, createRequestErrorContext(ctx, 'react-server-components'), silenceLog);
|
|
1958
2068
|
}
|
|
1959
2069
|
const serverComponentsErrorHandler = (0, _createerrorhandler.createReactServerErrorHandler)(process.env.NODE_ENV === 'development', isBuildTimePrerendering, reactServerErrorsByDigest, onHTMLRenderRSCError, renderSpan);
|
|
1960
2070
|
function onHTMLRenderSSRError(err) {
|
|
1961
2071
|
// We don't need to silence logs here. onHTMLRenderSSRError won't be called
|
|
1962
2072
|
// at all if the error was logged before in the RSC error handler.
|
|
1963
2073
|
const silenceLog = false;
|
|
1964
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
2074
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, createRequestErrorContext(ctx, 'server-rendering'), silenceLog);
|
|
1965
2075
|
}
|
|
1966
2076
|
const allCapturedErrors = [];
|
|
1967
|
-
const htmlRendererErrorHandler = (0, _createerrorhandler.createHTMLErrorHandler)(process.env.NODE_ENV === 'development', isBuildTimePrerendering, reactServerErrorsByDigest, allCapturedErrors, onHTMLRenderSSRError, renderSpan);
|
|
2077
|
+
const htmlRendererErrorHandler = (0, _createerrorhandler.createHTMLErrorHandler)(process.env.NODE_ENV === 'development', isBuildTimePrerendering, ctx.renderOpts.experimental.reactBrowserBailout, reactServerErrorsByDigest, allCapturedErrors, onHTMLRenderSSRError, renderSpan);
|
|
1968
2078
|
let reactServerResult = null;
|
|
1969
2079
|
let reactDebugStream;
|
|
1970
2080
|
const setHeader = res.setHeader.bind(res);
|
|
@@ -1974,11 +2084,16 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
1974
2084
|
if (process.env.__NEXT_DEV_SERVER && // Edge routes never prerender so we don't have a Prerender environment for anything in edge runtime
|
|
1975
2085
|
process.env.NEXT_RUNTIME !== 'edge' && // We only have a Prerender environment for projects opted into cacheComponents
|
|
1976
2086
|
cacheComponents) {
|
|
2087
|
+
const prefetchMode = await getPrefetchingModeForPage(renderOpts, tree);
|
|
2088
|
+
// We currently don't need the `ensureStatic` level here, but
|
|
2089
|
+
// we want to validate that it's correct.
|
|
2090
|
+
await (0, _ensurestatic.resolveEnsureStaticLevel)(tree, /* partialPrefetching */ prefetchMode === 2);
|
|
1977
2091
|
let debugChannelClientStream;
|
|
1978
2092
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
1979
2093
|
const getPayload = async (requestStore)=>{
|
|
1980
2094
|
const payload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, getRSCPayload, tree, ctx, {
|
|
1981
|
-
is404: res.statusCode === 404
|
|
2095
|
+
is404: res.statusCode === 404,
|
|
2096
|
+
isPrerendering: false
|
|
1982
2097
|
});
|
|
1983
2098
|
if (isBypassingCachesInDev(requestStore, workStore)) {
|
|
1984
2099
|
// Mark the RSC payload to indicate that caches were bypassed in dev.
|
|
@@ -1999,8 +2114,6 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
1999
2114
|
// "disable cache" in devtools, a hard refresh (cache-control: "no-cache"),
|
|
2000
2115
|
// or draft mode.
|
|
2001
2116
|
!isBypassingCachesInDev(requestStore, workStore)) {
|
|
2002
|
-
const loaderTree = ctx.componentMod.routeModule.userland.loaderTree;
|
|
2003
|
-
const prefetchMode = await getPrefetchingModeForPage(renderOpts, loaderTree);
|
|
2004
2117
|
const { stream: serverStream, debugChannel: returnedDebugChannel } = await stagedRenderWithCachesInDev({
|
|
2005
2118
|
prefetchMode,
|
|
2006
2119
|
ctx,
|
|
@@ -2009,7 +2122,7 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2009
2122
|
getPayload,
|
|
2010
2123
|
onError: serverComponentsErrorHandler,
|
|
2011
2124
|
shouldValidate: true,
|
|
2012
|
-
fallbackRouteParams:
|
|
2125
|
+
fallbackRouteParams: stagedFallbackParams,
|
|
2013
2126
|
getDevRenderDidError: ()=>didErrorObservably,
|
|
2014
2127
|
// An initial HTML load serves the static shell; runtime and
|
|
2015
2128
|
// dynamic content stream in afterward.
|
|
@@ -2051,16 +2164,16 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2051
2164
|
// hydration.
|
|
2052
2165
|
const selectStaleTime = (0, _staletime.createSelectStaleTime)(experimental);
|
|
2053
2166
|
const staleTimeIterable = new _staletime.StaleTimeIterable();
|
|
2167
|
+
const prefetchMode = await getPrefetchingModeForPage(renderOpts, tree);
|
|
2054
2168
|
const stageController = new _stagedrendering.StagedRenderingController({
|
|
2055
2169
|
abortSignal: null,
|
|
2056
2170
|
abandonController: null,
|
|
2057
|
-
//
|
|
2058
|
-
//
|
|
2059
|
-
|
|
2060
|
-
syncIO: _stagedrendering.SyncIOMode.Untracked,
|
|
2171
|
+
// Synchronous request-time data ends the static stage before its
|
|
2172
|
+
// result can enter the Cached Navigation.
|
|
2173
|
+
syncIO: getSyncIOMode(prefetchMode),
|
|
2061
2174
|
finalStage: null
|
|
2062
2175
|
});
|
|
2063
|
-
requestStore.stale =
|
|
2176
|
+
requestStore.stale = _constants2.INFINITE_CACHE;
|
|
2064
2177
|
requestStore.stagedRendering = stageController;
|
|
2065
2178
|
requestStore.asyncApiPromises = createAsyncApiPromises(stageController, requestStore.cookies, requestStore.mutableCookies, requestStore.headers);
|
|
2066
2179
|
requestStore.varyParamsAccumulator = (0, _varyparams.createResponseVaryParamsAccumulator)();
|
|
@@ -2068,31 +2181,41 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2068
2181
|
const shellByteLengthDeferred = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
2069
2182
|
const staticStageByteLengthDeferred = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
2070
2183
|
let runtimePrefetchStream;
|
|
2184
|
+
let startRuntimePrefetchRender;
|
|
2185
|
+
// Partial prefetching waits for cacheReady() before starting an
|
|
2186
|
+
// embedded runtime prefetch. Track React's native immediates so that
|
|
2187
|
+
// this wait includes Flight work that can discover more cache reads.
|
|
2188
|
+
// Other prefetch modes do not wait for cacheReady() here.
|
|
2189
|
+
const immediateTracker = prefetchMode === 2 ? new _fastsetimmediateexternal.ImmediateTracker() : null;
|
|
2071
2190
|
// If the route should runtime-cache its navigation, spawn a runtime
|
|
2072
2191
|
// prerender after the resume render fills caches. The result is
|
|
2073
2192
|
// embedded in the initial RSC payload so the client can cache
|
|
2074
|
-
// runtime-prefetchable content during hydration. This is enabled
|
|
2075
|
-
// Partial Prefetching
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
const prerenderResumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)();
|
|
2193
|
+
// runtime-prefetchable content during hydration. This is enabled for
|
|
2194
|
+
// Partial Prefetching routes.
|
|
2195
|
+
if (prefetchMode === 2) {
|
|
2196
|
+
const prerenderResumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)(// Prefill the mutable cache from the RDC if available.
|
|
2197
|
+
requestStore.resumeDataCache ?? undefined);
|
|
2080
2198
|
requestStore.resumeDataCache = prerenderResumeDataCache;
|
|
2081
|
-
const cacheSignal = new _cachesignal.CacheSignal();
|
|
2199
|
+
const cacheSignal = new _cachesignal.CacheSignal(immediateTracker);
|
|
2082
2200
|
(0, _trackmoduleloadingexternal.trackPendingModules)(cacheSignal);
|
|
2083
2201
|
requestStore.cacheSignal = cacheSignal;
|
|
2084
2202
|
const runtimePrefetchTransform = new TransformStream();
|
|
2085
2203
|
runtimePrefetchStream = runtimePrefetchTransform.readable;
|
|
2086
|
-
|
|
2204
|
+
startRuntimePrefetchRender = async ()=>{
|
|
2205
|
+
await cacheSignal.cacheReady();
|
|
2206
|
+
return spawnRuntimePrefetchWithFilledCaches(runtimePrefetchTransform.writable, ctx, prerenderResumeDataCache, requestStore, serverComponentsErrorHandler);
|
|
2207
|
+
};
|
|
2087
2208
|
}
|
|
2088
|
-
const RSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, getRSCPayload, tree, ctx, {
|
|
2209
|
+
const RSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, immediateTracker === null ? getRSCPayload : _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, getRSCPayload), tree, ctx, {
|
|
2089
2210
|
is404: res.statusCode === 404,
|
|
2211
|
+
isPrerendering: false,
|
|
2090
2212
|
staleTimeIterable,
|
|
2091
2213
|
shellByteLengthPromise: shellByteLengthDeferred.promise,
|
|
2092
2214
|
staticStageByteLengthPromise: staticStageByteLengthDeferred.promise,
|
|
2093
2215
|
runtimePrefetchStream
|
|
2094
2216
|
});
|
|
2095
|
-
const
|
|
2217
|
+
const runRenderTasks = immediateTracker === null ? _apprenderrenderutils.runInSequentialTasks : _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, _apprenderrenderutils.runInSequentialTasks);
|
|
2218
|
+
const flightStream = await runRenderTasks(()=>{
|
|
2096
2219
|
stageController.advanceStage(_stagedrendering.RenderStage.ShellStatic);
|
|
2097
2220
|
const stream = _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.renderToNodeFlightStream, ctx.componentMod, RSCPayload, clientModules, {
|
|
2098
2221
|
onError: serverComponentsErrorHandler,
|
|
@@ -2106,9 +2229,8 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2106
2229
|
shellByteLengthDeferred.resolve(byteLengths[_stagedrendering.RenderStage.ShellStatic]);
|
|
2107
2230
|
});
|
|
2108
2231
|
return dynamicStream;
|
|
2109
|
-
},
|
|
2110
|
-
|
|
2111
|
-
}, ()=>{
|
|
2232
|
+
}, // Fold `PrefetchStatic_prefetchApi` into `PrefetchStatic` - no discrimination needed here
|
|
2233
|
+
()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>{
|
|
2112
2234
|
// This is a separate task that doesn't advance a stage. It forces
|
|
2113
2235
|
// draining the immediate queue so that the stale time iterable and vary
|
|
2114
2236
|
// params accumulators are flushed before we advance to the dynamic stage.
|
|
@@ -2116,16 +2238,16 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2116
2238
|
if (requestStore.varyParamsAccumulator) {
|
|
2117
2239
|
(0, _varyparams.finishAccumulatingVaryParams)(requestStore.varyParamsAccumulator);
|
|
2118
2240
|
}
|
|
2119
|
-
}, ()=>
|
|
2120
|
-
|
|
2121
|
-
});
|
|
2241
|
+
}, ()=>stageController.advanceStage(_stagedrendering.RenderStage.Dynamic));
|
|
2242
|
+
void (startRuntimePrefetchRender == null ? void 0 : startRuntimePrefetchRender());
|
|
2122
2243
|
reactServerResult = new _apprenderprerenderutils.ReactServerResult(flightStream);
|
|
2123
2244
|
} else {
|
|
2124
2245
|
// MARK: nodeStreams RSC
|
|
2125
2246
|
if (process.env.__NEXT_USE_NODE_STREAMS) {
|
|
2126
2247
|
// This is a dynamic render. We don't do dynamic tracking because we're not prerendering
|
|
2127
2248
|
const RSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, getRSCPayload, tree, ctx, {
|
|
2128
|
-
is404: res.statusCode === 404
|
|
2249
|
+
is404: res.statusCode === 404,
|
|
2250
|
+
isPrerendering: false
|
|
2129
2251
|
});
|
|
2130
2252
|
const debugChannel = setReactDebugChannel && (0, _debugchannelserver.createNodeDebugChannel)();
|
|
2131
2253
|
if (debugChannel) {
|
|
@@ -2144,7 +2266,8 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2144
2266
|
// MARK: webStreams RSC
|
|
2145
2267
|
// This is a dynamic render. We don't do dynamic tracking because we're not prerendering
|
|
2146
2268
|
const RSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, getRSCPayload, tree, ctx, {
|
|
2147
|
-
is404: res.statusCode === 404
|
|
2269
|
+
is404: res.statusCode === 404,
|
|
2270
|
+
isPrerendering: false
|
|
2148
2271
|
});
|
|
2149
2272
|
const debugChannel = setReactDebugChannel && (0, _debugchannelserver.createWebDebugChannel)();
|
|
2150
2273
|
if (debugChannel) {
|
|
@@ -2175,8 +2298,8 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2175
2298
|
// still include the new server component render because it was not included
|
|
2176
2299
|
// in the static prelude.
|
|
2177
2300
|
const inlinedDataStream = (0, _streamops.createNodeInlinedDataStream)(reactServerResult.tee(), nonce, formState);
|
|
2178
|
-
//
|
|
2179
|
-
|
|
2301
|
+
// There's no async HTML rendering in this path.
|
|
2302
|
+
finishHtmlRender();
|
|
2180
2303
|
return (0, _streamops.chainStreams)(inlinedDataStream, (0, _streamops.createDocumentClosingStream)());
|
|
2181
2304
|
} else if (postponedState) {
|
|
2182
2305
|
// We assume we have dynamic HTML requiring a resume render to complete
|
|
@@ -2197,14 +2320,11 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2197
2320
|
basePath,
|
|
2198
2321
|
tracingMetadata: tracingMetadata
|
|
2199
2322
|
});
|
|
2200
|
-
const { stream: htmlStream
|
|
2323
|
+
const { stream: htmlStream } = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.resumeToFizzStream, resumeAppElement, postponed, {
|
|
2201
2324
|
onError: htmlRendererErrorHandler,
|
|
2325
|
+
onAllReady: finishHtmlRender,
|
|
2202
2326
|
nonce
|
|
2203
2327
|
});
|
|
2204
|
-
// End the render span only after React completed rendering (including anything inside Suspense boundaries)
|
|
2205
|
-
allReady.finally(()=>{
|
|
2206
|
-
if (renderSpan.isRecording()) renderSpan.end();
|
|
2207
|
-
});
|
|
2208
2328
|
return await (0, _streamops.continueDynamicHTMLResumeNode)(htmlStream, {
|
|
2209
2329
|
delayDataUntilFirstHtmlChunk: preludeState === _postponedstate.DynamicHTMLPreludeState.Empty,
|
|
2210
2330
|
inlinedDataStream: (0, _streamops.createNodeInlinedDataStream)(reactServerResult.consume(), nonce, formState),
|
|
@@ -2222,7 +2342,6 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2222
2342
|
basePath,
|
|
2223
2343
|
tracingMetadata: tracingMetadata
|
|
2224
2344
|
});
|
|
2225
|
-
const generateStaticHTML = supportsDynamicResponse !== true;
|
|
2226
2345
|
const appElement = /*#__PURE__*/ (0, _jsxruntime.jsx)(App, {
|
|
2227
2346
|
reactServerStream: reactServerResult.tee(),
|
|
2228
2347
|
// TODO: Pass Node.js debugStream
|
|
@@ -2235,6 +2354,7 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2235
2354
|
});
|
|
2236
2355
|
const fizzOptions = {
|
|
2237
2356
|
onError: htmlRendererErrorHandler,
|
|
2357
|
+
onAllReady: finishHtmlRender,
|
|
2238
2358
|
nonce,
|
|
2239
2359
|
onHeaders: (headers)=>{
|
|
2240
2360
|
for(const key in headers){
|
|
@@ -2248,16 +2368,12 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2248
2368
|
],
|
|
2249
2369
|
formState
|
|
2250
2370
|
};
|
|
2251
|
-
const { stream: htmlStream, allReady } = await (0, _tracer.getTracer)().trace(
|
|
2252
|
-
waitForAllReady
|
|
2371
|
+
const { stream: htmlStream, allReady } = await (0, _tracer.getTracer)().trace(_constants1.AppRenderSpan.renderToNodeFizzStream, ()=>_workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.renderToNodeFizzStream, appElement, fizzOptions, {
|
|
2372
|
+
waitForAllReady
|
|
2253
2373
|
}));
|
|
2254
|
-
// End the render span only after React completed rendering (including anything inside Suspense boundaries)
|
|
2255
|
-
allReady.finally(()=>{
|
|
2256
|
-
if (renderSpan.isRecording()) renderSpan.end();
|
|
2257
|
-
});
|
|
2258
2374
|
return await (0, _streamops.continueFizzStream)(htmlStream, {
|
|
2259
2375
|
inlinedDataStream: (0, _streamops.createNodeInlinedDataStream)(reactServerResult.consume(), nonce, formState),
|
|
2260
|
-
|
|
2376
|
+
waitForAllReady,
|
|
2261
2377
|
allReady,
|
|
2262
2378
|
deploymentId: ctx.sharedContext.deploymentId,
|
|
2263
2379
|
getServerInsertedHTML,
|
|
@@ -2274,8 +2390,8 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2274
2390
|
// still include the new server component render because it was not included
|
|
2275
2391
|
// in the static prelude.
|
|
2276
2392
|
const inlinedDataStream = (0, _streamops.createWebInlinedDataStream)(reactServerResult.tee(), nonce, formState);
|
|
2277
|
-
//
|
|
2278
|
-
|
|
2393
|
+
// There's no async HTML rendering in this path.
|
|
2394
|
+
finishHtmlRender();
|
|
2279
2395
|
return (0, _streamops.chainStreams)(inlinedDataStream, (0, _streamops.createDocumentClosingStream)());
|
|
2280
2396
|
} else if (postponedState) {
|
|
2281
2397
|
// We assume we have dynamic HTML requiring a resume render to complete
|
|
@@ -2300,10 +2416,8 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2300
2416
|
onError: htmlRendererErrorHandler,
|
|
2301
2417
|
nonce
|
|
2302
2418
|
});
|
|
2303
|
-
//
|
|
2304
|
-
allReady.
|
|
2305
|
-
if (renderSpan.isRecording()) renderSpan.end();
|
|
2306
|
-
});
|
|
2419
|
+
// Finish after React renders everything inside Suspense boundaries.
|
|
2420
|
+
void allReady.then(finishHtmlRender, finishHtmlRender);
|
|
2307
2421
|
return await (0, _streamops.continueDynamicHTMLResumeWeb)(htmlStream, {
|
|
2308
2422
|
delayDataUntilFirstHtmlChunk: preludeState === _postponedstate.DynamicHTMLPreludeState.Empty,
|
|
2309
2423
|
inlinedDataStream: (0, _streamops.createWebInlinedDataStream)(reactServerResult.consume(), nonce, formState),
|
|
@@ -2321,7 +2435,6 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2321
2435
|
basePath,
|
|
2322
2436
|
tracingMetadata: tracingMetadata
|
|
2323
2437
|
});
|
|
2324
|
-
const generateStaticHTML = supportsDynamicResponse !== true;
|
|
2325
2438
|
const appElement = /*#__PURE__*/ (0, _jsxruntime.jsx)(App, {
|
|
2326
2439
|
reactServerStream: reactServerResult.tee(),
|
|
2327
2440
|
reactDebugStream: reactDebugStream,
|
|
@@ -2347,13 +2460,11 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2347
2460
|
formState
|
|
2348
2461
|
};
|
|
2349
2462
|
const { stream: htmlStream, allReady } = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.renderToWebFizzStream, appElement, fizzOptions);
|
|
2350
|
-
//
|
|
2351
|
-
allReady.
|
|
2352
|
-
if (renderSpan.isRecording()) renderSpan.end();
|
|
2353
|
-
});
|
|
2463
|
+
// Finish after React renders everything inside Suspense boundaries.
|
|
2464
|
+
void allReady.then(finishHtmlRender, finishHtmlRender);
|
|
2354
2465
|
return await (0, _streamops.continueFizzStream)(htmlStream, {
|
|
2355
2466
|
inlinedDataStream: (0, _streamops.createWebInlinedDataStream)(reactServerResult.consume(), nonce, formState),
|
|
2356
|
-
|
|
2467
|
+
waitForAllReady,
|
|
2357
2468
|
allReady,
|
|
2358
2469
|
deploymentId: ctx.sharedContext.deploymentId,
|
|
2359
2470
|
getServerInsertedHTML,
|
|
@@ -2428,8 +2539,7 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2428
2539
|
throw setupErr;
|
|
2429
2540
|
}
|
|
2430
2541
|
try {
|
|
2431
|
-
const
|
|
2432
|
-
const { stream: errorHtmlStream, allReady: errorAllReady } = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.renderToNodeFizzStream, /*#__PURE__*/ (0, _jsxruntime.jsx)(ErrorApp, {
|
|
2542
|
+
const { stream: errorHtmlStream } = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.renderToNodeFizzStream, /*#__PURE__*/ (0, _jsxruntime.jsx)(ErrorApp, {
|
|
2433
2543
|
reactServerStream: errorServerStream,
|
|
2434
2544
|
ServerInsertedHTMLProvider: ServerInsertedHTMLProvider,
|
|
2435
2545
|
preinitScripts: errorPreinitScripts,
|
|
@@ -2441,19 +2551,17 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2441
2551
|
bootstrapScripts: [
|
|
2442
2552
|
errorBootstrapScript
|
|
2443
2553
|
],
|
|
2444
|
-
formState
|
|
2554
|
+
formState,
|
|
2555
|
+
onAllReady: finishHtmlRender
|
|
2445
2556
|
}, {
|
|
2446
|
-
waitForAllReady
|
|
2447
|
-
});
|
|
2448
|
-
errorAllReady.finally(()=>{
|
|
2449
|
-
if (renderSpan.isRecording()) renderSpan.end();
|
|
2557
|
+
waitForAllReady
|
|
2450
2558
|
});
|
|
2451
2559
|
return await (0, _streamops.continueFizzStream)(errorHtmlStream, {
|
|
2452
2560
|
inlinedDataStream: (0, _streamops.createNodeInlinedDataStream)(// This is intentionally using the readable datastream from the
|
|
2453
2561
|
// main render rather than the flight data from the error page
|
|
2454
2562
|
// render
|
|
2455
2563
|
reactServerResult.consume(), nonce, formState),
|
|
2456
|
-
|
|
2564
|
+
waitForAllReady,
|
|
2457
2565
|
deploymentId: ctx.sharedContext.deploymentId,
|
|
2458
2566
|
getServerInsertedHTML: (0, _makegetserverinsertedhtml.makeGetServerInsertedHTML)({
|
|
2459
2567
|
polyfills,
|
|
@@ -2493,7 +2601,6 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2493
2601
|
throw setupErr;
|
|
2494
2602
|
}
|
|
2495
2603
|
try {
|
|
2496
|
-
const generateStaticHTML = supportsDynamicResponse !== true;
|
|
2497
2604
|
const { stream: errorHtmlStream, allReady: errorAllReady } = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, _streamops.renderToWebFizzStream, /*#__PURE__*/ (0, _jsxruntime.jsx)(ErrorApp, {
|
|
2498
2605
|
reactServerStream: errorServerStream,
|
|
2499
2606
|
ServerInsertedHTMLProvider: ServerInsertedHTMLProvider,
|
|
@@ -2508,15 +2615,14 @@ async function renderToStream(requestStore, req, res, ctx, tree, formState, post
|
|
|
2508
2615
|
],
|
|
2509
2616
|
formState
|
|
2510
2617
|
});
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
});
|
|
2618
|
+
// Finish after React renders the error document.
|
|
2619
|
+
void errorAllReady.then(finishHtmlRender, finishHtmlRender);
|
|
2514
2620
|
return await (0, _streamops.continueFizzStream)(errorHtmlStream, {
|
|
2515
2621
|
inlinedDataStream: (0, _streamops.createWebInlinedDataStream)(// This is intentionally using the readable datastream from the
|
|
2516
2622
|
// main render rather than the flight data from the error page
|
|
2517
2623
|
// render
|
|
2518
2624
|
reactServerResult.consume(), nonce, formState),
|
|
2519
|
-
|
|
2625
|
+
waitForAllReady,
|
|
2520
2626
|
deploymentId: ctx.sharedContext.deploymentId,
|
|
2521
2627
|
getServerInsertedHTML: (0, _makegetserverinsertedhtml.makeGetServerInsertedHTML)({
|
|
2522
2628
|
polyfills,
|
|
@@ -2600,7 +2706,7 @@ const alreadyForwardedDynamicUsageErrors = new WeakSet();
|
|
|
2600
2706
|
// Read whether the streamed render errored only now that it has fully
|
|
2601
2707
|
// settled.
|
|
2602
2708
|
const devRenderDidError = getDevRenderDidError();
|
|
2603
|
-
const [instantInputs, staticInputs] = await runSpan(
|
|
2709
|
+
const [instantInputs, staticInputs] = await runSpan(_constants1.AppRenderSpan.instantInsightsPrepareValidation, 'Prepare validation inputs', async ()=>{
|
|
2604
2710
|
const lazyInputs = await prepareValidationInputs(prefetchMode, navigationKind, result, requestStore, validationDebugChannel, ctx, prerenderResumeDataCache, createRequestStore, getPayload, onError, validationAbortSignal);
|
|
2605
2711
|
// If we need to do multiple renders, do them in parallel.
|
|
2606
2712
|
// `runValidationInDev` currently needs `instantInputs` eagerly
|
|
@@ -2623,7 +2729,7 @@ const alreadyForwardedDynamicUsageErrors = new WeakSet();
|
|
|
2623
2729
|
logValidationAborted(ctx);
|
|
2624
2730
|
return;
|
|
2625
2731
|
}
|
|
2626
|
-
return runSpan(
|
|
2732
|
+
return runSpan(_constants1.AppRenderSpan.instantInsightsRunValidation, 'Run validation', async ()=>{
|
|
2627
2733
|
// Hand the whole validation to the worker when one is installed. It
|
|
2628
2734
|
// runs on a worker thread (off the main thread), emits its own
|
|
2629
2735
|
// lifecycle markers, logs code frames on its piped stdio, and
|
|
@@ -2640,11 +2746,7 @@ const alreadyForwardedDynamicUsageErrors = new WeakSet();
|
|
|
2640
2746
|
if (chunks && !validationAbortSignal.aborted) {
|
|
2641
2747
|
const { sendErrorsToBrowser } = ctx.renderOpts;
|
|
2642
2748
|
if (!sendErrorsToBrowser) {
|
|
2643
|
-
throw
|
|
2644
|
-
value: "E947",
|
|
2645
|
-
enumerable: false,
|
|
2646
|
-
configurable: true
|
|
2647
|
-
});
|
|
2749
|
+
throw new _invarianterror.InvariantError('Expected `sendErrorsToBrowser` to be defined in renderOpts.');
|
|
2648
2750
|
}
|
|
2649
2751
|
sendErrorsToBrowser((0, _streamutils.createNodeStreamFromChunks)(chunks), ctx.htmlRequestId);
|
|
2650
2752
|
}
|
|
@@ -2673,12 +2775,8 @@ const alreadyForwardedDynamicUsageErrors = new WeakSet();
|
|
|
2673
2775
|
if (validationAbortSignal.aborted) {
|
|
2674
2776
|
return;
|
|
2675
2777
|
}
|
|
2676
|
-
console.error(
|
|
2778
|
+
console.error(new _invarianterror.InvariantError('An unexpected error occurred during validation', {
|
|
2677
2779
|
cause: err
|
|
2678
|
-
}), "__NEXT_ERROR_CODE", {
|
|
2679
|
-
value: "E1393",
|
|
2680
|
-
enumerable: false,
|
|
2681
|
-
configurable: true
|
|
2682
2780
|
}));
|
|
2683
2781
|
}).finally(()=>validationGeneration.finish());
|
|
2684
2782
|
}
|
|
@@ -2710,7 +2808,7 @@ async function runInstantInsightsWithTracing(ctx, fn) {
|
|
|
2710
2808
|
attributes: {
|
|
2711
2809
|
'next.span_category': 'nextjs',
|
|
2712
2810
|
'next.span_name': 'Instant Insights',
|
|
2713
|
-
'next.span_type':
|
|
2811
|
+
'next.span_type': _constants1.AppRenderSpan.instantInsights,
|
|
2714
2812
|
'next.route': ctx.pagePath
|
|
2715
2813
|
}
|
|
2716
2814
|
}, ()=>fn(runInstantInsightsSpan)));
|
|
@@ -2756,19 +2854,53 @@ async function prepareValidationInputs(prefetchMode, navigationKind, result, req
|
|
|
2756
2854
|
async function prepareValidationInputsInPartialPrefetching(navigationKind, requestStore, ctx, prerenderResumeDataCache, createRequestStore, getPayload, onError, inputsFromNavigation, validationAbortSignal) {
|
|
2757
2855
|
const loaderTree = ctx.componentMod.routeModule.userland.loaderTree;
|
|
2758
2856
|
const needsInstantValidation = await (0, _instantconfig.anySegmentNeedsInstantValidationInDev)(loaderTree);
|
|
2759
|
-
|
|
2760
|
-
//
|
|
2761
|
-
const
|
|
2857
|
+
const ensureStaticLevel = await (0, _ensurestatic.resolveEnsureStaticLevel)(loaderTree, /* partialPrefetching */ true);
|
|
2858
|
+
// PPF uses runtime shells by default, but this can be overridden with `ensureStatic`.
|
|
2859
|
+
const appShellStage = ensureStaticLevel >= _ensurestatic.EnsureStaticLevel.Shell ? _stagedrendering.RenderStage.ShellStatic : _stagedrendering.RenderStage.ShellRuntime;
|
|
2860
|
+
// Certain APIs resolve in either static or runtime stages depending on the context.
|
|
2861
|
+
// (see `needsRuntimeShell` and callsites of `trackIncompatibleShellContent`)
|
|
2862
|
+
// This includes:
|
|
2863
|
+
// - static `params`
|
|
2864
|
+
// - `navigation()` and `prefetch()`
|
|
2865
|
+
// - caches with `stale < MIN_SHELL_STALE` are excluded from app shells
|
|
2866
|
+
// but are included in static prerenders
|
|
2867
|
+
// If one of these APIs is used, the render can't be used for both Instant Validation and
|
|
2868
|
+
// Static Shell Validation and we'll need to perform a secondary render.
|
|
2869
|
+
//
|
|
2870
|
+
// Note that a cache miss *also* sets this, because otherwise we might not
|
|
2871
|
+
// have accurate tracking, especially for short-stale caches.
|
|
2872
|
+
// This prevents us from using the same rerender for both validations
|
|
2873
|
+
// if there's a chance that the cache miss might be hiding incompatible data.
|
|
2874
|
+
const canRecoverStaticAndRuntimeShell = !requestStore.hasIncompatibleShellContent;
|
|
2875
|
+
let needsRuntimeAppShell;
|
|
2876
|
+
let canRecoverAppShellFromNavigation;
|
|
2877
|
+
switch(appShellStage){
|
|
2878
|
+
case _stagedrendering.RenderStage.ShellStatic:
|
|
2879
|
+
{
|
|
2880
|
+
// `ShellStatic` can be recovered from any render, because
|
|
2881
|
+
// none of the divergent APIs affect this stage.
|
|
2882
|
+
needsRuntimeAppShell = false;
|
|
2883
|
+
canRecoverAppShellFromNavigation = true;
|
|
2884
|
+
break;
|
|
2885
|
+
}
|
|
2886
|
+
case _stagedrendering.RenderStage.ShellRuntime:
|
|
2887
|
+
{
|
|
2888
|
+
needsRuntimeAppShell = true;
|
|
2889
|
+
// `ShellRuntime` can be recovered if the render has a runtime shell
|
|
2890
|
+
// or if it doesn't use APIs that cause stages to diverge.
|
|
2891
|
+
canRecoverAppShellFromNavigation = navigationHasRuntimeShell(navigationKind) || canRecoverStaticAndRuntimeShell;
|
|
2892
|
+
break;
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2762
2895
|
const LAZY_FULL_RENDER = createLazyDevValidationInputs(async ()=>{
|
|
2763
|
-
const shouldRenderWithAppShell = true;
|
|
2764
2896
|
const prefetchMode = 2;
|
|
2765
|
-
const inputs = await renderWithWarmCachesForValidationInDev(ctx, createRequestStore, getPayload, onError, prerenderResumeDataCache, prefetchMode,
|
|
2897
|
+
const inputs = await renderWithWarmCachesForValidationInDev(ctx, createRequestStore, getPayload, onError, prerenderResumeDataCache, prefetchMode, needsRuntimeAppShell, validationAbortSignal);
|
|
2766
2898
|
if (forwardErrorsFromWarmRender(inputs, ctx)) {
|
|
2767
2899
|
return VALIDATION_BAILOUT;
|
|
2768
2900
|
}
|
|
2769
2901
|
return inputs;
|
|
2770
2902
|
});
|
|
2771
|
-
const
|
|
2903
|
+
const LAZY_RUNTIME_PRERENDER_WITH_STATIC_SHELL = createLazyDevValidationInputs(async ()=>{
|
|
2772
2904
|
const inputs = await prerenderWithWarmCachesForStaticValidationInDev(ctx, createRequestStore, getPayload, onError, prerenderResumeDataCache, validationAbortSignal);
|
|
2773
2905
|
if (forwardErrorsFromWarmRender(inputs, ctx)) {
|
|
2774
2906
|
return VALIDATION_BAILOUT;
|
|
@@ -2776,46 +2908,30 @@ async function prepareValidationInputsInPartialPrefetching(navigationKind, reque
|
|
|
2776
2908
|
return inputs;
|
|
2777
2909
|
});
|
|
2778
2910
|
if (inputsFromNavigation) {
|
|
2779
|
-
// We
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
const instantInputs = needsInstantValidation ? inputsFromNavigation : null;
|
|
2795
|
-
const staticInputs = LAZY_RUNTIME_PRERENDER;
|
|
2796
|
-
return {
|
|
2797
|
-
instantInputs,
|
|
2798
|
-
staticInputs
|
|
2799
|
-
};
|
|
2800
|
-
}
|
|
2801
|
-
// This navigation does not have an accurate app shell, so if we need instant validation, we need to render again.
|
|
2802
|
-
// However, this means that it has an accurate static shell, so we can skip prerendering it.
|
|
2911
|
+
// We might be able to reuse the main render for at least one of the validation passes.
|
|
2912
|
+
// If the navigation has the kind of shell we need, re-use it for Instant Validation.
|
|
2913
|
+
// Otherwise, perform a full render with the kind of shell we need.
|
|
2914
|
+
const instantInputs = !needsInstantValidation ? null : canRecoverAppShellFromNavigation ? inputsFromNavigation : LAZY_FULL_RENDER;
|
|
2915
|
+
const staticInputs = // If the navigation has the correct static stage, reuse it for Static Shell Validation.
|
|
2916
|
+
!navigationHasRuntimeShell(navigationKind) || canRecoverStaticAndRuntimeShell ? inputsFromNavigation : // (this avoids two separate rerenders if the navigation had a runtime app shell
|
|
2917
|
+
// but `canRecoverStaticAndRuntimeShell === false` and we're doing a full rerender)
|
|
2918
|
+
instantInputs && !needsRuntimeAppShell ? instantInputs : // which we need for discriminated errors)
|
|
2919
|
+
LAZY_RUNTIME_PRERENDER_WITH_STATIC_SHELL;
|
|
2920
|
+
return {
|
|
2921
|
+
instantInputs,
|
|
2922
|
+
staticInputs
|
|
2923
|
+
};
|
|
2924
|
+
} else {
|
|
2925
|
+
// We cannot reuse the main navigation, and need to render again.
|
|
2803
2926
|
const instantInputs = needsInstantValidation ? LAZY_FULL_RENDER : null;
|
|
2804
|
-
|
|
2927
|
+
// If stages are compatible and we'll rerender for instant validation,
|
|
2928
|
+
// we can reuse the result for static validation.
|
|
2929
|
+
const staticInputs = instantInputs && (!needsRuntimeAppShell || canRecoverStaticAndRuntimeShell) ? instantInputs : LAZY_RUNTIME_PRERENDER_WITH_STATIC_SHELL;
|
|
2805
2930
|
return {
|
|
2806
2931
|
instantInputs,
|
|
2807
2932
|
staticInputs
|
|
2808
2933
|
};
|
|
2809
2934
|
}
|
|
2810
|
-
// We cannot reuse the main navigation, and need to render again.
|
|
2811
|
-
// If stages are compatible and we'll rerender for instant validation,
|
|
2812
|
-
// we can reuse the result for static validation.
|
|
2813
|
-
const instantInputs = needsInstantValidation ? LAZY_FULL_RENDER : null;
|
|
2814
|
-
const staticInputs = areStagesCompatible && instantInputs !== null ? instantInputs : LAZY_RUNTIME_PRERENDER;
|
|
2815
|
-
return {
|
|
2816
|
-
instantInputs,
|
|
2817
|
-
staticInputs
|
|
2818
|
-
};
|
|
2819
2935
|
}
|
|
2820
2936
|
async function prepareValidationInputsInLegacyPrefetching(ctx, prerenderResumeDataCache, createRequestStore, getPayload, onError, inputsFromNavigation, validationAbortSignal) {
|
|
2821
2937
|
const loaderTree = ctx.componentMod.routeModule.userland.loaderTree;
|
|
@@ -2832,9 +2948,9 @@ async function prepareValidationInputsInLegacyPrefetching(ctx, prerenderResumeDa
|
|
|
2832
2948
|
};
|
|
2833
2949
|
}
|
|
2834
2950
|
const LAZY_FULL_RENDER = createLazyDevValidationInputs(async ()=>{
|
|
2835
|
-
const
|
|
2951
|
+
const shouldRenderWithRuntimeShell = false;
|
|
2836
2952
|
const prefetchMode = 1;
|
|
2837
|
-
const inputs = await renderWithWarmCachesForValidationInDev(ctx, createRequestStore, getPayload, onError, prerenderResumeDataCache, prefetchMode,
|
|
2953
|
+
const inputs = await renderWithWarmCachesForValidationInDev(ctx, createRequestStore, getPayload, onError, prerenderResumeDataCache, prefetchMode, shouldRenderWithRuntimeShell, validationAbortSignal);
|
|
2838
2954
|
if (forwardErrorsFromWarmRender(inputs, ctx)) {
|
|
2839
2955
|
return VALIDATION_BAILOUT;
|
|
2840
2956
|
}
|
|
@@ -2879,7 +2995,10 @@ async function resolveLazyDevValidationInputs(resolvedOrLazyInputs, ctx) {
|
|
|
2879
2995
|
if ('syncInterruptReason' in inputs) {
|
|
2880
2996
|
await logMessagesAndSendErrorsToBrowser([
|
|
2881
2997
|
inputs.syncInterruptReason
|
|
2882
|
-
], ctx
|
|
2998
|
+
], ctx, // We're not going to run validation, so mark this as the validation result for tests.
|
|
2999
|
+
{
|
|
3000
|
+
logAsValidationResult: true
|
|
3001
|
+
});
|
|
2883
3002
|
return VALIDATION_BAILOUT;
|
|
2884
3003
|
}
|
|
2885
3004
|
return inputs;
|
|
@@ -2888,7 +3007,10 @@ function forwardErrorsFromWarmRender(inputs, ctx) {
|
|
|
2888
3007
|
if ('syncInterruptReason' in inputs) {
|
|
2889
3008
|
void logMessagesAndSendErrorsToBrowser([
|
|
2890
3009
|
inputs.syncInterruptReason
|
|
2891
|
-
], ctx
|
|
3010
|
+
], ctx, // We're not going to run validation, so mark this as the validation result for tests.
|
|
3011
|
+
{
|
|
3012
|
+
logAsValidationResult: true
|
|
3013
|
+
});
|
|
2892
3014
|
return true;
|
|
2893
3015
|
}
|
|
2894
3016
|
// Unlike the cold streamed render, which fills the caches, the warm
|
|
@@ -2908,7 +3030,6 @@ var PrefetchingMode = /*#__PURE__*/ function(PrefetchingMode) {
|
|
|
2908
3030
|
}({});
|
|
2909
3031
|
async function getPrefetchingModeForPage(renderOpts, loaderTree) {
|
|
2910
3032
|
const debug = process.env.NEXT_PRIVATE_DEBUG_VALIDATION === '1' ? console.log : undefined;
|
|
2911
|
-
// TODO(app-shells): support "unstable_eager"
|
|
2912
3033
|
if (renderOpts.partialPrefetching) {
|
|
2913
3034
|
debug == null ? void 0 : debug('using prefetching mode Partial because of next.config.js');
|
|
2914
3035
|
return 2;
|
|
@@ -2934,8 +3055,8 @@ function getSyncIOMode(prefetchMode) {
|
|
|
2934
3055
|
* cache, async API promises, and a staged rendering controller, all wired into
|
|
2935
3056
|
* the request store.
|
|
2936
3057
|
*/ function setUpStagedDevRender(prefetchingMode, navigationKind, requestStore) {
|
|
2937
|
-
const
|
|
2938
|
-
const cacheSignal = new _cachesignal.CacheSignal();
|
|
3058
|
+
const shouldRenderWithRuntimeShell = navigationHasRuntimeShell(navigationKind);
|
|
3059
|
+
const cacheSignal = new _cachesignal.CacheSignal(null);
|
|
2939
3060
|
(0, _trackmoduleloadingexternal.trackPendingModules)(cacheSignal);
|
|
2940
3061
|
const prerenderResumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)();
|
|
2941
3062
|
const stageController = new _stagedrendering.StagedRenderingController({
|
|
@@ -2946,7 +3067,8 @@ function getSyncIOMode(prefetchMode) {
|
|
|
2946
3067
|
});
|
|
2947
3068
|
requestStore.resumeDataCache = prerenderResumeDataCache;
|
|
2948
3069
|
requestStore.stagedRendering = stageController;
|
|
2949
|
-
requestStore.
|
|
3070
|
+
requestStore.needsRuntimeShell = shouldRenderWithRuntimeShell;
|
|
3071
|
+
requestStore.hasIncompatibleShellContent = false;
|
|
2950
3072
|
requestStore.asyncApiPromises = createAsyncApiPromises(stageController, requestStore.cookies, requestStore.mutableCookies, requestStore.headers);
|
|
2951
3073
|
requestStore.cacheSignal = cacheSignal;
|
|
2952
3074
|
const environmentName = ()=>getEnvironmentNameForStage(stageController.currentStage);
|
|
@@ -2961,27 +3083,46 @@ function getEnvironmentNameForStage(stage) {
|
|
|
2961
3083
|
switch(stage){
|
|
2962
3084
|
case _stagedrendering.RenderStage.Before:
|
|
2963
3085
|
case _stagedrendering.RenderStage.ShellStatic:
|
|
3086
|
+
case _stagedrendering.RenderStage.PrefetchStatic_prefetchApi:
|
|
3087
|
+
case _stagedrendering.RenderStage.PrefetchStatic:
|
|
3088
|
+
case _stagedrendering.RenderStage.NavigationStatic:
|
|
2964
3089
|
case _stagedrendering.RenderStage.Static:
|
|
2965
3090
|
return 'Prerender';
|
|
2966
3091
|
case _stagedrendering.RenderStage.ShellRuntime:
|
|
2967
|
-
case _stagedrendering.RenderStage.
|
|
3092
|
+
case _stagedrendering.RenderStage.PrefetchRuntime_prefetchApi:
|
|
3093
|
+
case _stagedrendering.RenderStage.PrefetchRuntime:
|
|
3094
|
+
case _stagedrendering.RenderStage.NavigationRuntime:
|
|
2968
3095
|
return 'Prefetch';
|
|
2969
3096
|
case _stagedrendering.RenderStage.Dynamic:
|
|
2970
3097
|
case _stagedrendering.RenderStage.Abandoned:
|
|
2971
3098
|
return 'Server';
|
|
2972
3099
|
default:
|
|
2973
3100
|
stage;
|
|
2974
|
-
throw
|
|
2975
|
-
value: "E881",
|
|
2976
|
-
enumerable: false,
|
|
2977
|
-
configurable: true
|
|
2978
|
-
});
|
|
3101
|
+
throw new _invarianterror.InvariantError(`Invalid render stage: ${stage}`);
|
|
2979
3102
|
}
|
|
2980
3103
|
}
|
|
2981
|
-
function
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
3104
|
+
function navigationHasRuntimeShell(navigationKind) {
|
|
3105
|
+
switch(navigationKind.type){
|
|
3106
|
+
case 'initial-load':
|
|
3107
|
+
{
|
|
3108
|
+
return false;
|
|
3109
|
+
}
|
|
3110
|
+
case 'prefetched-client':
|
|
3111
|
+
{
|
|
3112
|
+
switch(navigationKind.prefetchStage){
|
|
3113
|
+
case _stagedrendering.RenderStage.ShellStatic:
|
|
3114
|
+
case _stagedrendering.RenderStage.Static:
|
|
3115
|
+
{
|
|
3116
|
+
return false;
|
|
3117
|
+
}
|
|
3118
|
+
case _stagedrendering.RenderStage.ShellRuntime:
|
|
3119
|
+
case _stagedrendering.RenderStage.PrefetchRuntime:
|
|
3120
|
+
{
|
|
3121
|
+
return true;
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
2985
3126
|
}
|
|
2986
3127
|
/**
|
|
2987
3128
|
* Streams a staged dev render to completion without ever abandoning it, so it
|
|
@@ -2995,7 +3136,7 @@ function navigationHasAppShell(navigationKind) {
|
|
|
2995
3136
|
* The chunks are accumulated eagerly because detecting completion requires
|
|
2996
3137
|
* reading the whole stream anyway; the same accumulation feeds validation when
|
|
2997
3138
|
* the render turns out to be prod-representative.
|
|
2998
|
-
*/ async function streamStagedRenderInDev({ ctx, requestStore, rscPayload, stageController, cacheSignal, environmentName, onError, debugChannel, navigationKind, requestAbortSignal }) {
|
|
3139
|
+
*/ async function streamStagedRenderInDev({ prefetchMode, ctx, requestStore, rscPayload, stageController, cacheSignal, environmentName, onError, debugChannel, navigationKind, requestAbortSignal }) {
|
|
2999
3140
|
let holdStreamUntilRevealed;
|
|
3000
3141
|
let revealAfterStage;
|
|
3001
3142
|
switch(navigationKind.type){
|
|
@@ -3026,7 +3167,7 @@ function navigationHasAppShell(navigationKind) {
|
|
|
3026
3167
|
// earlier on a cache miss). When streaming live (a client navigation), it's
|
|
3027
3168
|
// surfaced through the Flight payload as `_revealAfter`: the client decodes
|
|
3028
3169
|
// it and defers resolving the response's deferred RSCs on it (see
|
|
3029
|
-
// `
|
|
3170
|
+
// `render-tree`), so a Suspense boundary's children aren't revealed
|
|
3030
3171
|
// before their row has been decoded, which would flush a premature fallback.
|
|
3031
3172
|
// React serializes the promise as a pending row whose resolution row is
|
|
3032
3173
|
// emitted only when we resolve it here, and that row follows the children's
|
|
@@ -3048,6 +3189,7 @@ function navigationHasAppShell(navigationKind) {
|
|
|
3048
3189
|
// is reported at most once, and only for a read that's still pending while a
|
|
3049
3190
|
// shell stage is flushing (see `checkForCacheMiss`).
|
|
3050
3191
|
let reportedColdCache = false;
|
|
3192
|
+
let trackedIncompatibleShellContent = false;
|
|
3051
3193
|
// Runs at each stage boundary. Latches the running cache-miss verdict and
|
|
3052
3194
|
// returns it, so a boundary can reveal the shell as soon as a miss is seen
|
|
3053
3195
|
// (and so dev validation can later tell whether the streamed render is
|
|
@@ -3056,6 +3198,31 @@ function navigationHasAppShell(navigationKind) {
|
|
|
3056
3198
|
const checkForCacheMiss = ()=>{
|
|
3057
3199
|
if (cacheSignal.hasPendingReads()) {
|
|
3058
3200
|
hadCacheMiss = true;
|
|
3201
|
+
if (prefetchMode === 2) {
|
|
3202
|
+
// If we had a cache miss (and we'll need an app shell for validation),
|
|
3203
|
+
// we *may* have content that is incompatible between an app shell and a static shell:
|
|
3204
|
+
//
|
|
3205
|
+
// - A cache miss might defer content to a stage where it is no longer
|
|
3206
|
+
// considered incompatible and would not be tracked as such
|
|
3207
|
+
// - Caches with `stale < MIN_SHELL_STALE` should be excluded from app shells,
|
|
3208
|
+
// but included in static prerenders (which we can only do when the cache
|
|
3209
|
+
// is a hit and its cache life is known)
|
|
3210
|
+
//
|
|
3211
|
+
// We need to signal this to `prepareValidationInputsInPartialPrefetching`.
|
|
3212
|
+
// It would not re-use a render with a cache miss anyway, but it tries to
|
|
3213
|
+
// optimize the follow-up rerenders into a single one based on whether
|
|
3214
|
+
// stages are compatible, and we can't do that if they *might* use incompatible
|
|
3215
|
+
// data due to a cache miss.
|
|
3216
|
+
//
|
|
3217
|
+
// TODO(app-shells): optimize this (and other `trackIncompatibleShellContent`
|
|
3218
|
+
// callsites) to only consider stages that are relevant for validation.
|
|
3219
|
+
if (trackedIncompatibleShellContent) {
|
|
3220
|
+
// It's enough to report the first miss.
|
|
3221
|
+
} else {
|
|
3222
|
+
trackedIncompatibleShellContent = true;
|
|
3223
|
+
(0, _dynamicrenderingutils.trackIncompatibleShellContent)(requestStore, 'cache miss during main render');
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3059
3226
|
// The cold-cache indicator reflects the shell only. A cache read still
|
|
3060
3227
|
// pending while a shell stage flushes (`currentStage <=
|
|
3061
3228
|
// revealAfterStage`, using the ordered `RenderStage` values) is part of
|
|
@@ -3102,7 +3269,7 @@ function navigationHasAppShell(navigationKind) {
|
|
|
3102
3269
|
// for the stream to close.
|
|
3103
3270
|
requestAbortSignal ?? null)
|
|
3104
3271
|
});
|
|
3105
|
-
}, ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.Static), ()=>checkReveal(_stagedrendering.RenderStage.Static), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.ShellRuntime), ()=>checkReveal(_stagedrendering.RenderStage.ShellRuntime), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.
|
|
3272
|
+
}, ()=>checkReveal(_stagedrendering.RenderStage.ShellStatic), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.PrefetchStatic_prefetchApi), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.PrefetchStatic), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.NavigationStatic), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.Static), ()=>checkReveal(_stagedrendering.RenderStage.Static), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.ShellRuntime), ()=>checkReveal(_stagedrendering.RenderStage.ShellRuntime), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.PrefetchRuntime_prefetchApi), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.PrefetchRuntime), ()=>checkReveal(_stagedrendering.RenderStage.PrefetchRuntime), ()=>checkCacheMissAndAdvance(_stagedrendering.RenderStage.NavigationRuntime), ()=>{
|
|
3106
3273
|
// Advance to the dynamic stage even while caches are still filling, so
|
|
3107
3274
|
// dynamic content streams to the browser right away instead of being
|
|
3108
3275
|
// withheld until the slowest cache fill completes. Streaming that content
|
|
@@ -3167,13 +3334,14 @@ function navigationHasAppShell(navigationKind) {
|
|
|
3167
3334
|
};
|
|
3168
3335
|
}
|
|
3169
3336
|
function getStageEndTimes(stageController) {
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
[
|
|
3174
|
-
}
|
|
3337
|
+
const result = {};
|
|
3338
|
+
for (const stage of _stagedrendering.RENDER_STAGE_ADVANCE_ORDER){
|
|
3339
|
+
if (stage === _stagedrendering.RenderStage.Dynamic) break;
|
|
3340
|
+
result[stage] = stageController.getStageEndTime(stage);
|
|
3341
|
+
}
|
|
3342
|
+
return result;
|
|
3175
3343
|
}
|
|
3176
|
-
async function renderWithWarmCachesForValidationInDev(ctx, createRequestStore, getPayload, onError, prerenderResumeDataCache, prefetchMode,
|
|
3344
|
+
async function renderWithWarmCachesForValidationInDev(ctx, createRequestStore, getPayload, onError, prerenderResumeDataCache, prefetchMode, shouldRenderWithRuntimeShell, validationAbortSignal) {
|
|
3177
3345
|
const { ComponentMod, setReactDebugChannel } = ctx.renderOpts;
|
|
3178
3346
|
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
3179
3347
|
const stageController = new _stagedrendering.StagedRenderingController({
|
|
@@ -3185,7 +3353,8 @@ async function renderWithWarmCachesForValidationInDev(ctx, createRequestStore, g
|
|
|
3185
3353
|
const requestStore = createRequestStore();
|
|
3186
3354
|
requestStore.resumeDataCache = (0, _resumedatacache.createRenderResumeDataCache)(prerenderResumeDataCache);
|
|
3187
3355
|
requestStore.stagedRendering = stageController;
|
|
3188
|
-
requestStore.
|
|
3356
|
+
requestStore.needsRuntimeShell = shouldRenderWithRuntimeShell;
|
|
3357
|
+
requestStore.hasIncompatibleShellContent = false;
|
|
3189
3358
|
requestStore.cacheSignal = null;
|
|
3190
3359
|
requestStore.asyncApiPromises = createAsyncApiPromises(stageController, requestStore.cookies, requestStore.mutableCookies, requestStore.headers);
|
|
3191
3360
|
const debugChannel = setReactDebugChannel && (0, _debugchannelserver.createNodeDebugChannel)();
|
|
@@ -3204,7 +3373,7 @@ async function renderWithWarmCachesForValidationInDev(ctx, createRequestStore, g
|
|
|
3204
3373
|
signal: validationAbortSignal
|
|
3205
3374
|
});
|
|
3206
3375
|
return accumulateStreamChunks(sourceStream, stageController, validationAbortSignal);
|
|
3207
|
-
}, ()=>stageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>stageController.advanceStage(_stagedrendering.RenderStage.ShellRuntime), ()=>stageController.advanceStage(_stagedrendering.RenderStage.
|
|
3376
|
+
}, ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic_prefetchApi), ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>stageController.advanceStage(_stagedrendering.RenderStage.ShellRuntime), ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchRuntime_prefetchApi), ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchRuntime), ()=>stageController.advanceStage(_stagedrendering.RenderStage.NavigationRuntime), ()=>stageController.advanceStage(_stagedrendering.RenderStage.Dynamic));
|
|
3208
3377
|
const syncInterruptReason = stageController.getSyncInterruptReason();
|
|
3209
3378
|
if (syncInterruptReason) {
|
|
3210
3379
|
// Sync IO interrupted the render, so it won't be validated. Drop the debug
|
|
@@ -3229,7 +3398,7 @@ async function prerenderWithWarmCachesForStaticValidationInDev(ctx, createReques
|
|
|
3229
3398
|
const { ComponentMod, setReactDebugChannel } = ctx.renderOpts;
|
|
3230
3399
|
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
3231
3400
|
// This render is for validation only, and won't be shown to the user,
|
|
3232
|
-
// so we're only rendering until the
|
|
3401
|
+
// so we're only rendering until the PrefetchRuntime stage
|
|
3233
3402
|
// (we need static chunks and runtime chunks for discriminated errors)
|
|
3234
3403
|
const finalReactController = new AbortController();
|
|
3235
3404
|
const finalDataController = new AbortController();
|
|
@@ -3238,15 +3407,16 @@ async function prerenderWithWarmCachesForStaticValidationInDev(ctx, createReques
|
|
|
3238
3407
|
abortSignal: finalDataController.signal,
|
|
3239
3408
|
abandonController: null,
|
|
3240
3409
|
syncIO: getSyncIOMode(prefetchMode),
|
|
3241
|
-
finalStage: _stagedrendering.RenderStage.
|
|
3410
|
+
finalStage: _stagedrendering.RenderStage.PrefetchRuntime
|
|
3242
3411
|
});
|
|
3243
3412
|
const requestStore = createRequestStore();
|
|
3244
3413
|
requestStore.resumeDataCache = (0, _resumedatacache.createRenderResumeDataCache)(prerenderResumeDataCache);
|
|
3245
3414
|
requestStore.stagedRendering = stageController;
|
|
3246
|
-
requestStore.
|
|
3415
|
+
requestStore.needsRuntimeShell = false;
|
|
3416
|
+
requestStore.hasIncompatibleShellContent = false;
|
|
3247
3417
|
requestStore.cacheSignal = null;
|
|
3248
3418
|
requestStore.asyncApiPromises = createAsyncApiPromises(stageController, requestStore.cookies, requestStore.mutableCookies, requestStore.headers);
|
|
3249
|
-
// We abort upon reaching the
|
|
3419
|
+
// We abort upon reaching the PrefetchRuntime stage or on Sync IO.
|
|
3250
3420
|
// If sync IO occurs in a place where it's not allowed, then we have to fail validation,
|
|
3251
3421
|
// and we can abort the render immediately, without waiting for anything else..
|
|
3252
3422
|
requestStore.controller = finalReactController;
|
|
@@ -3277,8 +3447,9 @@ async function prerenderWithWarmCachesForStaticValidationInDev(ctx, createReques
|
|
|
3277
3447
|
abortWhenSignalAborts(finalReactController.signal, finalDataController);
|
|
3278
3448
|
// Note: this await will only resolve after the last task (unless sync IO aborts the render earlier)
|
|
3279
3449
|
await iterateStreamingPrerenderChunks(sourceStream, finalReactController.signal, collectChunk);
|
|
3280
|
-
}, ()=>stageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>stageController.advanceStage(_stagedrendering.RenderStage.ShellRuntime), ()=>stageController.advanceStage(_stagedrendering.RenderStage.
|
|
3281
|
-
|
|
3450
|
+
}, ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic_prefetchApi), ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic), ()=>stageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>stageController.advanceStage(_stagedrendering.RenderStage.ShellRuntime), ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchRuntime_prefetchApi), ()=>stageController.advanceStage(_stagedrendering.RenderStage.PrefetchRuntime), // NOTE: We don't need `NavigationRuntime`, because we set `needsRuntimeShell: false`
|
|
3451
|
+
// so `navigation()` resolves in the static stages.
|
|
3452
|
+
()=>{
|
|
3282
3453
|
abortInRenderContext(requestStore, finalReactController);
|
|
3283
3454
|
});
|
|
3284
3455
|
const syncInterruptReason = stageController.getSyncInterruptReason();
|
|
@@ -3397,13 +3568,11 @@ const ABORT_ONCE = {
|
|
|
3397
3568
|
}
|
|
3398
3569
|
}
|
|
3399
3570
|
function createStageChunksAccumulator() {
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
dynamicChunks: []
|
|
3406
|
-
};
|
|
3571
|
+
const result = {};
|
|
3572
|
+
for (const stage of _stagedrendering.RENDER_STAGE_ADVANCE_ORDER){
|
|
3573
|
+
result[stage] = [];
|
|
3574
|
+
}
|
|
3575
|
+
return result;
|
|
3407
3576
|
}
|
|
3408
3577
|
async function accumulateStreamChunks(stream, stageController, signal) {
|
|
3409
3578
|
const accumulator = createStageChunksAccumulator();
|
|
@@ -3464,38 +3633,23 @@ async function accumulateStreamChunksInto(accumulator, stream, stageController,
|
|
|
3464
3633
|
} catch (err) {
|
|
3465
3634
|
if (!cancelled) {
|
|
3466
3635
|
throw err;
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
function collectStageChunk(accumulator,
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
// fall through
|
|
3482
|
-
case _stagedrendering.RenderStage.Static:
|
|
3483
|
-
accumulator.staticChunks.push(value1);
|
|
3484
|
-
// fall through
|
|
3485
|
-
case _stagedrendering.RenderStage.ShellRuntime:
|
|
3486
|
-
accumulator.shellRuntimeChunks.push(value1);
|
|
3487
|
-
// fall through
|
|
3488
|
-
case _stagedrendering.RenderStage.Runtime:
|
|
3489
|
-
accumulator.runtimeChunks.push(value1);
|
|
3490
|
-
// fall through
|
|
3491
|
-
case _stagedrendering.RenderStage.Dynamic:
|
|
3492
|
-
accumulator.dynamicChunks.push(value1);
|
|
3493
|
-
break;
|
|
3494
|
-
case _stagedrendering.RenderStage.Abandoned:
|
|
3495
|
-
break;
|
|
3496
|
-
default:
|
|
3497
|
-
stage;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
function collectStageChunk(accumulator, currentStage, value1) {
|
|
3641
|
+
if (currentStage === _stagedrendering.RenderStage.Before) {
|
|
3642
|
+
throw new _invarianterror.InvariantError('Unexpected stream chunk while in Before stage');
|
|
3643
|
+
}
|
|
3644
|
+
// Stage N+1 contains all the chunks of the stages 1..N,
|
|
3645
|
+
// so add the chunk to the array for the current stage and all the stages that follow it.
|
|
3646
|
+
// Starting at the end saves us from having to find the current stage in the order array.
|
|
3647
|
+
for(let i = _stagedrendering.RENDER_STAGE_ADVANCE_ORDER.length - 1; i >= 0; i--){
|
|
3648
|
+
const stage = _stagedrendering.RENDER_STAGE_ADVANCE_ORDER[i];
|
|
3649
|
+
if (stage < currentStage) {
|
|
3498
3650
|
break;
|
|
3651
|
+
}
|
|
3652
|
+
accumulator[stage].push(value1);
|
|
3499
3653
|
}
|
|
3500
3654
|
}
|
|
3501
3655
|
async function countShellAndStaticStageBytes(stream, stageController) {
|
|
@@ -3552,8 +3706,8 @@ function createAsyncApiPromises(stagedRendering, cookies, mutableCookies, header
|
|
|
3552
3706
|
// NOTE: Must be kept in sync with cookies.ts, headers.ts, params.ts, search-params.ts
|
|
3553
3707
|
const cookiesStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.sessionData;
|
|
3554
3708
|
const headersStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.sessionData;
|
|
3555
|
-
const paramsStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.
|
|
3556
|
-
const searchParamsStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.
|
|
3709
|
+
const paramsStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.runtimeUrlData;
|
|
3710
|
+
const searchParamsStage = _dynamicrenderingutils.RENDER_STAGES_BY_DATA_KIND.runtimeUrlData;
|
|
3557
3711
|
return {
|
|
3558
3712
|
cookies: stagedRendering.delayUntilStage(cookiesStage, 'cookies', cookies),
|
|
3559
3713
|
mutableCookies: stagedRendering.delayUntilStage(cookiesStage, 'cookies', mutableCookies),
|
|
@@ -3572,9 +3726,18 @@ function createAsyncApiPromises(stagedRendering, cookies, mutableCookies, header
|
|
|
3572
3726
|
* source-map the stack frames (via findSourceMapURL), but also create virtual
|
|
3573
3727
|
* server modules that allow users to inspect the server source code in the
|
|
3574
3728
|
* browser.
|
|
3575
|
-
*/ async function logMessagesAndSendErrorsToBrowser(messages, ctx) {
|
|
3576
|
-
const
|
|
3729
|
+
*/ async function logMessagesAndSendErrorsToBrowser(messages, ctx, options = {}) {
|
|
3730
|
+
const logAsValidationResult = process.env.__NEXT_TEST_MODE && process.env.NEXT_TEST_LOG_VALIDATION && options.logAsValidationResult;
|
|
3731
|
+
const { htmlRequestId, requestId, renderOpts } = ctx;
|
|
3732
|
+
const url = ctx.url.href;
|
|
3577
3733
|
const { sendErrorsToBrowser } = renderOpts;
|
|
3734
|
+
if (logAsValidationResult) {
|
|
3735
|
+
console.log((0, _devvalidationevents.formatValidationEvent)({
|
|
3736
|
+
type: 'validation_start',
|
|
3737
|
+
requestId,
|
|
3738
|
+
url
|
|
3739
|
+
}));
|
|
3740
|
+
}
|
|
3578
3741
|
const errors = [];
|
|
3579
3742
|
for (const message of messages){
|
|
3580
3743
|
// Log the error to the CLI. Prevent the logs from being dimmed, which we
|
|
@@ -3592,38 +3755,28 @@ function createAsyncApiPromises(stagedRendering, cookies, mutableCookies, header
|
|
|
3592
3755
|
errors.push(message);
|
|
3593
3756
|
}
|
|
3594
3757
|
}
|
|
3758
|
+
if (logAsValidationResult) {
|
|
3759
|
+
console.log((0, _devvalidationevents.formatValidationEvent)({
|
|
3760
|
+
type: 'validation_end',
|
|
3761
|
+
requestId,
|
|
3762
|
+
url
|
|
3763
|
+
}));
|
|
3764
|
+
}
|
|
3595
3765
|
if (errors.length > 0) {
|
|
3596
3766
|
if (!sendErrorsToBrowser) {
|
|
3597
|
-
throw
|
|
3598
|
-
value: "E947",
|
|
3599
|
-
enumerable: false,
|
|
3600
|
-
configurable: true
|
|
3601
|
-
});
|
|
3602
|
-
}
|
|
3603
|
-
// Build a Map of error → error code for errors that have one.
|
|
3604
|
-
// React doesn't revive __NEXT_ERROR_CODE during RSC deserialization, so we
|
|
3605
|
-
// send it as a side-channel Map. RSC preserves object identity, so the
|
|
3606
|
-
// deserialized Map keys will reference the same Error objects.
|
|
3607
|
-
const errorCodes = new Map();
|
|
3608
|
-
for (const err of errors){
|
|
3609
|
-
const code = (0, _errortelemetryutils.extractNextErrorCode)(err);
|
|
3610
|
-
if (code !== undefined) {
|
|
3611
|
-
errorCodes.set(err, code);
|
|
3612
|
-
}
|
|
3767
|
+
throw new _invarianterror.InvariantError('Expected `sendErrorsToBrowser` to be defined in renderOpts.');
|
|
3613
3768
|
}
|
|
3614
3769
|
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
3615
3770
|
let errorsFlightStream;
|
|
3616
3771
|
if (process.env.__NEXT_USE_NODE_STREAMS) {
|
|
3617
3772
|
errorsFlightStream = (0, _streamops.renderToNodeFlightStream)(ctx.componentMod, {
|
|
3618
|
-
errors
|
|
3619
|
-
errorCodes
|
|
3773
|
+
errors
|
|
3620
3774
|
}, clientModules, {
|
|
3621
3775
|
filterStackFrame
|
|
3622
3776
|
});
|
|
3623
3777
|
} else {
|
|
3624
3778
|
errorsFlightStream = (0, _streamops.renderToWebFlightStream)(ctx.componentMod, {
|
|
3625
|
-
errors
|
|
3626
|
-
errorCodes
|
|
3779
|
+
errors
|
|
3627
3780
|
}, clientModules, {
|
|
3628
3781
|
filterStackFrame
|
|
3629
3782
|
});
|
|
@@ -3723,8 +3876,10 @@ function toValidationRenderContext(ctx) {
|
|
|
3723
3876
|
workStore: ctx.workStore,
|
|
3724
3877
|
renderOpts: {
|
|
3725
3878
|
images: ctx.renderOpts.images,
|
|
3726
|
-
allowEmptyStaticShell: ctx.renderOpts.allowEmptyStaticShell
|
|
3879
|
+
allowEmptyStaticShell: ctx.renderOpts.allowEmptyStaticShell,
|
|
3880
|
+
partialPrefetching: ctx.renderOpts.partialPrefetching
|
|
3727
3881
|
},
|
|
3882
|
+
reactBrowserBailout: ctx.renderOpts.experimental.reactBrowserBailout,
|
|
3728
3883
|
isDebugChannelEnabled: !!ctx.renderOpts.setReactDebugChannel
|
|
3729
3884
|
};
|
|
3730
3885
|
}
|
|
@@ -3744,12 +3899,12 @@ function toValidationRenderContext(ctx) {
|
|
|
3744
3899
|
onTaskError () {}
|
|
3745
3900
|
});
|
|
3746
3901
|
return {
|
|
3747
|
-
isStaticGeneration: false,
|
|
3748
3902
|
page: message.page,
|
|
3749
3903
|
route: message.route,
|
|
3750
3904
|
forceStatic: message.forceStatic,
|
|
3751
3905
|
isDraftMode: message.request.isDraftMode,
|
|
3752
3906
|
useCacheTimeout: message.nextConfigSerializable.useCacheTimeout,
|
|
3907
|
+
durableUseCacheEntries: message.nextConfigSerializable.durableUseCacheEntries,
|
|
3753
3908
|
staticPageGenerationTimeout: message.nextConfigSerializable.staticPageGenerationTimeout,
|
|
3754
3909
|
cacheLifeProfiles: message.nextConfigSerializable.cacheLifeProfiles,
|
|
3755
3910
|
buildId: message.buildId,
|
|
@@ -3759,6 +3914,7 @@ function toValidationRenderContext(ctx) {
|
|
|
3759
3914
|
refreshTagsByCacheKind: new Map(),
|
|
3760
3915
|
runInCleanSnapshot: (0, _asynclocalstorage.createSnapshot)(),
|
|
3761
3916
|
shouldTrackFetchMetrics: false,
|
|
3917
|
+
clientComponentLoadTracker: undefined,
|
|
3762
3918
|
reactServerErrorsByDigest: new Map(),
|
|
3763
3919
|
afterContext: noopAfterContext,
|
|
3764
3920
|
// Dev validation only ever runs under Cache Components.
|
|
@@ -3783,12 +3939,13 @@ async function runValidationInDevFromSnapshot(message, componentMod, abortSignal
|
|
|
3783
3939
|
// so `react-server-dom-*` can resolve client references during the validation
|
|
3784
3940
|
// prerenders, exactly as the main render does after loading its module.
|
|
3785
3941
|
if (componentMod.__next_app__) {
|
|
3786
|
-
installGlobalModuleLoadingHandlers(componentMod, true
|
|
3942
|
+
installGlobalModuleLoadingHandlers(componentMod, true);
|
|
3787
3943
|
}
|
|
3788
3944
|
// `requestFallbackRouteParams` reproduces `ctx.getDynamicParamFromSegment`
|
|
3789
3945
|
// exactly, so the depth-loop segment keys match the seed render's Flight.
|
|
3790
|
-
// `fallbackRouteParams` is
|
|
3791
|
-
// prerender stores
|
|
3946
|
+
// `fallbackRouteParams` is the staged set of the main-thread request store.
|
|
3947
|
+
// It marks params unknown in the prerender stores, and the worker's request
|
|
3948
|
+
// store defers the same params, so both validation paths stage alike.
|
|
3792
3949
|
//
|
|
3793
3950
|
// TODO: Those two fallback params sets are very confusing in the whole code
|
|
3794
3951
|
// base. We should maybe refactor this to make their different roles clearer.
|
|
@@ -3808,8 +3965,10 @@ async function runValidationInDevFromSnapshot(message, componentMod, abortSignal
|
|
|
3808
3965
|
workStore,
|
|
3809
3966
|
renderOpts: {
|
|
3810
3967
|
images: message.renderOpts.images,
|
|
3811
|
-
allowEmptyStaticShell: message.renderOpts.allowEmptyStaticShell
|
|
3968
|
+
allowEmptyStaticShell: message.renderOpts.allowEmptyStaticShell,
|
|
3969
|
+
partialPrefetching: message.renderOpts.partialPrefetching
|
|
3812
3970
|
},
|
|
3971
|
+
reactBrowserBailout: message.reactBrowserBailout,
|
|
3813
3972
|
isDebugChannelEnabled: message.isDebugChannelEnabled
|
|
3814
3973
|
};
|
|
3815
3974
|
const requestStore = (0, _requeststore.createRequestStore)({
|
|
@@ -3827,7 +3986,7 @@ async function runValidationInDevFromSnapshot(message, componentMod, abortSignal
|
|
|
3827
3986
|
isHmrRefresh: message.request.isHmrRefresh,
|
|
3828
3987
|
hmrRefreshHash: message.request.hmrRefreshHash,
|
|
3829
3988
|
serverComponentsHmrCache: undefined,
|
|
3830
|
-
|
|
3989
|
+
stagedFallbackParams: fallbackRouteParams ? new Set(fallbackRouteParams.keys()) : null
|
|
3831
3990
|
});
|
|
3832
3991
|
const staticInputs = toDevValidationInputs(message.staticInputs, requestStore);
|
|
3833
3992
|
const instantInputs = message.instantInputs ? toDevValidationInputs(message.instantInputs, requestStore) : null;
|
|
@@ -3852,14 +4011,14 @@ async function runValidationInDevFromSnapshot(message, componentMod, abortSignal
|
|
|
3852
4011
|
{
|
|
3853
4012
|
// For warmup, we have to use the shared inputs if present -- the static inputs
|
|
3854
4013
|
// may not have a proper dynamic stage.
|
|
3855
|
-
const {
|
|
4014
|
+
const { accumulatedChunks } = instantInputs ?? staticInputs;
|
|
3856
4015
|
// First we warmup SSR with the runtime chunks. This ensures that when we do
|
|
3857
4016
|
// the full prerender pass with dynamic tracking module loading won't
|
|
3858
4017
|
// interrupt the prerender and can properly observe the entire content
|
|
3859
4018
|
await warmupClientModulesForStagedValidation(// if we're going to be validating prefetches, we'll be rendering some segments in the dynamic stage.
|
|
3860
|
-
// otherwise, for static shell validation, we only need to warm up to the
|
|
4019
|
+
// otherwise, for static shell validation, we only need to warm up to the PrefetchRuntime stage.
|
|
3861
4020
|
// we also need to use a different store type, because instant validation allows more APIs to resolve.
|
|
3862
|
-
needsInstantValidation ? 'validation-client' : 'prerender-client', needsInstantValidation ?
|
|
4021
|
+
needsInstantValidation ? 'validation-client' : 'prerender-client', needsInstantValidation ? accumulatedChunks[_stagedrendering.RenderStage.Dynamic] : accumulatedChunks[_stagedrendering.RenderStage.PrefetchRuntime], accumulatedChunks[_stagedrendering.RenderStage.Dynamic], rootParams, fallbackRouteParams, ctx, validationSamples, validationSampleTracking, validationAbortSignal);
|
|
3863
4022
|
}
|
|
3864
4023
|
// React renders used by validation can occupy an entire event-loop turn.
|
|
3865
4024
|
// Yield between them so a newer navigation can enter app rendering,
|
|
@@ -3938,11 +4097,12 @@ async function validateStaticShell(inputs, ctx, rootParams, fallbackRouteParams,
|
|
|
3938
4097
|
const { componentMod: ComponentMod, renderOpts } = ctx;
|
|
3939
4098
|
const loaderTree = ComponentMod.routeModule.userland.loaderTree;
|
|
3940
4099
|
const { accumulatedChunks, stageEndTimes } = inputs;
|
|
3941
|
-
const { staticChunks, runtimeChunks, dynamicChunks } = accumulatedChunks;
|
|
3942
4100
|
const allowEmptyStaticShell = (renderOpts.allowEmptyStaticShell ?? false) || await (0, _instantconfig.isPageAllowedToBlock)(loaderTree);
|
|
3943
|
-
const
|
|
4101
|
+
const prefetchMode = await getPrefetchingModeForPage(renderOpts, loaderTree);
|
|
4102
|
+
const ensureStaticLevel = await (0, _ensurestatic.resolveEnsureStaticLevel)(loaderTree, prefetchMode === 2);
|
|
4103
|
+
const runtimeResult = await validateStaticShellAtStage(_stagedrendering.RenderStage.PrefetchRuntime, accumulatedChunks, debugChunks, stageEndTimes, rootParams, fallbackRouteParams, ensureStaticLevel, allowEmptyStaticShell, ctx, hmrRefreshHash, validationAbortSignal);
|
|
3944
4104
|
if (runtimeResult.length > 0) {
|
|
3945
|
-
debug == null ? void 0 : debug(`❌ Failed - ${runtimeResult.length} errors from
|
|
4105
|
+
debug == null ? void 0 : debug(`❌ Failed - ${runtimeResult.length} errors from PrefetchRuntime stage`);
|
|
3946
4106
|
// We have something to report from the runtime validation
|
|
3947
4107
|
// We can skip the rest
|
|
3948
4108
|
return runtimeResult;
|
|
@@ -3950,7 +4110,7 @@ async function validateStaticShell(inputs, ctx, rootParams, fallbackRouteParams,
|
|
|
3950
4110
|
if (!await (0, _devvalidationscheduler.yieldToForegroundRequest)(validationAbortSignal)) {
|
|
3951
4111
|
return [];
|
|
3952
4112
|
}
|
|
3953
|
-
const staticResult = await
|
|
4113
|
+
const staticResult = await validateStaticShellAtStage(_stagedrendering.RenderStage.Static, accumulatedChunks, debugChunks, stageEndTimes, rootParams, fallbackRouteParams, ensureStaticLevel, allowEmptyStaticShell, ctx, hmrRefreshHash, validationAbortSignal);
|
|
3954
4114
|
if (staticResult.length > 0) {
|
|
3955
4115
|
debug == null ? void 0 : debug(`❌ Failed - ${staticResult.length} errors from static stage`);
|
|
3956
4116
|
// We have something to report from the static validation
|
|
@@ -3986,9 +4146,9 @@ async function warmupClientModulesForStagedValidation(storeType, partialServerCh
|
|
|
3986
4146
|
// is module loading, which has it's own cache signal
|
|
3987
4147
|
cacheSignal: null,
|
|
3988
4148
|
dynamicTracking: null,
|
|
3989
|
-
revalidate:
|
|
3990
|
-
expire:
|
|
3991
|
-
stale:
|
|
4149
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
4150
|
+
expire: _constants2.INFINITE_CACHE,
|
|
4151
|
+
stale: _constants2.INFINITE_CACHE,
|
|
3992
4152
|
tags: [
|
|
3993
4153
|
...implicitTags.tags
|
|
3994
4154
|
],
|
|
@@ -4011,9 +4171,9 @@ async function warmupClientModulesForStagedValidation(storeType, partialServerCh
|
|
|
4011
4171
|
// is module loading, which has it's own cache signal
|
|
4012
4172
|
cacheSignal: null,
|
|
4013
4173
|
dynamicTracking: null,
|
|
4014
|
-
revalidate:
|
|
4015
|
-
expire:
|
|
4016
|
-
stale:
|
|
4174
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
4175
|
+
expire: _constants2.INFINITE_CACHE,
|
|
4176
|
+
stale: _constants2.INFINITE_CACHE,
|
|
4017
4177
|
tags: [
|
|
4018
4178
|
...implicitTags.tags
|
|
4019
4179
|
],
|
|
@@ -4082,13 +4242,17 @@ async function warmupClientModulesForStagedValidation(storeType, partialServerCh
|
|
|
4082
4242
|
});
|
|
4083
4243
|
// This is mostly needed for dynamic `import()`s in client components.
|
|
4084
4244
|
// Promises passed to client were already awaited above (assuming that they came from cached functions)
|
|
4085
|
-
const cacheSignal = new _cachesignal.CacheSignal();
|
|
4245
|
+
const cacheSignal = new _cachesignal.CacheSignal(null);
|
|
4086
4246
|
(0, _trackmoduleloadingexternal.trackPendingModules)(cacheSignal);
|
|
4087
4247
|
await cacheSignal.cacheReady();
|
|
4088
4248
|
_workunitasyncstorageexternal.workUnitAsyncStorage.run(initialClientPrerenderStore, initialClientReactController.abort.bind(initialClientReactController));
|
|
4089
4249
|
}
|
|
4090
|
-
async function
|
|
4250
|
+
async function validateStaticShellAtStage(stage, accumulatedChunks, debugChunks, stageEndTimes, rootParams, fallbackRouteParams, ensureStaticLevel, allowEmptyStaticShell, ctx, hmrRefreshHash, validationAbortSignal) {
|
|
4251
|
+
const debug = process.env.NEXT_PRIVATE_DEBUG_VALIDATION === '1' ? console.log : undefined;
|
|
4091
4252
|
const { implicitTags, nonce, workStore } = ctx;
|
|
4253
|
+
const dynamicHoleKind = stage === _stagedrendering.RenderStage.Static ? _dynamicrendering.DynamicHoleKind.Runtime : _dynamicrendering.DynamicHoleKind.Dynamic;
|
|
4254
|
+
const isFallbackShell = false;
|
|
4255
|
+
const stageIsPartial = accumulatedChunks[stage].length < accumulatedChunks[_stagedrendering.RenderStage.Dynamic].length;
|
|
4092
4256
|
const clientDynamicTracking = (0, _dynamicrendering.createDynamicTrackingState)(false //isDebugDynamicAccesses
|
|
4093
4257
|
);
|
|
4094
4258
|
const clientReactController = new AbortController();
|
|
@@ -4110,9 +4274,9 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4110
4274
|
// No APIs require a cacheSignal through the workUnitStore during the HTML prerender
|
|
4111
4275
|
cacheSignal: null,
|
|
4112
4276
|
dynamicTracking: clientDynamicTracking,
|
|
4113
|
-
revalidate:
|
|
4114
|
-
expire:
|
|
4115
|
-
stale:
|
|
4277
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
4278
|
+
expire: _constants2.INFINITE_CACHE,
|
|
4279
|
+
stale: _constants2.INFINITE_CACHE,
|
|
4116
4280
|
tags: [
|
|
4117
4281
|
...implicitTags.tags
|
|
4118
4282
|
],
|
|
@@ -4123,15 +4287,16 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4123
4287
|
varyParamsAccumulator: null
|
|
4124
4288
|
};
|
|
4125
4289
|
const dynamicValidation = (0, _dynamicrendering.createDynamicValidationState)();
|
|
4126
|
-
const serverStream = (0, _streamutils.createNodeStreamWithLateRelease)(
|
|
4290
|
+
const serverStream = (0, _streamutils.createNodeStreamWithLateRelease)(accumulatedChunks[stage], accumulatedChunks[_stagedrendering.RenderStage.Dynamic], clientReactSignal);
|
|
4127
4291
|
const debugChannelClient = debugChunks ? (0, _streamutils.createNodeStreamWithLateRelease)(debugChunks, debugChunks, clientReactSignal) : undefined;
|
|
4292
|
+
debug == null ? void 0 : debug(`Validating static shell at: ${_stagedrendering.RenderStage[stage]} (partial: ${stageIsPartial}, static level: ${_ensurestatic.EnsureStaticLevel[ensureStaticLevel]})`);
|
|
4128
4293
|
try {
|
|
4129
4294
|
let { prelude: unprocessedPrelude } = await (0, _apprenderrenderutils.runInSequentialTasks)(()=>{
|
|
4130
4295
|
const pendingFinalClientResult = _workunitasyncstorageexternal.workUnitAsyncStorage.run(finalClientPrerenderStore, _streamops.getClientPrerender, // eslint-disable-next-line @next/internal/no-ambiguous-jsx -- React Client
|
|
4131
4296
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(App, {
|
|
4132
4297
|
reactServerStream: serverStream,
|
|
4133
4298
|
reactDebugStream: debugChannelClient,
|
|
4134
|
-
debugEndTime:
|
|
4299
|
+
debugEndTime: stageEndTimes[stage],
|
|
4135
4300
|
preinitScripts: preinitScripts,
|
|
4136
4301
|
ServerInsertedHTMLProvider: ServerInsertedHTMLProvider,
|
|
4137
4302
|
nonce: nonce,
|
|
@@ -4142,7 +4307,11 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4142
4307
|
if ((0, _dynamicrendering.isPrerenderInterruptedError)(err) || clientReactSignal.aborted) {
|
|
4143
4308
|
const componentStack = errorInfo.componentStack;
|
|
4144
4309
|
if (typeof componentStack === 'string') {
|
|
4145
|
-
|
|
4310
|
+
if (ensureStaticLevel === _ensurestatic.EnsureStaticLevel.Navigation) {
|
|
4311
|
+
(0, _dynamicrendering.trackDynamicAccessInStaticRoute)(err, workStore, componentStack, dynamicValidation, clientDynamicTracking, stageIsPartial, dynamicHoleKind);
|
|
4312
|
+
} else {
|
|
4313
|
+
(0, _dynamicrendering.trackDynamicHoleInStaticShell)(err, workStore, componentStack, dynamicValidation, clientDynamicTracking, dynamicHoleKind);
|
|
4314
|
+
}
|
|
4146
4315
|
}
|
|
4147
4316
|
return;
|
|
4148
4317
|
}
|
|
@@ -4167,11 +4336,22 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4167
4336
|
_workunitasyncstorageexternal.workUnitAsyncStorage.run(finalClientPrerenderStore, clientReactController.abort.bind(clientReactController));
|
|
4168
4337
|
});
|
|
4169
4338
|
const { preludeIsEmpty } = await (0, _streamops.processPrelude)(unprocessedPrelude);
|
|
4170
|
-
|
|
4339
|
+
const preludeState = preludeIsEmpty ? _dynamicrendering.PreludeState.Empty : _dynamicrendering.PreludeState.Full;
|
|
4340
|
+
if (ensureStaticLevel === _ensurestatic.EnsureStaticLevel.Navigation) {
|
|
4341
|
+
return (0, _dynamicrendering.getDisallowedReasonsInStaticRoute)(workStore, preludeState, dynamicValidation, null, isFallbackShell, allowEmptyStaticShell, stageIsPartial);
|
|
4342
|
+
} else {
|
|
4343
|
+
return (0, _dynamicrendering.getStaticShellDisallowedDynamicReasons)(workStore, preludeState, dynamicValidation, allowEmptyStaticShell);
|
|
4344
|
+
}
|
|
4171
4345
|
} catch (thrownValue) {
|
|
4172
4346
|
// Even if the root errors we still want to report any cache components errors
|
|
4173
4347
|
// that were discovered before the root errored.
|
|
4174
|
-
|
|
4348
|
+
const preludeState = _dynamicrendering.PreludeState.Errored;
|
|
4349
|
+
let errors;
|
|
4350
|
+
if (ensureStaticLevel === _ensurestatic.EnsureStaticLevel.Navigation) {
|
|
4351
|
+
errors = (0, _dynamicrendering.getDisallowedReasonsInStaticRoute)(workStore, preludeState, dynamicValidation, null, isFallbackShell, allowEmptyStaticShell, stageIsPartial);
|
|
4352
|
+
} else {
|
|
4353
|
+
errors = (0, _dynamicrendering.getStaticShellDisallowedDynamicReasons)(workStore, preludeState, dynamicValidation, allowEmptyStaticShell);
|
|
4354
|
+
}
|
|
4175
4355
|
if (process.env.NEXT_DEBUG_BUILD || process.env.__NEXT_VERBOSE_LOGGING) {
|
|
4176
4356
|
errors.unshift('During dynamic validation the root of the page errored. The next logged error is the thrown value. It may be a duplicate of errors reported during the normal development mode render.', thrownValue);
|
|
4177
4357
|
}
|
|
@@ -4181,8 +4361,8 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4181
4361
|
/**
|
|
4182
4362
|
* Validates instant configs by iterating URL depths from deepest to
|
|
4183
4363
|
* shallowest. At each depth, builds a combined payload where segments
|
|
4184
|
-
* above the boundary use Dynamic stage (already mounted) and segments
|
|
4185
|
-
* below use
|
|
4364
|
+
* above the boundary use the Dynamic stage (already mounted) and segments
|
|
4365
|
+
* below use the stage that corresponds to what was prefetched. If the new subtree
|
|
4186
4366
|
* contains any `instant` configs, the payload is rendered to
|
|
4187
4367
|
* detect dynamic holes without Suspense.
|
|
4188
4368
|
*/ async function validateInstantConfigs(prefetchMode, accumulatedChunks, debugChunks, startTime, stageEndTimes, rootParams, fallbackRouteParams, ctx, hmrRefreshHash, validationSamples, devRenderDidError, validationAbortSignal) {
|
|
@@ -4190,40 +4370,149 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4190
4370
|
const { createCombinedPayloadAtDepth, createCombinedPayloadStream, collectStagedSegmentData, discoverValidationDepths, ValidationPrefetchKind } = ctx.componentMod.InstantValidation();
|
|
4191
4371
|
const { createValidationSampleTracking } = require('./instant-validation/instant-samples');
|
|
4192
4372
|
debug == null ? void 0 : debug('\nStarting depth-based instant validation...');
|
|
4193
|
-
|
|
4373
|
+
let prefetchKind;
|
|
4374
|
+
switch(prefetchMode){
|
|
4375
|
+
case 2:
|
|
4376
|
+
{
|
|
4377
|
+
const ensureStaticLevel = await (0, _ensurestatic.resolveEnsureStaticLevel)(ctx.componentMod.routeModule.userland.loaderTree, /* partialPrefetching */ true);
|
|
4378
|
+
prefetchKind = ensureStaticLevel >= _ensurestatic.EnsureStaticLevel.Shell ? ValidationPrefetchKind.StaticAppShell : ValidationPrefetchKind.RuntimeAppShell;
|
|
4379
|
+
break;
|
|
4380
|
+
}
|
|
4381
|
+
case 1:
|
|
4382
|
+
{
|
|
4383
|
+
prefetchKind = ValidationPrefetchKind.LegacySpeculative;
|
|
4384
|
+
break;
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4194
4387
|
const loaderTree = ctx.componentMod.routeModule.userland.loaderTree;
|
|
4195
4388
|
const clientReferenceManifest = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
4196
4389
|
const renderFlightStream = process.env.__NEXT_USE_NODE_STREAMS ? _streamops.renderToNodeFlightStream : _streamops.renderToWebFlightStream;
|
|
4197
4390
|
const createDebugChannel = process.env.__NEXT_USE_NODE_STREAMS ? _debugchannelserver.createNodeDebugChannel : _debugchannelserver.createWebDebugChannel;
|
|
4198
|
-
const { cache, payload: initialRscPayload } = await collectStagedSegmentData(prefetchKind, ctx.componentMod, renderFlightStream,
|
|
4199
|
-
[_stagedrendering.RenderStage.Static]: accumulatedChunks.staticChunks,
|
|
4200
|
-
[_stagedrendering.RenderStage.ShellRuntime]: accumulatedChunks.shellRuntimeChunks,
|
|
4201
|
-
[_stagedrendering.RenderStage.Runtime]: accumulatedChunks.runtimeChunks,
|
|
4202
|
-
[_stagedrendering.RenderStage.Dynamic]: accumulatedChunks.dynamicChunks
|
|
4203
|
-
}, debugChunks, startTime, stageEndTimes, clientReferenceManifest, createDebugChannel);
|
|
4391
|
+
const { cache, payload: initialRscPayload } = await collectStagedSegmentData(prefetchKind, ctx.componentMod, renderFlightStream, accumulatedChunks, debugChunks, startTime, stageEndTimes, clientReferenceManifest, createDebugChannel);
|
|
4204
4392
|
const { implicitTags, nonce, workStore, isDebugChannelEnabled } = ctx;
|
|
4205
|
-
|
|
4206
|
-
|
|
4393
|
+
/**
|
|
4394
|
+
* Typescript helper to ensure that all stages in `stageOrder` have an entry in `holeResolution`.
|
|
4395
|
+
* This is more constrained than the actual `ValidationSequence` type.
|
|
4396
|
+
* */ const defineValidationSequence = (sequence)=>{
|
|
4397
|
+
return sequence;
|
|
4398
|
+
};
|
|
4399
|
+
// TODO: these sequences are effectively duplicated in `collectStagedSegmentData`
|
|
4400
|
+
// in `instant-validation.tsx`. We should have one source of truth for them
|
|
4401
|
+
const validationSequences = {
|
|
4402
|
+
[ValidationPrefetchKind.StaticAppShell]: defineValidationSequence({
|
|
4403
|
+
stageOrder: [
|
|
4404
|
+
_stagedrendering.RenderStage.ShellStatic,
|
|
4405
|
+
_stagedrendering.RenderStage.PrefetchStatic_prefetchApi,
|
|
4406
|
+
_stagedrendering.RenderStage.PrefetchStatic,
|
|
4407
|
+
_stagedrendering.RenderStage.NavigationStatic,
|
|
4408
|
+
_stagedrendering.RenderStage.PrefetchRuntime,
|
|
4409
|
+
_stagedrendering.RenderStage.Dynamic
|
|
4410
|
+
],
|
|
4411
|
+
holeResolution: {
|
|
4412
|
+
[_stagedrendering.RenderStage.ShellStatic]: null,
|
|
4413
|
+
[_stagedrendering.RenderStage.PrefetchStatic_prefetchApi]: _dynamicrendering.DynamicHoleKind.Prefetch,
|
|
4414
|
+
[_stagedrendering.RenderStage.PrefetchStatic]: _dynamicrendering.DynamicHoleKind.Link,
|
|
4415
|
+
[_stagedrendering.RenderStage.NavigationStatic]: _dynamicrendering.DynamicHoleKind.Navigation,
|
|
4416
|
+
[_stagedrendering.RenderStage.PrefetchRuntime]: _dynamicrendering.DynamicHoleKind.Runtime,
|
|
4417
|
+
[_stagedrendering.RenderStage.Dynamic]: _dynamicrendering.DynamicHoleKind.Dynamic
|
|
4418
|
+
}
|
|
4419
|
+
}),
|
|
4420
|
+
[ValidationPrefetchKind.RuntimeAppShell]: defineValidationSequence({
|
|
4421
|
+
stageOrder: [
|
|
4422
|
+
_stagedrendering.RenderStage.ShellRuntime,
|
|
4423
|
+
_stagedrendering.RenderStage.PrefetchRuntime_prefetchApi,
|
|
4424
|
+
_stagedrendering.RenderStage.PrefetchRuntime,
|
|
4425
|
+
_stagedrendering.RenderStage.NavigationRuntime,
|
|
4426
|
+
_stagedrendering.RenderStage.Dynamic
|
|
4427
|
+
],
|
|
4428
|
+
holeResolution: {
|
|
4429
|
+
[_stagedrendering.RenderStage.ShellRuntime]: null,
|
|
4430
|
+
[_stagedrendering.RenderStage.PrefetchRuntime_prefetchApi]: _dynamicrendering.DynamicHoleKind.Prefetch,
|
|
4431
|
+
[_stagedrendering.RenderStage.PrefetchRuntime]: _dynamicrendering.DynamicHoleKind.Link,
|
|
4432
|
+
[_stagedrendering.RenderStage.NavigationRuntime]: _dynamicrendering.DynamicHoleKind.Navigation,
|
|
4433
|
+
[_stagedrendering.RenderStage.Dynamic]: _dynamicrendering.DynamicHoleKind.Dynamic
|
|
4434
|
+
}
|
|
4435
|
+
}),
|
|
4436
|
+
[ValidationPrefetchKind.LegacySpeculative]: defineValidationSequence({
|
|
4437
|
+
stageOrder: [
|
|
4438
|
+
_stagedrendering.RenderStage.Static,
|
|
4439
|
+
_stagedrendering.RenderStage.PrefetchRuntime,
|
|
4440
|
+
_stagedrendering.RenderStage.Dynamic
|
|
4441
|
+
],
|
|
4442
|
+
holeResolution: {
|
|
4443
|
+
[_stagedrendering.RenderStage.Static]: null,
|
|
4444
|
+
[_stagedrendering.RenderStage.PrefetchRuntime]: _dynamicrendering.DynamicHoleKind.Runtime,
|
|
4445
|
+
[_stagedrendering.RenderStage.Dynamic]: _dynamicrendering.DynamicHoleKind.Dynamic
|
|
4446
|
+
}
|
|
4447
|
+
})
|
|
4448
|
+
};
|
|
4449
|
+
const validationSequence = validationSequences[prefetchKind];
|
|
4450
|
+
const initialRenderStage = validationSequence.stageOrder[0];
|
|
4451
|
+
// When narrowing the cause of a dynamic hole, we need to find the first stage it occurs in.
|
|
4452
|
+
// We do this by starting at the end and eliminating later stages, so we go in reverse.
|
|
4453
|
+
const retryRenderStages = validationSequences[prefetchKind].stageOrder.slice(1, -1) // Exclude first stage and Dynamic
|
|
4454
|
+
.reverse();
|
|
4455
|
+
function getDynamicHoleKindForSegmentStage(stage) {
|
|
4456
|
+
// We report holes in reverse order, i.e. holes in Stage N are only reported
|
|
4457
|
+
// if Stage N+1 didn't have any holes. That means that if we report a hole from Stage N,
|
|
4458
|
+
// it has to be caused by data that would've resolved in Stage N+1.
|
|
4459
|
+
// So, the dynamic hole kind corresponds to the *next* logical stage.
|
|
4460
|
+
const { stageOrder, holeResolution } = validationSequence;
|
|
4461
|
+
const nextStage = stageOrder[stageOrder.indexOf(stage) + 1];
|
|
4462
|
+
const holeKind = holeResolution[nextStage];
|
|
4463
|
+
// NOTE: `defineValidationSequence` should prevent `undefined` here, because
|
|
4464
|
+
// we asserted on the type level that each `stage` either has a `holeKind` or `null`
|
|
4465
|
+
if (holeKind === undefined) {
|
|
4466
|
+
throw new _invarianterror.InvariantError(`${_stagedrendering.RenderStage[stage]} segments should not be used in ${ValidationPrefetchKind[prefetchKind]} prefetches`);
|
|
4467
|
+
}
|
|
4468
|
+
// The initial stage can have `null`. We should not see it here
|
|
4469
|
+
if (holeKind === null) {
|
|
4470
|
+
throw new _invarianterror.InvariantError(`${_stagedrendering.RenderStage[stage]} segments do not unblock new data in ${ValidationPrefetchKind[prefetchKind]} prefetches`);
|
|
4471
|
+
}
|
|
4472
|
+
return holeKind;
|
|
4207
4473
|
}
|
|
4208
|
-
async function
|
|
4474
|
+
async function validateAtDepth(depth, groupDepthForValidation) {
|
|
4209
4475
|
if (validationAbortSignal == null ? void 0 : validationAbortSignal.aborted) {
|
|
4210
4476
|
return null;
|
|
4211
4477
|
}
|
|
4478
|
+
// First attempt. If we have any dynamic holes, they will be ambiguous.
|
|
4479
|
+
const initialBoundaryState = (0, _boundarytracking.createValidationBoundaryTracking)();
|
|
4480
|
+
const initialResult = await validateOrRetryAtDepth(depth, groupDepthForValidation, initialBoundaryState, null);
|
|
4481
|
+
// If the prerender produced no real errors at this depth — either an
|
|
4482
|
+
// empty array (clean) or a deferred-only result (Error/AggregateError
|
|
4483
|
+
// representing a missing-boundary fallback) — there's nothing to
|
|
4484
|
+
// discriminate. Pass it up so the outer loop can hold any deferred
|
|
4485
|
+
// fallback back until every depth has been tried.
|
|
4486
|
+
if (!Array.isArray(initialResult) || initialResult.length === 0) {
|
|
4487
|
+
return initialResult;
|
|
4488
|
+
}
|
|
4489
|
+
// We do a followup validation using a payload using later stages to determine
|
|
4490
|
+
// what kind of data caused the hole -- link/navigation/dynamic in app shells,
|
|
4491
|
+
// or runtime/dynamic in static shells.
|
|
4492
|
+
for (const retryStage of retryRenderStages){
|
|
4493
|
+
if (validationAbortSignal !== undefined && !await (0, _devvalidationscheduler.yieldToForegroundRequest)(validationAbortSignal)) {
|
|
4494
|
+
return [];
|
|
4495
|
+
}
|
|
4496
|
+
const narrowedResult = await validateOrRetryAtDepth(depth, groupDepthForValidation, (0, _boundarytracking.createValidationBoundaryTracking)(initialBoundaryState), retryStage);
|
|
4497
|
+
if (Array.isArray(narrowedResult) && narrowedResult.length > 0) {
|
|
4498
|
+
// The narrowed validation found errors to report.
|
|
4499
|
+
return narrowedResult;
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
// If we didn't return some other errors at this point the only thing to return is this validation's result
|
|
4503
|
+
return initialResult;
|
|
4504
|
+
}
|
|
4505
|
+
async function validateOrRetryAtDepth(depth, groupDepthForValidation, boundaryState, overrideStageForPartialSegments = null) {
|
|
4506
|
+
// If we're not overriding the stage, we're in the first stage.
|
|
4507
|
+
const stage = overrideStageForPartialSegments ?? initialRenderStage;
|
|
4508
|
+
const dynamicHoleKind = getDynamicHoleKindForSegmentStage(stage);
|
|
4509
|
+
debug == null ? void 0 : debug(` trying ${_stagedrendering.RenderStage[stage]} (hole: ${_dynamicrendering.DynamicHoleKind[dynamicHoleKind]})`);
|
|
4212
4510
|
const extraChunksController = new AbortController();
|
|
4213
4511
|
const extraChunksSignal = validationAbortSignal === undefined ? extraChunksController.signal : AbortSignal.any([
|
|
4214
4512
|
extraChunksController.signal,
|
|
4215
4513
|
validationAbortSignal
|
|
4216
4514
|
]);
|
|
4217
|
-
const
|
|
4218
|
-
let useRuntimeStageForPartialSegments = false;
|
|
4219
|
-
if (previousBoundaryState) {
|
|
4220
|
-
// We're doing a followup render to better discriminate error types
|
|
4221
|
-
useRuntimeStageForPartialSegments = true;
|
|
4222
|
-
for (const [id, filePath] of previousBoundaryState.requiredIds){
|
|
4223
|
-
boundaryState.requiredIds.set(id, filePath);
|
|
4224
|
-
}
|
|
4225
|
-
}
|
|
4226
|
-
const payloadResult = await createCombinedPayloadAtDepth(prefetchKind, initialRscPayload, cache, loaderTree, ctx.getDynamicParamFromSegment, ctx.query, depth, groupDepthForValidation, extraChunksSignal, boundaryState, clientReferenceManifest, useRuntimeStageForPartialSegments);
|
|
4515
|
+
const payloadResult = await createCombinedPayloadAtDepth(prefetchKind, initialRscPayload, cache, loaderTree, ctx.getDynamicParamFromSegment, depth, groupDepthForValidation, extraChunksSignal, boundaryState, clientReferenceManifest, overrideStageForPartialSegments);
|
|
4227
4516
|
if (payloadResult === null) {
|
|
4228
4517
|
return null;
|
|
4229
4518
|
}
|
|
@@ -4248,9 +4537,9 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4248
4537
|
controller: reactController,
|
|
4249
4538
|
cacheSignal: null,
|
|
4250
4539
|
dynamicTracking: clientDynamicTracking,
|
|
4251
|
-
revalidate:
|
|
4252
|
-
expire:
|
|
4253
|
-
stale:
|
|
4540
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
4541
|
+
expire: _constants2.INFINITE_CACHE,
|
|
4542
|
+
stale: _constants2.INFINITE_CACHE,
|
|
4254
4543
|
tags: [
|
|
4255
4544
|
...implicitTags.tags
|
|
4256
4545
|
],
|
|
@@ -4262,20 +4551,6 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4262
4551
|
validationSamples,
|
|
4263
4552
|
validationSampleTracking
|
|
4264
4553
|
};
|
|
4265
|
-
let dynamicHoleKind;
|
|
4266
|
-
switch(prefetchKind){
|
|
4267
|
-
case ValidationPrefetchKind.Shell:
|
|
4268
|
-
{
|
|
4269
|
-
dynamicHoleKind = payloadResult.hasAmbiguousErrors ? _dynamicrendering.DynamicHoleKind.Link : _dynamicrendering.DynamicHoleKind.Dynamic;
|
|
4270
|
-
break;
|
|
4271
|
-
}
|
|
4272
|
-
case ValidationPrefetchKind.LegacySpeculative:
|
|
4273
|
-
{
|
|
4274
|
-
dynamicHoleKind = payloadResult.hasAmbiguousErrors ? _dynamicrendering.DynamicHoleKind.Runtime : _dynamicrendering.DynamicHoleKind.Dynamic;
|
|
4275
|
-
break;
|
|
4276
|
-
}
|
|
4277
|
-
}
|
|
4278
|
-
let result;
|
|
4279
4554
|
try {
|
|
4280
4555
|
const { prelude: unprocessedPrelude } = await (0, _apprenderrenderutils.runInSequentialTasks)(()=>{
|
|
4281
4556
|
const pendingResult = _workunitasyncstorageexternal.workUnitAsyncStorage.run(prerenderStore, _streamops.getClientPrerender, // eslint-disable-next-line @next/internal/no-ambiguous-jsx -- React Client
|
|
@@ -4289,6 +4564,14 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4289
4564
|
images: ctx.renderOpts.images
|
|
4290
4565
|
}), {
|
|
4291
4566
|
signal: reactSignal,
|
|
4567
|
+
onBrowserBailout: (err, errorInfo)=>{
|
|
4568
|
+
if (!reactSignal.aborted) {
|
|
4569
|
+
const componentStack = errorInfo.componentStack;
|
|
4570
|
+
if (typeof componentStack === 'string') {
|
|
4571
|
+
(0, _dynamicrendering.trackThrownErrorInNavigation)(workStore, instantValidationState, err, componentStack, ctx.reactBrowserBailout);
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
},
|
|
4292
4575
|
onError: (err, errorInfo)=>{
|
|
4293
4576
|
if ((0, _dynamicrendering.isPrerenderInterruptedError)(err) || reactSignal.aborted) {
|
|
4294
4577
|
const componentStack = errorInfo.componentStack;
|
|
@@ -4311,7 +4594,7 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4311
4594
|
}
|
|
4312
4595
|
}
|
|
4313
4596
|
}
|
|
4314
|
-
(0, _dynamicrendering.trackThrownErrorInNavigation)(workStore, instantValidationState, errorForDisplay, componentStack);
|
|
4597
|
+
(0, _dynamicrendering.trackThrownErrorInNavigation)(workStore, instantValidationState, errorForDisplay, componentStack, ctx.reactBrowserBailout);
|
|
4315
4598
|
}
|
|
4316
4599
|
}
|
|
4317
4600
|
if ((0, _reactlargeshellerror.isReactLargeShellError)(err)) {
|
|
@@ -4331,32 +4614,10 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4331
4614
|
_workunitasyncstorageexternal.workUnitAsyncStorage.run(prerenderStore, reactController.abort.bind(reactController));
|
|
4332
4615
|
});
|
|
4333
4616
|
const { preludeIsEmpty } = await (0, _streamops.processPrelude)(unprocessedPrelude);
|
|
4334
|
-
|
|
4617
|
+
return (0, _dynamicrendering.getNavigationDisallowedDynamicReasons)(workStore, preludeIsEmpty ? _dynamicrendering.PreludeState.Empty : _dynamicrendering.PreludeState.Full, instantValidationState, validationSampleTracking, boundaryState, devRenderDidError);
|
|
4335
4618
|
} catch (thrownValue) {
|
|
4336
|
-
|
|
4337
|
-
}
|
|
4338
|
-
// If the prerender produced no real errors at this depth — either an
|
|
4339
|
-
// empty array (clean) or a deferred-only result (Error/AggregateError
|
|
4340
|
-
// representing a missing-boundary fallback) — there's nothing to
|
|
4341
|
-
// discriminate. Pass it up so the outer loop can hold any deferred
|
|
4342
|
-
// fallback back until every depth has been tried.
|
|
4343
|
-
if (!Array.isArray(result) || result.length === 0) {
|
|
4344
|
-
return result;
|
|
4619
|
+
return (0, _dynamicrendering.getNavigationDisallowedDynamicReasons)(workStore, _dynamicrendering.PreludeState.Errored, instantValidationState, validationSampleTracking, boundaryState, devRenderDidError);
|
|
4345
4620
|
}
|
|
4346
|
-
if (previousBoundaryState === null && payloadResult.hasAmbiguousErrors) {
|
|
4347
|
-
// This is the first validation attempt. we prepared a payload where dynamic holes might be runtime data dependencies
|
|
4348
|
-
// or dynamic data dependencies. We do a followup validation using a payload with only Runtime segments to discriminate
|
|
4349
|
-
if (validationAbortSignal !== undefined && !await (0, _devvalidationscheduler.yieldToForegroundRequest)(validationAbortSignal)) {
|
|
4350
|
-
return [];
|
|
4351
|
-
}
|
|
4352
|
-
const dynamicOnlyResult = await validateAtDepthImpl(depth, groupDepthForValidation, boundaryState);
|
|
4353
|
-
if (Array.isArray(dynamicOnlyResult) && dynamicOnlyResult.length > 0) {
|
|
4354
|
-
// The dynamic errors only validation found errors to report so we favor those
|
|
4355
|
-
return dynamicOnlyResult;
|
|
4356
|
-
}
|
|
4357
|
-
}
|
|
4358
|
-
// If we didn't return some other errors at this point the only thing to return is this validation's result
|
|
4359
|
-
return result;
|
|
4360
4621
|
}
|
|
4361
4622
|
// Discover validation depth bounds from the LoaderTree. The array
|
|
4362
4623
|
// length is the max URL depth; each entry is the max group depth
|
|
@@ -4422,17 +4683,18 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4422
4683
|
* - both renders are abortable: if we know that we can't use a stream, we can just
|
|
4423
4684
|
* throw it away, we don't have to render a complete result.
|
|
4424
4685
|
* - We don't need to tee the stream, we only care about accumulating chunks.
|
|
4425
|
-
*/ async function renderWithRestartOnCacheMissInValidation(prefetchMode, ctx, initialRequestStore, createRequestStore, getPayload, createOnError, prefilledDataCache) {
|
|
4686
|
+
*/ async function renderWithRestartOnCacheMissInValidation(prefetchMode, ensureStaticLevel, ctx, initialRequestStore, createRequestStore, getPayload, createOnError, prefilledDataCache) {
|
|
4426
4687
|
const { componentMod: ComponentMod } = ctx;
|
|
4427
|
-
const shouldRenderAppShell = prefetchMode === 2;
|
|
4428
4688
|
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
4429
4689
|
const renderFlightStream = process.env.__NEXT_USE_NODE_STREAMS ? _streamops.renderToNodeFlightStream : _streamops.renderToWebFlightStream;
|
|
4690
|
+
const needsRuntimeAppShell = prefetchMode === 2 && ensureStaticLevel === _ensurestatic.EnsureStaticLevel.None;
|
|
4430
4691
|
let startTime = -Infinity;
|
|
4431
4692
|
let requestStore = initialRequestStore;
|
|
4432
4693
|
//===============================================
|
|
4433
4694
|
// Initial render (prospective — may warm caches)
|
|
4434
4695
|
//===============================================
|
|
4435
|
-
const
|
|
4696
|
+
const immediateTracker = new _fastsetimmediateexternal.ImmediateTracker();
|
|
4697
|
+
const cacheSignal = new _cachesignal.CacheSignal(immediateTracker);
|
|
4436
4698
|
(0, _trackmoduleloadingexternal.trackPendingModules)(cacheSignal);
|
|
4437
4699
|
// The prerender we rean before the validation probably already filled some caches,
|
|
4438
4700
|
// so we want to save work and re-use them.
|
|
@@ -4448,7 +4710,8 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4448
4710
|
});
|
|
4449
4711
|
requestStore.resumeDataCache = prerenderResumeDataCache;
|
|
4450
4712
|
requestStore.stagedRendering = initialStageController;
|
|
4451
|
-
requestStore.
|
|
4713
|
+
requestStore.needsRuntimeShell = needsRuntimeAppShell;
|
|
4714
|
+
requestStore.hasIncompatibleShellContent = false;
|
|
4452
4715
|
requestStore.cacheSignal = cacheSignal;
|
|
4453
4716
|
requestStore.asyncApiPromises = createAsyncApiPromises(initialStageController, requestStore.cookies, requestStore.mutableCookies, requestStore.headers);
|
|
4454
4717
|
// We don't set `requestStore.controller and requestStore.renderSignal here.
|
|
@@ -4456,7 +4719,7 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4456
4719
|
// (after waiting for caches)
|
|
4457
4720
|
requestStore.controller = undefined;
|
|
4458
4721
|
requestStore.renderSignal = undefined;
|
|
4459
|
-
const initialRscPayload = await getPayload
|
|
4722
|
+
const initialRscPayload = await (0, _fastsetimmediateexternal.runWithNativeImmediateTracking)(immediateTracker, getPayload, requestStore);
|
|
4460
4723
|
const advanceStageIfNoCacheMiss = (stage)=>{
|
|
4461
4724
|
if (initialAbandonController.signal.aborted === true) {
|
|
4462
4725
|
return;
|
|
@@ -4466,7 +4729,7 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4466
4729
|
initialStageController.advanceStage(stage);
|
|
4467
4730
|
}
|
|
4468
4731
|
};
|
|
4469
|
-
const initialResult = await (0, _apprenderrenderutils.runInSequentialTasks
|
|
4732
|
+
const initialResult = await (0, _fastsetimmediateexternal.runWithNativeImmediateTracking)(immediateTracker, _apprenderrenderutils.runInSequentialTasks, ()=>{
|
|
4470
4733
|
initialStageController.advanceStage(_stagedrendering.RenderStage.ShellStatic);
|
|
4471
4734
|
startTime = performance.now() + performance.timeOrigin;
|
|
4472
4735
|
const stream = _workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, renderFlightStream, ComponentMod, initialRscPayload, clientModules, {
|
|
@@ -4486,15 +4749,7 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4486
4749
|
return {
|
|
4487
4750
|
accumulatedChunksPromise
|
|
4488
4751
|
};
|
|
4489
|
-
}, ()=>
|
|
4490
|
-
advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.Static);
|
|
4491
|
-
}, ()=>{
|
|
4492
|
-
advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.ShellRuntime);
|
|
4493
|
-
}, ()=>{
|
|
4494
|
-
advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.Runtime);
|
|
4495
|
-
}, ()=>{
|
|
4496
|
-
advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.Dynamic);
|
|
4497
|
-
});
|
|
4752
|
+
}, ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.PrefetchStatic_prefetchApi), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.PrefetchStatic), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.NavigationStatic), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.Static), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.ShellRuntime), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.PrefetchRuntime_prefetchApi), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.PrefetchRuntime), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.NavigationRuntime), ()=>advanceStageIfNoCacheMiss(_stagedrendering.RenderStage.Dynamic));
|
|
4498
4753
|
if (initialStageController.currentStage !== _stagedrendering.RenderStage.Abandoned) {
|
|
4499
4754
|
// No cache misses. Use the result as-is.
|
|
4500
4755
|
return {
|
|
@@ -4523,7 +4778,8 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4523
4778
|
});
|
|
4524
4779
|
requestStore.resumeDataCache = (0, _resumedatacache.createRenderResumeDataCache)(prerenderResumeDataCache);
|
|
4525
4780
|
requestStore.stagedRendering = finalStageController;
|
|
4526
|
-
requestStore.
|
|
4781
|
+
requestStore.needsRuntimeShell = needsRuntimeAppShell;
|
|
4782
|
+
requestStore.hasIncompatibleShellContent = false;
|
|
4527
4783
|
requestStore.cacheSignal = null;
|
|
4528
4784
|
requestStore.asyncApiPromises = createAsyncApiPromises(finalStageController, requestStore.cookies, requestStore.mutableCookies, requestStore.headers);
|
|
4529
4785
|
// Right now, we only abort for sync IO.
|
|
@@ -4551,7 +4807,7 @@ async function validateStagedShell(stageChunks, allServerChunks, debugChunks, de
|
|
|
4551
4807
|
return {
|
|
4552
4808
|
accumulatedChunksPromise
|
|
4553
4809
|
};
|
|
4554
|
-
}, ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.ShellRuntime), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.
|
|
4810
|
+
}, ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic_prefetchApi), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.Static), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.ShellRuntime), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.PrefetchRuntime_prefetchApi), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.PrefetchRuntime), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.NavigationRuntime), ()=>finalStageController.advanceStage(_stagedrendering.RenderStage.Dynamic));
|
|
4555
4811
|
return {
|
|
4556
4812
|
accumulatedChunksPromise: finalResult.accumulatedChunksPromise,
|
|
4557
4813
|
startTime,
|
|
@@ -4568,12 +4824,8 @@ async function validateInstantConfigsInBuild(ctx, prefilledDataCache) {
|
|
|
4568
4824
|
// before we shadow it.
|
|
4569
4825
|
success = await _workasyncstorageexternal.workAsyncStorage.exit(async ()=>validateInstantConfigsInBuildImpl(ctx, prefilledDataCache));
|
|
4570
4826
|
} catch (err) {
|
|
4571
|
-
console.error(
|
|
4827
|
+
console.error(new _invarianterror.InvariantError('An unexpected error occurred during instant validation', {
|
|
4572
4828
|
cause: err
|
|
4573
|
-
}), "__NEXT_ERROR_CODE", {
|
|
4574
|
-
value: "E1097",
|
|
4575
|
-
enumerable: false,
|
|
4576
|
-
configurable: true
|
|
4577
4829
|
}));
|
|
4578
4830
|
success = false;
|
|
4579
4831
|
}
|
|
@@ -4667,6 +4919,7 @@ async function validateInstantConfigInBuildWithSample(outerCtx, sample, allPossi
|
|
|
4667
4919
|
const { workStore: outerWorkStore } = outerCtx;
|
|
4668
4920
|
const loaderTree = outerCtx.componentMod.routeModule.userland.loaderTree;
|
|
4669
4921
|
const prefetchMode = await getPrefetchingModeForPage(outerCtx.renderOpts, loaderTree);
|
|
4922
|
+
const ensureStaticLevel = await (0, _ensurestatic.resolveEnsureStaticLevel)(loaderTree, prefetchMode === 2);
|
|
4670
4923
|
const route = outerWorkStore.route;
|
|
4671
4924
|
const { createCookiesFromSample, createHeadersFromSample, createDraftModeForValidation, createRelativeURLFromSamples, createValidationSampleTracking } = require('./instant-validation/instant-samples');
|
|
4672
4925
|
// TODO(instant-validation-build): it feels like this should happen higher up
|
|
@@ -4691,13 +4944,13 @@ async function validateInstantConfigInBuildWithSample(outerCtx, sample, allPossi
|
|
|
4691
4944
|
const { AfterContext } = require('../after/after-context');
|
|
4692
4945
|
// NOTE: Matching the field order in `createWorkStore` to avoid deopting.
|
|
4693
4946
|
const workStore = {
|
|
4694
|
-
isStaticGeneration: false,
|
|
4695
4947
|
page: outerWorkStore.page,
|
|
4696
4948
|
route: outerWorkStore.route,
|
|
4697
4949
|
requestStartTime: outerWorkStore.requestStartTime,
|
|
4698
4950
|
incrementalCache: outerWorkStore.incrementalCache,
|
|
4699
4951
|
cacheLifeProfiles: outerWorkStore.cacheLifeProfiles,
|
|
4700
4952
|
useCacheTimeout: outerWorkStore.useCacheTimeout,
|
|
4953
|
+
durableUseCacheEntries: outerWorkStore.durableUseCacheEntries,
|
|
4701
4954
|
staticPageGenerationTimeout: outerWorkStore.staticPageGenerationTimeout,
|
|
4702
4955
|
isBuildTimePrerendering: false,
|
|
4703
4956
|
fetchCache: outerWorkStore.fetchCache,
|
|
@@ -4725,6 +4978,7 @@ async function validateInstantConfigInBuildWithSample(outerCtx, sample, allPossi
|
|
|
4725
4978
|
refreshTagsByCacheKind: new Map(),
|
|
4726
4979
|
runInCleanSnapshot: outerWorkStore.runInCleanSnapshot,
|
|
4727
4980
|
shouldTrackFetchMetrics: false,
|
|
4981
|
+
clientComponentLoadTracker: undefined,
|
|
4728
4982
|
reactServerErrorsByDigest: new Map()
|
|
4729
4983
|
};
|
|
4730
4984
|
return _workasyncstorageexternal.workAsyncStorage.run(workStore, async ()=>{
|
|
@@ -4734,6 +4988,11 @@ async function validateInstantConfigInBuildWithSample(outerCtx, sample, allPossi
|
|
|
4734
4988
|
url: sampleUrlWithoutQuery,
|
|
4735
4989
|
renderOpts: outerCtx.renderOpts,
|
|
4736
4990
|
workStore,
|
|
4991
|
+
missingPrefetchHintPolicy: (0, _createtransporttreefromloadertree.getMissingPrefetchHintPolicy)(outerCtx.renderOpts.isBuildTimePrerendering ?? false, false, outerCtx.renderOpts.cacheComponents),
|
|
4992
|
+
renderCapabilities: {
|
|
4993
|
+
isPossiblyPartialResponse: false,
|
|
4994
|
+
supportsPerSegmentPrefetching: outerCtx.renderCapabilities.supportsPerSegmentPrefetching
|
|
4995
|
+
},
|
|
4737
4996
|
parsedRequestHeaders: outerCtx.parsedRequestHeaders,
|
|
4738
4997
|
getDynamicParamFromSegment,
|
|
4739
4998
|
interpolatedParams: sampleParams,
|
|
@@ -4794,8 +5053,9 @@ async function validateInstantConfigInBuildWithSample(outerCtx, sample, allPossi
|
|
|
4794
5053
|
// back to the original.
|
|
4795
5054
|
const onServerError = (0, _createerrorhandler.createReactServerErrorHandler)(true, true, workStore.reactServerErrorsByDigest, ()=>{} // Don't report anything here. If needed, it will be reported in the client render.
|
|
4796
5055
|
);
|
|
4797
|
-
const { accumulatedChunksPromise, startTime, stageController, requestStore: finalServerStore } = await renderWithRestartOnCacheMissInValidation(prefetchMode, validationCtx, createRequestStore(), createRequestStore, (requestStore)=>_workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, getRSCPayload, loaderTree, validationCtx, {
|
|
4798
|
-
is404: false
|
|
5056
|
+
const { accumulatedChunksPromise, startTime, stageController, requestStore: finalServerStore } = await renderWithRestartOnCacheMissInValidation(prefetchMode, ensureStaticLevel, validationCtx, createRequestStore(), createRequestStore, (requestStore)=>_workunitasyncstorageexternal.workUnitAsyncStorage.run(requestStore, getRSCPayload, loaderTree, validationCtx, {
|
|
5057
|
+
is404: false,
|
|
5058
|
+
isPrerendering: true
|
|
4799
5059
|
}), (signal)=>function onError(err) {
|
|
4800
5060
|
const digest = (0, _createerrorhandler.getDigestForWellKnownError)(err);
|
|
4801
5061
|
if (digest) {
|
|
@@ -4836,7 +5096,7 @@ async function validateInstantConfigInBuildWithSample(outerCtx, sample, allPossi
|
|
|
4836
5096
|
// the Dynamic stage, they're Runtime at best.
|
|
4837
5097
|
const warmupValidationSamplesTracking = createValidationSampleTracking();
|
|
4838
5098
|
const validationRenderCtx = toValidationRenderContext(validationCtx);
|
|
4839
|
-
await warmupClientModulesForStagedValidation('validation-client', accumulatedChunks.
|
|
5099
|
+
await warmupClientModulesForStagedValidation('validation-client', accumulatedChunks[_stagedrendering.RenderStage.Dynamic], accumulatedChunks[_stagedrendering.RenderStage.Dynamic], sampleRootParams, fallbackRouteParams, validationRenderCtx, validationSamples, warmupValidationSamplesTracking);
|
|
4840
5100
|
if (warmupValidationSamplesTracking.missingSampleErrors.length > 0) {
|
|
4841
5101
|
return warmupValidationSamplesTracking.missingSampleErrors;
|
|
4842
5102
|
}
|
|
@@ -4844,15 +5104,6 @@ async function validateInstantConfigInBuildWithSample(outerCtx, sample, allPossi
|
|
|
4844
5104
|
);
|
|
4845
5105
|
});
|
|
4846
5106
|
}
|
|
4847
|
-
/**
|
|
4848
|
-
* Determines whether we should generate static flight data.
|
|
4849
|
-
*/ // TODO: This helper used to exclude fallback route params. It now only checks
|
|
4850
|
-
// static generation inside prerenderToStream and can be removed. LOE: low.
|
|
4851
|
-
function shouldGenerateStaticFlightData(workStore) {
|
|
4852
|
-
const { isStaticGeneration } = workStore;
|
|
4853
|
-
if (!isStaticGeneration) return false;
|
|
4854
|
-
return true;
|
|
4855
|
-
}
|
|
4856
5107
|
async function continueStaticPrerenderWithInlinedData(htmlStream, reactServerResult, fallbackRouteParams, createInlinedDataStream, formState, nonce, getServerInsertedHTML, getServerInsertedMetadata, deploymentId, ComponentMod, renderFlightStream, clientModules, filterStackFrameForError, serverComponentsErrorHandler) {
|
|
4857
5108
|
const hasFallbackRouteParams = fallbackRouteParams && fallbackRouteParams.size > 0;
|
|
4858
5109
|
if (hasFallbackRouteParams) {
|
|
@@ -4892,7 +5143,7 @@ async function continueStaticPrerenderWithInlinedData(htmlStream, reactServerRes
|
|
|
4892
5143
|
deploymentId
|
|
4893
5144
|
});
|
|
4894
5145
|
}
|
|
4895
|
-
async function prerenderToStream(
|
|
5146
|
+
async function prerenderToStream(res, ctx, metadata, tree, fallbackRouteParams) {
|
|
4896
5147
|
// When prerendering formState is always null. We still include it
|
|
4897
5148
|
// because some shared APIs expect a formState value and this is slightly
|
|
4898
5149
|
// more explicit than making it an optional function argument
|
|
@@ -4941,7 +5192,7 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
4941
5192
|
const reportErrors = !experimental.isRoutePPREnabled;
|
|
4942
5193
|
function onHTMLRenderRSCError(err, silenceLog) {
|
|
4943
5194
|
if (reportErrors) {
|
|
4944
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
5195
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, createPrerenderErrorContext(ctx, 'react-server-components'), silenceLog);
|
|
4945
5196
|
}
|
|
4946
5197
|
}
|
|
4947
5198
|
const serverComponentsErrorHandler = (0, _createerrorhandler.createReactServerErrorHandler)(process.env.NODE_ENV === 'development', isBuildTimePrerendering, reactServerErrorsByDigest, onHTMLRenderRSCError);
|
|
@@ -4950,13 +5201,14 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
4950
5201
|
// We don't need to silence logs here. onHTMLRenderSSRError won't be
|
|
4951
5202
|
// called at all if the error was logged before in the RSC error handler.
|
|
4952
5203
|
const silenceLog = false;
|
|
4953
|
-
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err,
|
|
5204
|
+
return onInstrumentationRequestError == null ? void 0 : onInstrumentationRequestError(err, createPrerenderErrorContext(ctx, 'server-rendering'), silenceLog);
|
|
4954
5205
|
}
|
|
4955
5206
|
}
|
|
4956
5207
|
const allCapturedErrors = [];
|
|
4957
|
-
const
|
|
5208
|
+
const captureHTMLError = (0, _createerrorhandler.createHTMLErrorHandler)(process.env.NODE_ENV === 'development', isBuildTimePrerendering, ctx.renderOpts.experimental.reactBrowserBailout, reactServerErrorsByDigest, allCapturedErrors, onHTMLRenderSSRError);
|
|
4958
5209
|
let reactServerPrerenderResult = null;
|
|
4959
5210
|
let reactServerPrerenderResultIsDynamic = null;
|
|
5211
|
+
let reactServerRenderChunks = null;
|
|
4960
5212
|
let reactServerResumeDataCache = null;
|
|
4961
5213
|
let reactServerPrerenderStore = null;
|
|
4962
5214
|
const setMetadataHeader = (name)=>{
|
|
@@ -4981,8 +5233,44 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
4981
5233
|
const selectStaleTime = (0, _staletime.createSelectStaleTime)(experimental);
|
|
4982
5234
|
const { clientModules } = (0, _manifestssingleton.getClientReferenceManifest)();
|
|
4983
5235
|
let prerenderStore = null;
|
|
5236
|
+
let capturedHTTPErrorType;
|
|
5237
|
+
// Redirects take precedence over access fallbacks. Within each category, the
|
|
5238
|
+
// first error wins. Always return the current error's type, even if it does
|
|
5239
|
+
// not change the response, so the recovery catch can recognize HTTP errors.
|
|
5240
|
+
function setHTTPAccessFallbackOrRedirectStatus(err) {
|
|
5241
|
+
if ((0, _httpaccessfallback.isHTTPAccessFallbackError)(err)) {
|
|
5242
|
+
const statusCode = (0, _httpaccessfallback.getAccessFallbackHTTPStatus)(err);
|
|
5243
|
+
if (capturedHTTPErrorType === undefined) {
|
|
5244
|
+
capturedHTTPErrorType = 'access-fallback';
|
|
5245
|
+
res.statusCode = statusCode;
|
|
5246
|
+
metadata.statusCode = statusCode;
|
|
5247
|
+
}
|
|
5248
|
+
return (0, _httpaccessfallback.getAccessFallbackErrorTypeByStatus)(statusCode);
|
|
5249
|
+
} else if ((0, _redirecterror.isRedirectError)(err)) {
|
|
5250
|
+
if (capturedHTTPErrorType !== 'redirect') {
|
|
5251
|
+
capturedHTTPErrorType = 'redirect';
|
|
5252
|
+
res.statusCode = (0, _redirect.getRedirectStatusCodeFromError)(err);
|
|
5253
|
+
metadata.statusCode = res.statusCode;
|
|
5254
|
+
setHeader('location', (0, _addpathprefix.addPathPrefix)((0, _redirect.getURLFromRedirectError)(err), basePath));
|
|
5255
|
+
}
|
|
5256
|
+
return 'redirect';
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
// React can complete a prerender after an HTTP access fallback or redirect
|
|
5260
|
+
// error is thrown inside a Suspense boundary. Update the response while
|
|
5261
|
+
// preserving the prerendered content outside the boundary.
|
|
5262
|
+
const htmlRendererErrorHandler = (err, errorInfo)=>{
|
|
5263
|
+
setHTTPAccessFallbackOrRedirectStatus(err);
|
|
5264
|
+
return captureHTMLError(err, errorInfo);
|
|
5265
|
+
};
|
|
4984
5266
|
try {
|
|
4985
5267
|
if (cacheComponents) {
|
|
5268
|
+
const partialPrefetching = Boolean(ctx.renderOpts.partialPrefetching) || await (0, _instantconfig.anySegmentHasPartialPrefetchingEnabled)(tree);
|
|
5269
|
+
let ensureStaticLevel = await (0, _ensurestatic.resolveEnsureStaticLevel)(tree, partialPrefetching);
|
|
5270
|
+
if (process.env.NEXT_PRIVATE_DEBUG_RUNTIME_DATA) {
|
|
5271
|
+
console.log(`${workStore.route} :: ensureStatic level = ${_ensurestatic.EnsureStaticLevel[ensureStaticLevel]}`);
|
|
5272
|
+
}
|
|
5273
|
+
const isFallbackShell = !!(renderOpts.allowEmptyStaticShell === true && fallbackRouteParams && fallbackRouteParams.size > 0);
|
|
4986
5274
|
/**
|
|
4987
5275
|
* cacheComponents with PPR
|
|
4988
5276
|
*
|
|
@@ -5017,12 +5305,46 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5017
5305
|
const initialServerRenderController = new AbortController();
|
|
5018
5306
|
// The cacheSignal helps us track whether caches are still filling or we are ready
|
|
5019
5307
|
// to cut the render off.
|
|
5020
|
-
const
|
|
5308
|
+
const immediateTracker = new _fastsetimmediateexternal.ImmediateTracker();
|
|
5309
|
+
const cacheSignal = new _cachesignal.CacheSignal(immediateTracker);
|
|
5021
5310
|
// If a prefilled immutable render resume data cache is provided, e.g.
|
|
5022
5311
|
// when prerendering an optional fallback shell after having prerendered
|
|
5023
5312
|
// pages with defined params, we use this instead of a mutable prerender
|
|
5024
5313
|
// resume data cache.
|
|
5025
|
-
|
|
5314
|
+
let resumeDataCache = renderOpts.renderResumeDataCache ?? (0, _resumedatacache.createPrerenderResumeDataCache)();
|
|
5315
|
+
if (renderOpts.renderResumeDataCache && fallbackRouteParams && Object.keys(rootParams).some((name)=>fallbackRouteParams.has(name))) {
|
|
5316
|
+
// This seed came from a more specific prerender. Its cache keys don't
|
|
5317
|
+
// include root params, so replace entries that read roots this shell
|
|
5318
|
+
// doesn't know with markers explaining why they must become holes.
|
|
5319
|
+
// Keep the original seed intact for shells where those roots are known.
|
|
5320
|
+
const cache = new Map(resumeDataCache.cache);
|
|
5321
|
+
for (const [key, pendingEntry] of cache){
|
|
5322
|
+
if (pendingEntry === _cachestore.FALLBACK_PARAMS || pendingEntry === _cachestore.RUNTIME_DATA || pendingEntry === _cachestore.SESSION_DATA) {
|
|
5323
|
+
continue;
|
|
5324
|
+
}
|
|
5325
|
+
const { readRootParamNames, entry: { revalidate, expire } } = await pendingEntry;
|
|
5326
|
+
if (readRootParamNames) {
|
|
5327
|
+
for (const name of readRootParamNames){
|
|
5328
|
+
if (fallbackRouteParams.has(name)) {
|
|
5329
|
+
// Unlike an unexplained miss, this entry can become static
|
|
5330
|
+
// once its root params are known. Preserve that distinction
|
|
5331
|
+
// for the final pass's static-prefetch hint. Short-lived
|
|
5332
|
+
// entries still need runtime data even with concrete params.
|
|
5333
|
+
if (revalidate === 0 || expire < _constants.MIN_PRERENDERABLE_EXPIRE) {
|
|
5334
|
+
cache.set(key, _cachestore.SESSION_DATA);
|
|
5335
|
+
} else {
|
|
5336
|
+
cache.set(key, _cachestore.FALLBACK_PARAMS);
|
|
5337
|
+
}
|
|
5338
|
+
break;
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5342
|
+
}
|
|
5343
|
+
resumeDataCache = {
|
|
5344
|
+
...resumeDataCache,
|
|
5345
|
+
cache
|
|
5346
|
+
};
|
|
5347
|
+
}
|
|
5026
5348
|
reactServerPrerenderResultIsDynamic = null;
|
|
5027
5349
|
reactServerResumeDataCache = resumeDataCache;
|
|
5028
5350
|
reactServerPrerenderStore = null;
|
|
@@ -5045,9 +5367,9 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5045
5367
|
// the final prerender.
|
|
5046
5368
|
cacheSignal,
|
|
5047
5369
|
dynamicTracking: null,
|
|
5048
|
-
revalidate:
|
|
5049
|
-
expire:
|
|
5050
|
-
stale:
|
|
5370
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
5371
|
+
expire: _constants2.INFINITE_CACHE,
|
|
5372
|
+
stale: _constants2.INFINITE_CACHE,
|
|
5051
5373
|
tags: [
|
|
5052
5374
|
...implicitTags.tags
|
|
5053
5375
|
],
|
|
@@ -5055,14 +5377,15 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5055
5377
|
hmrRefreshHash: undefined,
|
|
5056
5378
|
// We don't track vary params during initial prerender, only the final one
|
|
5057
5379
|
varyParamsAccumulator: null,
|
|
5058
|
-
|
|
5059
|
-
|
|
5380
|
+
ensureStaticLevel,
|
|
5381
|
+
prerenderDataTracking: null,
|
|
5060
5382
|
isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true
|
|
5061
5383
|
};
|
|
5062
5384
|
// We're not going to use the result of this render because the only time it could be used
|
|
5063
5385
|
// is if it completes in a microtask and that's likely very rare for any non-trivial app
|
|
5064
|
-
const initialServerPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPayloadPrerenderStore, getRSCPayload, tree, ctx, {
|
|
5065
|
-
is404: res.statusCode === 404
|
|
5386
|
+
const initialServerPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPayloadPrerenderStore, _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, getRSCPayload), tree, ctx, {
|
|
5387
|
+
is404: res.statusCode === 404,
|
|
5388
|
+
isPrerendering: true
|
|
5066
5389
|
});
|
|
5067
5390
|
const initialServerPrerenderStore = prerenderStore = {
|
|
5068
5391
|
type: 'prerender',
|
|
@@ -5078,9 +5401,9 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5078
5401
|
// the final prerender.
|
|
5079
5402
|
cacheSignal,
|
|
5080
5403
|
dynamicTracking: null,
|
|
5081
|
-
revalidate:
|
|
5082
|
-
expire:
|
|
5083
|
-
stale:
|
|
5404
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
5405
|
+
expire: _constants2.INFINITE_CACHE,
|
|
5406
|
+
stale: _constants2.INFINITE_CACHE,
|
|
5084
5407
|
tags: [
|
|
5085
5408
|
...implicitTags.tags
|
|
5086
5409
|
],
|
|
@@ -5088,8 +5411,8 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5088
5411
|
hmrRefreshHash: undefined,
|
|
5089
5412
|
// We don't track vary params during initial prerender, only the final one
|
|
5090
5413
|
varyParamsAccumulator: null,
|
|
5091
|
-
|
|
5092
|
-
|
|
5414
|
+
ensureStaticLevel,
|
|
5415
|
+
prerenderDataTracking: null,
|
|
5093
5416
|
isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true
|
|
5094
5417
|
};
|
|
5095
5418
|
const initialPrerenderOptions = {
|
|
@@ -5117,7 +5440,7 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5117
5440
|
// transitioning out of the prerender environment
|
|
5118
5441
|
signal: initialServerReactController.signal
|
|
5119
5442
|
};
|
|
5120
|
-
const pendingInitialServerResult = _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPrerenderStore, (0, _streamops.getServerPrerender)(ComponentMod), initialServerPayload, clientModules, initialPrerenderOptions);
|
|
5443
|
+
const pendingInitialServerResult = _workunitasyncstorageexternal.workUnitAsyncStorage.run(initialServerPrerenderStore, _fastsetimmediateexternal.runWithNativeImmediateTracking.bind(null, immediateTracker, (0, _streamops.getServerPrerender)(ComponentMod)), initialServerPayload, clientModules, initialPrerenderOptions);
|
|
5121
5444
|
// The listener to abort our own render controller must be added after
|
|
5122
5445
|
// React has added its listener, to ensure that pending I/O is not
|
|
5123
5446
|
// aborted/rejected too early.
|
|
@@ -5165,9 +5488,9 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5165
5488
|
// is module loading, which has it's own cache signal
|
|
5166
5489
|
cacheSignal: null,
|
|
5167
5490
|
dynamicTracking: null,
|
|
5168
|
-
revalidate:
|
|
5169
|
-
expire:
|
|
5170
|
-
stale:
|
|
5491
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
5492
|
+
expire: _constants2.INFINITE_CACHE,
|
|
5493
|
+
stale: _constants2.INFINITE_CACHE,
|
|
5171
5494
|
tags: [
|
|
5172
5495
|
...implicitTags.tags
|
|
5173
5496
|
],
|
|
@@ -5229,8 +5552,9 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5229
5552
|
});
|
|
5230
5553
|
// This is mostly needed for dynamic `import()`s in client components.
|
|
5231
5554
|
// Promises passed to client were already awaited above (assuming that they came from cached functions)
|
|
5232
|
-
|
|
5233
|
-
|
|
5555
|
+
const clientCacheSignal = new _cachesignal.CacheSignal(null);
|
|
5556
|
+
(0, _trackmoduleloadingexternal.trackPendingModules)(clientCacheSignal);
|
|
5557
|
+
await clientCacheSignal.cacheReady();
|
|
5234
5558
|
_workunitasyncstorageexternal.workUnitAsyncStorage.run(initialClientPrerenderStore, initialClientReactController.abort.bind(initialClientReactController));
|
|
5235
5559
|
}
|
|
5236
5560
|
const finalServerReactController = new AbortController();
|
|
@@ -5242,26 +5566,7 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5242
5566
|
syncIO: _stagedrendering.SyncIOMode.AllowedInDynamic,
|
|
5243
5567
|
finalStage: _stagedrendering.RenderStage.Static
|
|
5244
5568
|
});
|
|
5245
|
-
|
|
5246
|
-
// below into the RSC payload (as `u`), resolved `true` at the moment
|
|
5247
|
-
// of first access so the fulfillment row is serialized at the stream
|
|
5248
|
-
// position where it happened. Used when generating per-segment
|
|
5249
|
-
// prefetch responses. Request data props (params, searchParams) are
|
|
5250
|
-
// created while the RSC payload is constructed, under the payload
|
|
5251
|
-
// store; both stores share the same promise so it observes accesses
|
|
5252
|
-
// from both.
|
|
5253
|
-
const runtimeDataAccessed = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
5254
|
-
// Companion cell holding this prerender's static-prefetch measurement
|
|
5255
|
-
// directly — the value that becomes the route's build-constant hint:
|
|
5256
|
-
// starts true, and a disqualifying runtime-data access flips it false
|
|
5257
|
-
// — fallback-param accesses on an upgradeable route don't (see
|
|
5258
|
-
// trackRuntimeDataAccessed, which applies the rule at access time).
|
|
5259
|
-
// Read after the prerender settles by
|
|
5260
|
-
// collectSegmentData below. Shared between both stores for the same
|
|
5261
|
-
// reason as the promise.
|
|
5262
|
-
const shouldAttemptStaticPrefetch = {
|
|
5263
|
-
current: true
|
|
5264
|
-
};
|
|
5569
|
+
const prerenderDataTracking = (0, _dynamicrenderingutils.createPrerenderDataTracking)();
|
|
5265
5570
|
const finalServerPayloadPrerenderStore = {
|
|
5266
5571
|
type: 'prerender',
|
|
5267
5572
|
phase: 'render',
|
|
@@ -5281,22 +5586,23 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5281
5586
|
// All caches we could read must already be filled so no tracking is necessary
|
|
5282
5587
|
cacheSignal: null,
|
|
5283
5588
|
dynamicTracking: null,
|
|
5284
|
-
revalidate:
|
|
5285
|
-
expire:
|
|
5286
|
-
stale:
|
|
5589
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
5590
|
+
expire: _constants2.INFINITE_CACHE,
|
|
5591
|
+
stale: _constants2.INFINITE_CACHE,
|
|
5287
5592
|
tags: [
|
|
5288
5593
|
...implicitTags.tags
|
|
5289
5594
|
],
|
|
5290
5595
|
resumeDataCache,
|
|
5291
5596
|
hmrRefreshHash: undefined,
|
|
5292
5597
|
varyParamsAccumulator,
|
|
5293
|
-
|
|
5294
|
-
|
|
5598
|
+
ensureStaticLevel,
|
|
5599
|
+
prerenderDataTracking,
|
|
5295
5600
|
isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true
|
|
5296
5601
|
};
|
|
5297
5602
|
const shellByteLengthDeferred = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
5298
5603
|
const finalServerPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(finalServerPayloadPrerenderStore, getRSCPayload, tree, ctx, {
|
|
5299
5604
|
is404: res.statusCode === 404,
|
|
5605
|
+
isPrerendering: true,
|
|
5300
5606
|
shellByteLengthPromise: shellByteLengthDeferred.promise
|
|
5301
5607
|
});
|
|
5302
5608
|
let staleTimeIterable;
|
|
@@ -5304,12 +5610,10 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5304
5610
|
staleTimeIterable = new _staletime.StaleTimeIterable();
|
|
5305
5611
|
finalServerPayload.s = staleTimeIterable;
|
|
5306
5612
|
}
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
finalServerPayload.u = runtimeDataAccessed.promise;
|
|
5312
|
-
}
|
|
5613
|
+
// Embed the runtime data access tracking in the payload so
|
|
5614
|
+
// collectSegmentData can replay it per stage. Only needed when the
|
|
5615
|
+
// Flight data will be decomposed into segment prefetches below.
|
|
5616
|
+
finalServerPayload.u = prerenderDataTracking.runtimeDataAccessed.promise;
|
|
5313
5617
|
const serverDynamicTracking = (0, _dynamicrendering.createDynamicTrackingState)(isDebugDynamicAccesses);
|
|
5314
5618
|
let resultIsPartial = false;
|
|
5315
5619
|
const finalServerPrerenderStore = prerenderStore = {
|
|
@@ -5324,24 +5628,27 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5324
5628
|
// All caches we could read must already be filled so no tracking is necessary
|
|
5325
5629
|
cacheSignal: null,
|
|
5326
5630
|
dynamicTracking: serverDynamicTracking,
|
|
5327
|
-
revalidate:
|
|
5328
|
-
expire:
|
|
5329
|
-
stale:
|
|
5631
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
5632
|
+
expire: _constants2.INFINITE_CACHE,
|
|
5633
|
+
stale: _constants2.INFINITE_CACHE,
|
|
5330
5634
|
tags: [
|
|
5331
5635
|
...implicitTags.tags
|
|
5332
5636
|
],
|
|
5333
5637
|
resumeDataCache,
|
|
5334
5638
|
hmrRefreshHash: undefined,
|
|
5335
5639
|
varyParamsAccumulator,
|
|
5336
|
-
|
|
5337
|
-
|
|
5640
|
+
ensureStaticLevel,
|
|
5641
|
+
prerenderDataTracking,
|
|
5338
5642
|
isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true
|
|
5339
5643
|
};
|
|
5340
5644
|
if (staleTimeIterable !== undefined) {
|
|
5341
5645
|
(0, _staletime.trackStaleTime)(finalServerPrerenderStore, staleTimeIterable, selectStaleTime);
|
|
5342
5646
|
}
|
|
5343
5647
|
const streamState = createStreamPendingState();
|
|
5344
|
-
|
|
5648
|
+
// On-demand failures need the chunks emitted when React aborts to
|
|
5649
|
+
// complete their Flight payload. Normal partial prerenders still use only
|
|
5650
|
+
// the pre-abort chunks.
|
|
5651
|
+
const collectedChunks = createPrerenderChunksAccumulator(!isBuildTimePrerendering || process.env.NODE_ENV === 'development');
|
|
5345
5652
|
const collectedChunksByStage = createStageChunksAccumulator();
|
|
5346
5653
|
const collectChunk = (chunk)=>{
|
|
5347
5654
|
collectPrerenderChunk(collectedChunks, finalServerReactController.signal, chunk);
|
|
@@ -5372,12 +5679,10 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5372
5679
|
if (staleTimeIterable !== undefined) {
|
|
5373
5680
|
staleTimeIterable.close();
|
|
5374
5681
|
}
|
|
5375
|
-
runtimeDataAccessed.resolve(false);
|
|
5376
5682
|
(0, _varyparams.finishAccumulatingVaryParams)(varyParamsAccumulator);
|
|
5377
5683
|
}
|
|
5378
5684
|
};
|
|
5379
5685
|
let debugEndTime = undefined;
|
|
5380
|
-
let didLinkDataUnblockNewContent = false;
|
|
5381
5686
|
await (0, _apprenderrenderutils.runInSequentialTasks)(async ()=>{
|
|
5382
5687
|
if (process.env.NODE_ENV === 'development') {
|
|
5383
5688
|
// The end time should be tracked whenever we abort.
|
|
@@ -5407,7 +5712,14 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5407
5712
|
});
|
|
5408
5713
|
// Note: this await will only resolve after the last task (unless sync IO aborts the render earlier)
|
|
5409
5714
|
// We await it here so that if the stream errors, it's not an unhandled rejection.
|
|
5410
|
-
await iterateStreamingPrerenderChunks(stream, finalServerReactController.signal, collectChunk, streamState);
|
|
5715
|
+
await iterateStreamingPrerenderChunks(stream, finalServerReactController.signal, collectChunk, streamState, collectedChunks.allChunks !== null);
|
|
5716
|
+
}, ()=>{
|
|
5717
|
+
if (checkUnexpectedAbort()) return;
|
|
5718
|
+
// Fold `PrefetchStatic_prefetchApi` into `PrefetchStatic` - no discrimination needed here
|
|
5719
|
+
finalStageController.advanceStage(_stagedrendering.RenderStage.PrefetchStatic);
|
|
5720
|
+
}, ()=>{
|
|
5721
|
+
if (checkUnexpectedAbort()) return;
|
|
5722
|
+
finalStageController.advanceStage(_stagedrendering.RenderStage.NavigationStatic);
|
|
5411
5723
|
}, ()=>{
|
|
5412
5724
|
if (checkUnexpectedAbort()) return;
|
|
5413
5725
|
finalStageController.advanceStage(_stagedrendering.RenderStage.Static);
|
|
@@ -5416,12 +5728,10 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5416
5728
|
// Finish the accumulators. We need to wait for Flight to flush the result into the stream,
|
|
5417
5729
|
// which is scheduled in a (fast) immediate, so we do this in a separate task
|
|
5418
5730
|
// (fast immediates will be drained at the end of the task, so in the next task we know we're done flushing)
|
|
5419
|
-
//
|
|
5420
|
-
// (after unblocking link data, i.e. static params)
|
|
5421
|
-
// then the prerender uses link data.
|
|
5731
|
+
// Check if new chunks were emitted after unblocking link data or navigation().
|
|
5422
5732
|
// NOTE: we must capture this *before* resolving staleTime/varyParams,
|
|
5423
5733
|
// which always emit new static chunks.
|
|
5424
|
-
|
|
5734
|
+
const hasMoreContentThanShell = collectedChunksByStage[_stagedrendering.RenderStage.Static].length > collectedChunksByStage[_stagedrendering.RenderStage.ShellStatic].length;
|
|
5425
5735
|
// Now that the prerendering is complete, we know the final stale
|
|
5426
5736
|
// time and vary params. Close the stale time iterable and resolve
|
|
5427
5737
|
// the vary params thenable so Flight can serialize their values
|
|
@@ -5431,11 +5741,9 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5431
5741
|
if (staleTimeIterable !== undefined) {
|
|
5432
5742
|
staleTimeIterable.close();
|
|
5433
5743
|
}
|
|
5434
|
-
|
|
5435
|
-
// `true`. The `false` row lands here, after all stage content.
|
|
5436
|
-
runtimeDataAccessed.resolve(false);
|
|
5744
|
+
(0, _dynamicrenderingutils.finishPrerenderDataTracking)(prerenderDataTracking);
|
|
5437
5745
|
(0, _varyparams.finishAccumulatingVaryParams)(varyParamsAccumulator);
|
|
5438
|
-
shellByteLengthDeferred.resolve(
|
|
5746
|
+
shellByteLengthDeferred.resolve(hasMoreContentThanShell ? collectedChunksByStage[_stagedrendering.RenderStage.ShellStatic].reduce((acc, chunk)=>acc + chunk.byteLength, 0) : null);
|
|
5439
5747
|
}, ()=>{
|
|
5440
5748
|
if (checkUnexpectedAbort()) return;
|
|
5441
5749
|
if (streamState.isPending) {
|
|
@@ -5455,12 +5763,16 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5455
5763
|
const reactServerResult = reactServerPrerenderResult = new _apprenderprerenderutils.ReactServerPrerenderResult(collectedChunks.prerenderChunks);
|
|
5456
5764
|
reactServerPrerenderResultIsDynamic = resultIsPartial;
|
|
5457
5765
|
reactServerPrerenderStore = finalServerPrerenderStore;
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5766
|
+
reactServerRenderChunks = collectedChunks.allChunks;
|
|
5767
|
+
metadata.flightData = Buffer.concat(cachedNavigations ? prependIsPartialByteToChunks(reactServerResult.asChunks(), resultIsPartial) : reactServerResult.asChunks());
|
|
5768
|
+
// collectSegmentData needs the raw flight data without the marker byte.
|
|
5769
|
+
const flightData = cachedNavigations ? metadata.flightData.subarray(1) : metadata.flightData;
|
|
5770
|
+
if (process.env.NEXT_PRIVATE_DEBUG_RUNTIME_DATA) {
|
|
5771
|
+
const { shouldAttemptStaticShell: shellIsStatic, shouldAttemptStaticPrefetch: prefetchIsStatic } = prerenderDataTracking;
|
|
5772
|
+
const label = (isStatic)=>isStatic ? 'static' : 'runtime';
|
|
5773
|
+
console.log(`Route ${workStore.route} :: hints: shell=${label(shellIsStatic)}, prefetch=${label(prefetchIsStatic)}`);
|
|
5463
5774
|
}
|
|
5775
|
+
await collectSegmentData(flightData, finalServerPrerenderStore, ComponentMod, renderOpts, ctx.pagePath, metadata);
|
|
5464
5776
|
const clientDynamicTracking = (0, _dynamicrendering.createDynamicTrackingState)(isDebugDynamicAccesses);
|
|
5465
5777
|
const finalClientReactController = new AbortController();
|
|
5466
5778
|
const finalClientRenderController = new AbortController();
|
|
@@ -5475,9 +5787,9 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5475
5787
|
// No APIs require a cacheSignal through the workUnitStore during the HTML prerender
|
|
5476
5788
|
cacheSignal: null,
|
|
5477
5789
|
dynamicTracking: clientDynamicTracking,
|
|
5478
|
-
revalidate:
|
|
5479
|
-
expire:
|
|
5480
|
-
stale:
|
|
5790
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
5791
|
+
expire: _constants2.INFINITE_CACHE,
|
|
5792
|
+
stale: _constants2.INFINITE_CACHE,
|
|
5481
5793
|
tags: [
|
|
5482
5794
|
...implicitTags.tags
|
|
5483
5795
|
],
|
|
@@ -5486,6 +5798,8 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5486
5798
|
// Client prerenders don't track server param access
|
|
5487
5799
|
varyParamsAccumulator: null
|
|
5488
5800
|
};
|
|
5801
|
+
// In a static prerender, we don't know which kind of data caused a dynamic hole.
|
|
5802
|
+
const dynamicHoleKind = _dynamicrendering.DynamicHoleKind.RuntimeOrDynamic;
|
|
5489
5803
|
let dynamicValidation = (0, _dynamicrendering.createDynamicValidationState)();
|
|
5490
5804
|
const finalClientOnHeaders = (0, _streamops.createOnHeadersCallback)(appendHeader);
|
|
5491
5805
|
let { prelude: unprocessedPrelude, postponed } = await (0, _apprenderrenderutils.runInSequentialTasks)(()=>{
|
|
@@ -5505,7 +5819,11 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5505
5819
|
if ((0, _dynamicrendering.isPrerenderInterruptedError)(err) || finalClientReactController.signal.aborted) {
|
|
5506
5820
|
const componentStack = errorInfo.componentStack;
|
|
5507
5821
|
if (typeof componentStack === 'string') {
|
|
5508
|
-
(
|
|
5822
|
+
if (ensureStaticLevel === _ensurestatic.EnsureStaticLevel.Navigation) {
|
|
5823
|
+
(0, _dynamicrendering.trackDynamicAccessInStaticRoute)(err, workStore, componentStack, dynamicValidation, clientDynamicTracking, resultIsPartial, dynamicHoleKind);
|
|
5824
|
+
} else {
|
|
5825
|
+
(0, _dynamicrendering.trackAllowedDynamicAccess)(err, workStore, componentStack, dynamicValidation, clientDynamicTracking);
|
|
5826
|
+
}
|
|
5509
5827
|
}
|
|
5510
5828
|
return;
|
|
5511
5829
|
}
|
|
@@ -5532,7 +5850,11 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5532
5850
|
});
|
|
5533
5851
|
metadata.hasPendingUi = postponed != null;
|
|
5534
5852
|
const { prelude, preludeIsEmpty } = await (0, _streamops.processPrelude)(unprocessedPrelude);
|
|
5535
|
-
|
|
5853
|
+
if (ensureStaticLevel === _ensurestatic.EnsureStaticLevel.Navigation) {
|
|
5854
|
+
(0, _dynamicrendering.throwIfDisallowedDynamicInStaticRoute)(workStore, preludeIsEmpty ? _dynamicrendering.PreludeState.Empty : _dynamicrendering.PreludeState.Full, dynamicValidation, serverDynamicTracking, isFallbackShell, allowEmptyStaticShell, resultIsPartial);
|
|
5855
|
+
} else {
|
|
5856
|
+
(0, _dynamicrendering.throwIfDisallowedDynamic)(workStore, preludeIsEmpty ? _dynamicrendering.PreludeState.Empty : _dynamicrendering.PreludeState.Full, dynamicValidation, serverDynamicTracking, allowEmptyStaticShell);
|
|
5857
|
+
}
|
|
5536
5858
|
const getServerInsertedHTML = (0, _makegetserverinsertedhtml.makeGetServerInsertedHTML)({
|
|
5537
5859
|
polyfills,
|
|
5538
5860
|
renderServerInsertedHTML,
|
|
@@ -5542,13 +5864,49 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5542
5864
|
});
|
|
5543
5865
|
let htmlStream = prelude;
|
|
5544
5866
|
if (resultIsPartial) {
|
|
5867
|
+
if (ensureStaticLevel === _ensurestatic.EnsureStaticLevel.Navigation) {
|
|
5868
|
+
if (isFallbackShell) {
|
|
5869
|
+
// TODO(ensure-static): This is a hack, and should be solved in a less rube-goldberg-y way.
|
|
5870
|
+
// If a fallback shell came out partial, we can't serve it without a resume,
|
|
5871
|
+
// which we can't do with `ensureStatic = "navigation"`, so force the HTML to be empty.
|
|
5872
|
+
const emptyHtml = new Uint8Array([]);
|
|
5873
|
+
const emptyHtmlStream = new ReadableStream({
|
|
5874
|
+
start (controller) {
|
|
5875
|
+
controller.enqueue(emptyHtml);
|
|
5876
|
+
controller.close();
|
|
5877
|
+
}
|
|
5878
|
+
});
|
|
5879
|
+
// We don't have a HTML postponed state.
|
|
5880
|
+
// This should not be used anyway, but in case we somehow
|
|
5881
|
+
// end up serving a fallback, make it usable
|
|
5882
|
+
metadata.hasPendingUi = true;
|
|
5883
|
+
metadata.postponed = await (0, _postponedstate.getDynamicDataPostponedState)(resumeDataCache, cacheComponents, renderOpts.experimental.maxPostponedStateSizeBytes, renderOpts.experimental.disableResumeDataCacheCompression, fallbackRouteParams);
|
|
5884
|
+
return {
|
|
5885
|
+
error: undefined,
|
|
5886
|
+
digestErrorsMap: new Map(),
|
|
5887
|
+
ssrErrors: [],
|
|
5888
|
+
stream: emptyHtmlStream,
|
|
5889
|
+
dynamicAccess: undefined,
|
|
5890
|
+
collectedRevalidate: finalServerPrerenderStore.revalidate,
|
|
5891
|
+
collectedExpire: finalServerPrerenderStore.expire,
|
|
5892
|
+
collectedStale: selectStaleTime(finalServerPrerenderStore.stale),
|
|
5893
|
+
collectedTags: finalServerPrerenderStore.tags,
|
|
5894
|
+
renderResumeDataCache: (0, _resumedatacache.createRenderResumeDataCache)(resumeDataCache)
|
|
5895
|
+
};
|
|
5896
|
+
} else {
|
|
5897
|
+
// If the result is partial, we should've errored when validating the prerender.
|
|
5898
|
+
console.error(new _invarianterror.InvariantError(`Route "${workStore.route}": Server result cannot be partial when \`ensureStatic = "navigation"\` is set on the route.`));
|
|
5899
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5545
5902
|
if (postponed != null) {
|
|
5546
|
-
metadata.postponed = await (0, _postponedstate.getDynamicHTMLPostponedState)(postponed, preludeIsEmpty ? _postponedstate.DynamicHTMLPreludeState.Empty : _postponedstate.DynamicHTMLPreludeState.Full, fallbackRouteParams, resumeDataCache, cacheComponents);
|
|
5903
|
+
metadata.postponed = await (0, _postponedstate.getDynamicHTMLPostponedState)(postponed, preludeIsEmpty ? _postponedstate.DynamicHTMLPreludeState.Empty : _postponedstate.DynamicHTMLPreludeState.Full, fallbackRouteParams, resumeDataCache, cacheComponents, renderOpts.experimental.maxPostponedStateSizeBytes, renderOpts.experimental.disableResumeDataCacheCompression);
|
|
5547
5904
|
} else {
|
|
5548
|
-
metadata.postponed = await (0, _postponedstate.getDynamicDataPostponedState)(resumeDataCache, cacheComponents);
|
|
5905
|
+
metadata.postponed = await (0, _postponedstate.getDynamicDataPostponedState)(resumeDataCache, cacheComponents, renderOpts.experimental.maxPostponedStateSizeBytes, renderOpts.experimental.disableResumeDataCacheCompression, fallbackRouteParams);
|
|
5549
5906
|
}
|
|
5550
5907
|
reactServerResult.consume();
|
|
5551
5908
|
return {
|
|
5909
|
+
error: undefined,
|
|
5552
5910
|
digestErrorsMap: reactServerErrorsByDigest,
|
|
5553
5911
|
ssrErrors: allCapturedErrors,
|
|
5554
5912
|
stream: await (0, _streamops.continueDynamicPrerender)(htmlStream, {
|
|
@@ -5578,7 +5936,7 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5578
5936
|
nonce: nonce,
|
|
5579
5937
|
images: ctx.renderOpts.images
|
|
5580
5938
|
}), JSON.parse(JSON.stringify(postponed)), {
|
|
5581
|
-
signal: (0,
|
|
5939
|
+
signal: (0, _renderinbrowser.createRenderInBrowserAbortSignal)(ctx.renderOpts.experimental.reactBrowserBailout),
|
|
5582
5940
|
onError: htmlRendererErrorHandler,
|
|
5583
5941
|
nonce
|
|
5584
5942
|
});
|
|
@@ -5586,14 +5944,11 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5586
5944
|
htmlStream = (0, _streamops.chainStreams)(prelude, resumePrelude);
|
|
5587
5945
|
}
|
|
5588
5946
|
if (workStore.forceDynamic) {
|
|
5589
|
-
throw
|
|
5590
|
-
value: "E598",
|
|
5591
|
-
enumerable: false,
|
|
5592
|
-
configurable: true
|
|
5593
|
-
});
|
|
5947
|
+
throw new _staticgenerationbailout.StaticGenBailoutError('Invariant: a Page with `dynamic = "force-dynamic"` did not trigger the dynamic pathway. This is a bug in Next.js');
|
|
5594
5948
|
}
|
|
5595
5949
|
const stream = await continueStaticPrerenderWithInlinedData(htmlStream, reactServerResult, fallbackRouteParams, createInlinedDataStream, formState, nonce, getServerInsertedHTML, getServerInsertedMetadata, ctx.sharedContext.deploymentId, ComponentMod, renderFlightStream, clientModules, filterStackFrame, serverComponentsErrorHandler);
|
|
5596
5950
|
return {
|
|
5951
|
+
error: undefined,
|
|
5597
5952
|
digestErrorsMap: reactServerErrorsByDigest,
|
|
5598
5953
|
ssrErrors: allCapturedErrors,
|
|
5599
5954
|
stream,
|
|
@@ -5604,204 +5959,15 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5604
5959
|
collectedTags: finalServerPrerenderStore.tags,
|
|
5605
5960
|
renderResumeDataCache: (0, _resumedatacache.createRenderResumeDataCache)(resumeDataCache)
|
|
5606
5961
|
};
|
|
5607
|
-
} else if (experimental.isRoutePPREnabled) {
|
|
5608
|
-
// We're statically generating with PPR and need to do dynamic tracking
|
|
5609
|
-
let dynamicTracking = (0, _dynamicrendering.createDynamicTrackingState)(isDebugDynamicAccesses);
|
|
5610
|
-
const resumeDataCache = (0, _resumedatacache.createPrerenderResumeDataCache)();
|
|
5611
|
-
const pprReactServerPrerenderStore = prerenderStore = {
|
|
5612
|
-
type: 'prerender-ppr',
|
|
5613
|
-
phase: 'render',
|
|
5614
|
-
rootParams,
|
|
5615
|
-
fallbackRouteParams,
|
|
5616
|
-
implicitTags,
|
|
5617
|
-
dynamicTracking,
|
|
5618
|
-
revalidate: _constants1.INFINITE_CACHE,
|
|
5619
|
-
expire: _constants1.INFINITE_CACHE,
|
|
5620
|
-
stale: _constants1.INFINITE_CACHE,
|
|
5621
|
-
tags: [
|
|
5622
|
-
...implicitTags.tags
|
|
5623
|
-
],
|
|
5624
|
-
resumeDataCache
|
|
5625
|
-
};
|
|
5626
|
-
const RSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(pprReactServerPrerenderStore, getRSCPayload, tree, ctx, {
|
|
5627
|
-
is404: res.statusCode === 404
|
|
5628
|
-
});
|
|
5629
|
-
let reactServerResult;
|
|
5630
|
-
reactServerResult = reactServerPrerenderResult = await (0, _apprenderprerenderutils.createReactServerPrerenderResultFromRender)(_workunitasyncstorageexternal.workUnitAsyncStorage.run(pprReactServerPrerenderStore, renderFlightStream, ComponentMod, RSCPayload, clientModules, {
|
|
5631
|
-
filterStackFrame,
|
|
5632
|
-
onError: serverComponentsErrorHandler
|
|
5633
|
-
}));
|
|
5634
|
-
const ssrPrerenderStore = {
|
|
5635
|
-
type: 'prerender-ppr',
|
|
5636
|
-
phase: 'render',
|
|
5637
|
-
rootParams,
|
|
5638
|
-
fallbackRouteParams,
|
|
5639
|
-
implicitTags,
|
|
5640
|
-
dynamicTracking,
|
|
5641
|
-
revalidate: _constants1.INFINITE_CACHE,
|
|
5642
|
-
expire: _constants1.INFINITE_CACHE,
|
|
5643
|
-
stale: _constants1.INFINITE_CACHE,
|
|
5644
|
-
tags: [
|
|
5645
|
-
...implicitTags.tags
|
|
5646
|
-
],
|
|
5647
|
-
resumeDataCache
|
|
5648
|
-
};
|
|
5649
|
-
const pprOnHeaders = (0, _streamops.createOnHeadersCallback)(appendHeader);
|
|
5650
|
-
const { prelude: unprocessedPrelude, postponed } = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(ssrPrerenderStore, _streamops.getClientPrerender, // eslint-disable-next-line @next/internal/no-ambiguous-jsx
|
|
5651
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(App, {
|
|
5652
|
-
reactServerStream: reactServerResult.asUnclosingStream(),
|
|
5653
|
-
reactDebugStream: undefined,
|
|
5654
|
-
debugEndTime: undefined,
|
|
5655
|
-
preinitScripts: preinitScripts,
|
|
5656
|
-
ServerInsertedHTMLProvider: ServerInsertedHTMLProvider,
|
|
5657
|
-
nonce: nonce,
|
|
5658
|
-
images: ctx.renderOpts.images
|
|
5659
|
-
}), {
|
|
5660
|
-
onError: htmlRendererErrorHandler,
|
|
5661
|
-
onHeaders: pprOnHeaders,
|
|
5662
|
-
maxHeadersLength: reactMaxHeadersLength,
|
|
5663
|
-
bootstrapScriptContent,
|
|
5664
|
-
bootstrapScripts: [
|
|
5665
|
-
bootstrapScript
|
|
5666
|
-
]
|
|
5667
|
-
});
|
|
5668
|
-
metadata.hasPendingUi = postponed != null;
|
|
5669
|
-
const getServerInsertedHTML = (0, _makegetserverinsertedhtml.makeGetServerInsertedHTML)({
|
|
5670
|
-
polyfills,
|
|
5671
|
-
renderServerInsertedHTML,
|
|
5672
|
-
serverCapturedErrors: allCapturedErrors,
|
|
5673
|
-
basePath,
|
|
5674
|
-
tracingMetadata: tracingMetadata
|
|
5675
|
-
});
|
|
5676
|
-
// After awaiting here we've waited for the entire RSC render to complete. Crucially this means
|
|
5677
|
-
// that when we detect whether we've used dynamic APIs below we know we'll have picked up even
|
|
5678
|
-
// parts of the React Server render that might not be used in the SSR render.
|
|
5679
|
-
const flightData = await (0, _streamops.streamToBuffer)(reactServerResult.asStream());
|
|
5680
|
-
if (shouldGenerateStaticFlightData(workStore)) {
|
|
5681
|
-
metadata.flightData = flightData;
|
|
5682
|
-
await collectSegmentData(flightData, ssrPrerenderStore, ComponentMod, renderOpts, ctx.pagePath, metadata);
|
|
5683
|
-
}
|
|
5684
|
-
const { prelude, preludeIsEmpty } = await (0, _streamops.processPrelude)(unprocessedPrelude);
|
|
5685
|
-
/**
|
|
5686
|
-
* When prerendering there are three outcomes to consider
|
|
5687
|
-
*
|
|
5688
|
-
* Dynamic HTML: The prerender has dynamic holes (caused by using Next.js Dynamic Rendering APIs)
|
|
5689
|
-
* We will need to resume this result when requests are handled and we don't include
|
|
5690
|
-
* any server inserted HTML or inlined flight data in the static HTML
|
|
5691
|
-
*
|
|
5692
|
-
* Dynamic Data: The prerender has no dynamic holes but dynamic APIs were used. We will not
|
|
5693
|
-
* resume this render when requests are handled but we will generate new inlined
|
|
5694
|
-
* flight data since it is dynamic and differences may end up reconciling on the client
|
|
5695
|
-
*
|
|
5696
|
-
* Static: The prerender has no dynamic holes and no dynamic APIs were used. We statically encode
|
|
5697
|
-
* all server inserted HTML and flight data
|
|
5698
|
-
*/ // First we check if we have any dynamic holes in our HTML prerender
|
|
5699
|
-
if ((0, _dynamicrendering.accessedDynamicData)(dynamicTracking.dynamicAccesses)) {
|
|
5700
|
-
if (postponed != null) {
|
|
5701
|
-
// Dynamic HTML case.
|
|
5702
|
-
metadata.postponed = await (0, _postponedstate.getDynamicHTMLPostponedState)(postponed, preludeIsEmpty ? _postponedstate.DynamicHTMLPreludeState.Empty : _postponedstate.DynamicHTMLPreludeState.Full, fallbackRouteParams, resumeDataCache, cacheComponents);
|
|
5703
|
-
} else {
|
|
5704
|
-
// Dynamic Data case.
|
|
5705
|
-
metadata.postponed = await (0, _postponedstate.getDynamicDataPostponedState)(resumeDataCache, cacheComponents);
|
|
5706
|
-
}
|
|
5707
|
-
// Regardless of whether this is the Dynamic HTML or Dynamic Data case we need to ensure we include
|
|
5708
|
-
// server inserted html in the static response because the html that is part of the prerender may depend on it
|
|
5709
|
-
// It is possible in the set of stream transforms for Dynamic HTML vs Dynamic Data may differ but currently both states
|
|
5710
|
-
// require the same set so we unify the code path here
|
|
5711
|
-
reactServerResult.consume();
|
|
5712
|
-
const pprDynamicOpts = {
|
|
5713
|
-
getServerInsertedHTML,
|
|
5714
|
-
getServerInsertedMetadata,
|
|
5715
|
-
deploymentId: ctx.sharedContext.deploymentId
|
|
5716
|
-
};
|
|
5717
|
-
return {
|
|
5718
|
-
digestErrorsMap: reactServerErrorsByDigest,
|
|
5719
|
-
ssrErrors: allCapturedErrors,
|
|
5720
|
-
stream: await (0, _streamops.continueDynamicPrerender)(prelude, pprDynamicOpts),
|
|
5721
|
-
dynamicAccess: dynamicTracking.dynamicAccesses,
|
|
5722
|
-
// TODO: Should this include the SSR pass?
|
|
5723
|
-
collectedRevalidate: pprReactServerPrerenderStore.revalidate,
|
|
5724
|
-
collectedExpire: pprReactServerPrerenderStore.expire,
|
|
5725
|
-
collectedStale: selectStaleTime(pprReactServerPrerenderStore.stale),
|
|
5726
|
-
collectedTags: pprReactServerPrerenderStore.tags
|
|
5727
|
-
};
|
|
5728
|
-
} else if (fallbackRouteParams && fallbackRouteParams.size > 0) {
|
|
5729
|
-
// Rendering the fallback case.
|
|
5730
|
-
metadata.postponed = await (0, _postponedstate.getDynamicDataPostponedState)(resumeDataCache, cacheComponents);
|
|
5731
|
-
const pprFallbackDynamicOpts = {
|
|
5732
|
-
getServerInsertedHTML,
|
|
5733
|
-
getServerInsertedMetadata,
|
|
5734
|
-
deploymentId: ctx.sharedContext.deploymentId
|
|
5735
|
-
};
|
|
5736
|
-
return {
|
|
5737
|
-
digestErrorsMap: reactServerErrorsByDigest,
|
|
5738
|
-
ssrErrors: allCapturedErrors,
|
|
5739
|
-
stream: await (0, _streamops.continueDynamicPrerender)(prelude, pprFallbackDynamicOpts),
|
|
5740
|
-
dynamicAccess: dynamicTracking.dynamicAccesses,
|
|
5741
|
-
// TODO: Should this include the SSR pass?
|
|
5742
|
-
collectedRevalidate: pprReactServerPrerenderStore.revalidate,
|
|
5743
|
-
collectedExpire: pprReactServerPrerenderStore.expire,
|
|
5744
|
-
collectedStale: selectStaleTime(pprReactServerPrerenderStore.stale),
|
|
5745
|
-
collectedTags: pprReactServerPrerenderStore.tags
|
|
5746
|
-
};
|
|
5747
|
-
} else {
|
|
5748
|
-
// Static case
|
|
5749
|
-
// We still have not used any dynamic APIs. At this point we can produce an entirely static prerender response
|
|
5750
|
-
if (workStore.forceDynamic) {
|
|
5751
|
-
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError('Invariant: a Page with `dynamic = "force-dynamic"` did not trigger the dynamic pathway. This is a bug in Next.js'), "__NEXT_ERROR_CODE", {
|
|
5752
|
-
value: "E598",
|
|
5753
|
-
enumerable: false,
|
|
5754
|
-
configurable: true
|
|
5755
|
-
});
|
|
5756
|
-
}
|
|
5757
|
-
let htmlStream = prelude;
|
|
5758
|
-
if (postponed != null) {
|
|
5759
|
-
// We postponed but nothing dynamic was used. We resume the render now and immediately abort it
|
|
5760
|
-
// so we can set all the postponed boundaries to client render mode before we store the HTML response
|
|
5761
|
-
const foreverStream = (0, _streamops.createPendingStream)();
|
|
5762
|
-
const resumePrelude = await (0, _streamops.resumeAndAbort)(// eslint-disable-next-line @next/internal/no-ambiguous-jsx
|
|
5763
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(App, {
|
|
5764
|
-
reactServerStream: foreverStream,
|
|
5765
|
-
reactDebugStream: undefined,
|
|
5766
|
-
debugEndTime: undefined,
|
|
5767
|
-
preinitScripts: ()=>{},
|
|
5768
|
-
ServerInsertedHTMLProvider: ServerInsertedHTMLProvider,
|
|
5769
|
-
nonce: nonce,
|
|
5770
|
-
images: ctx.renderOpts.images
|
|
5771
|
-
}), JSON.parse(JSON.stringify(postponed)), {
|
|
5772
|
-
signal: (0, _dynamicrendering.createRenderInBrowserAbortSignal)(),
|
|
5773
|
-
onError: htmlRendererErrorHandler,
|
|
5774
|
-
nonce
|
|
5775
|
-
});
|
|
5776
|
-
// First we write everything from the prerender, then we write everything from the aborted resume render
|
|
5777
|
-
htmlStream = (0, _streamops.chainStreams)(prelude, resumePrelude);
|
|
5778
|
-
}
|
|
5779
|
-
return {
|
|
5780
|
-
digestErrorsMap: reactServerErrorsByDigest,
|
|
5781
|
-
ssrErrors: allCapturedErrors,
|
|
5782
|
-
stream: await (0, _streamops.continueStaticPrerender)(htmlStream, {
|
|
5783
|
-
inlinedDataStream: createInlinedDataStream(reactServerResult.consumeAsStream(), nonce, formState),
|
|
5784
|
-
getServerInsertedHTML,
|
|
5785
|
-
getServerInsertedMetadata,
|
|
5786
|
-
deploymentId: ctx.sharedContext.deploymentId
|
|
5787
|
-
}),
|
|
5788
|
-
dynamicAccess: dynamicTracking.dynamicAccesses,
|
|
5789
|
-
// TODO: Should this include the SSR pass?
|
|
5790
|
-
collectedRevalidate: pprReactServerPrerenderStore.revalidate,
|
|
5791
|
-
collectedExpire: pprReactServerPrerenderStore.expire,
|
|
5792
|
-
collectedStale: selectStaleTime(pprReactServerPrerenderStore.stale),
|
|
5793
|
-
collectedTags: pprReactServerPrerenderStore.tags
|
|
5794
|
-
};
|
|
5795
|
-
}
|
|
5796
5962
|
} else {
|
|
5797
5963
|
const prerenderLegacyStore = prerenderStore = {
|
|
5798
5964
|
type: 'prerender-legacy',
|
|
5799
5965
|
phase: 'render',
|
|
5800
5966
|
rootParams,
|
|
5801
5967
|
implicitTags,
|
|
5802
|
-
revalidate:
|
|
5803
|
-
expire:
|
|
5804
|
-
stale:
|
|
5968
|
+
revalidate: _constants2.INFINITE_CACHE,
|
|
5969
|
+
expire: _constants2.INFINITE_CACHE,
|
|
5970
|
+
stale: _constants2.INFINITE_CACHE,
|
|
5805
5971
|
tags: [
|
|
5806
5972
|
...implicitTags.tags
|
|
5807
5973
|
]
|
|
@@ -5809,7 +5975,8 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5809
5975
|
// This is a regular static generation. We don't do dynamic tracking because we rely on
|
|
5810
5976
|
// the old-school dynamic error handling to bail out of static generation
|
|
5811
5977
|
const RSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(prerenderLegacyStore, getRSCPayload, tree, ctx, {
|
|
5812
|
-
is404: res.statusCode === 404
|
|
5978
|
+
is404: res.statusCode === 404,
|
|
5979
|
+
isPrerendering: true
|
|
5813
5980
|
});
|
|
5814
5981
|
let reactServerResult;
|
|
5815
5982
|
reactServerResult = reactServerPrerenderResult = await (0, _apprenderprerenderutils.createReactServerPrerenderResultFromRender)(_workunitasyncstorageexternal.workUnitAsyncStorage.run(prerenderLegacyStore, renderFlightStream, ComponentMod, RSCPayload, clientModules, {
|
|
@@ -5835,11 +6002,9 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5835
6002
|
}, {
|
|
5836
6003
|
waitForAllReady: true
|
|
5837
6004
|
});
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
await collectSegmentData(flightData, prerenderLegacyStore, ComponentMod, renderOpts, ctx.pagePath, metadata);
|
|
5842
|
-
}
|
|
6005
|
+
const flightData = await (0, _streamops.streamToBuffer)(reactServerResult.asStream());
|
|
6006
|
+
metadata.flightData = flightData;
|
|
6007
|
+
await collectSegmentData(flightData, prerenderLegacyStore, ComponentMod, renderOpts, ctx.pagePath, metadata);
|
|
5843
6008
|
const getServerInsertedHTML = (0, _makegetserverinsertedhtml.makeGetServerInsertedHTML)({
|
|
5844
6009
|
polyfills,
|
|
5845
6010
|
renderServerInsertedHTML,
|
|
@@ -5848,11 +6013,12 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5848
6013
|
tracingMetadata: tracingMetadata
|
|
5849
6014
|
});
|
|
5850
6015
|
return {
|
|
6016
|
+
error: undefined,
|
|
5851
6017
|
digestErrorsMap: reactServerErrorsByDigest,
|
|
5852
6018
|
ssrErrors: allCapturedErrors,
|
|
5853
6019
|
stream: await (0, _streamops.continueFizzStream)(htmlStream, {
|
|
5854
6020
|
inlinedDataStream: createInlinedDataStream(reactServerResult.consumeAsStream(), nonce, formState),
|
|
5855
|
-
|
|
6021
|
+
waitForAllReady: true,
|
|
5856
6022
|
getServerInsertedHTML,
|
|
5857
6023
|
getServerInsertedMetadata,
|
|
5858
6024
|
deploymentId: ctx.sharedContext.deploymentId
|
|
@@ -5865,13 +6031,13 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5865
6031
|
};
|
|
5866
6032
|
}
|
|
5867
6033
|
} catch (err) {
|
|
5868
|
-
if ((0, _staticgenerationbailout.isStaticGenBailoutError)(err) || typeof err === 'object' && err !== null && 'message' in err && typeof err.message === 'string' && err.message.includes('https://nextjs.org/docs/advanced-features/static-html-export')) {
|
|
5869
|
-
//
|
|
6034
|
+
if (isBuildTimePrerendering && (0, _staticgenerationbailout.isStaticGenBailoutError)(err) || typeof err === 'object' && err !== null && 'message' in err && typeof err.message === 'string' && err.message.includes('https://nextjs.org/docs/advanced-features/static-html-export')) {
|
|
6035
|
+
// Preserve build-time bailouts and errors about features that cannot be
|
|
6036
|
+
// used with output: 'export'.
|
|
5870
6037
|
throw err;
|
|
5871
6038
|
}
|
|
5872
|
-
//
|
|
5873
|
-
|
|
5874
|
-
if ((0, _hooksservercontext.isDynamicServerError)(err)) {
|
|
6039
|
+
// Let the build detect dynamic routes from legacy prerender bailouts.
|
|
6040
|
+
if (isBuildTimePrerendering && (0, _hooksservercontext.isDynamicServerError)(err)) {
|
|
5875
6041
|
throw err;
|
|
5876
6042
|
}
|
|
5877
6043
|
// If a bailout made it to this point, it means it wasn't wrapped inside
|
|
@@ -5882,30 +6048,36 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5882
6048
|
(0, _log.error)(`${err.reason} should be wrapped in a suspense boundary at page "${pagePath}". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout\n${stack}`);
|
|
5883
6049
|
throw err;
|
|
5884
6050
|
}
|
|
6051
|
+
if (ctx.renderOpts.experimental.reactBrowserBailout) {
|
|
6052
|
+
// React preserves the reason passed to browser() as the fatal error's cause.
|
|
6053
|
+
const browserBailoutReason = (0, _reactbrowserbailout.getReactBrowserBailoutReason)(err);
|
|
6054
|
+
if (browserBailoutReason !== undefined) {
|
|
6055
|
+
const stack = (0, _formatservererror.getStackWithoutErrorMessage)(err);
|
|
6056
|
+
(0, _log.error)(`${browserBailoutReason} should be wrapped in a suspense boundary at page "${pagePath}". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout\n${stack}`);
|
|
6057
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
6058
|
+
}
|
|
6059
|
+
}
|
|
5885
6060
|
// If we errored when we did not have an RSC stream to read from. This is
|
|
5886
6061
|
// not just a render error, we need to throw early.
|
|
5887
6062
|
if (reactServerPrerenderResult === null) {
|
|
5888
6063
|
throw err;
|
|
5889
6064
|
}
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
const redirectUrl = (0, _addpathprefix.addPathPrefix)((0, _redirect.getURLFromRedirectError)(err), basePath);
|
|
5902
|
-
setHeader('location', redirectUrl);
|
|
5903
|
-
} else {
|
|
6065
|
+
if (!isBuildTimePrerendering && (0, _staticgenerationbailout.isStaticGenBailoutError)(err) && reactServerRenderChunks !== null) {
|
|
6066
|
+
// The streaming renderer emits a shared error chunk and references to it
|
|
6067
|
+
// for unfinished Flight tasks when aborted. Include these chunks so
|
|
6068
|
+
// recovery does not leave the client waiting for a resume. Normal partial
|
|
6069
|
+
// prerenders omit these chunks.
|
|
6070
|
+
reactServerPrerenderResult = new _apprenderprerenderutils.ReactServerPrerenderResult(reactServerRenderChunks);
|
|
6071
|
+
reactServerPrerenderResultIsDynamic = false;
|
|
6072
|
+
metadata.flightData = Buffer.concat(cachedNavigations ? prependIsPartialByteToChunks(reactServerRenderChunks, false) : reactServerRenderChunks);
|
|
6073
|
+
}
|
|
6074
|
+
const errorType = setHTTPAccessFallbackOrRedirectStatus(err);
|
|
6075
|
+
if (errorType === undefined) {
|
|
5904
6076
|
res.statusCode = 500;
|
|
5905
6077
|
metadata.statusCode = res.statusCode;
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
6078
|
+
if (cacheComponents && (isBuildTimePrerendering || reactServerPrerenderResultIsDynamic === null)) {
|
|
6079
|
+
throw reactServerErrorsByDigest.get(err == null ? void 0 : err.digest) ?? err;
|
|
6080
|
+
}
|
|
5909
6081
|
}
|
|
5910
6082
|
const [errorPreinitScripts, errorBootstrapScript] = (0, _requiredscripts.getRequiredScripts)(buildManifest, assetPrefix, crossOrigin, subresourceIntegrityManifest, (0, _getassetquerystring.getAssetQueryString)(ctx, false), nonce, _entryconstants.UNDERSCORE_NOT_FOUND_ROUTE_ENTRY);
|
|
5911
6083
|
const errorBootstrapScriptContent = buildManifest.pagesChunkGroupBootstrapParams && buildManifest.chunkLoadingGlobal ? (0, _getpagefiles.getTurbopackChunkGroupBootstrap)(buildManifest.pagesChunkGroupBootstrapParams, buildManifest.chunkLoadingGlobal, [
|
|
@@ -5917,32 +6089,16 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5917
6089
|
const originalResumeDataCache = reactServerResumeDataCache;
|
|
5918
6090
|
const originalPrerenderStore = reactServerPrerenderStore;
|
|
5919
6091
|
if (originalFlightPrerenderResult === null) {
|
|
5920
|
-
throw
|
|
5921
|
-
value: "E1283",
|
|
5922
|
-
enumerable: false,
|
|
5923
|
-
configurable: true
|
|
5924
|
-
});
|
|
6092
|
+
throw new _invarianterror.InvariantError('Cache Components error recovery expected an original Flight prerender result');
|
|
5925
6093
|
}
|
|
5926
6094
|
if (originalFlightPrerenderResultIsDynamic === null) {
|
|
5927
|
-
throw
|
|
5928
|
-
value: "E1282",
|
|
5929
|
-
enumerable: false,
|
|
5930
|
-
configurable: true
|
|
5931
|
-
});
|
|
6095
|
+
throw new _invarianterror.InvariantError('Cache Components error recovery expected to know whether the original Flight prerender result was dynamic');
|
|
5932
6096
|
}
|
|
5933
6097
|
if (originalResumeDataCache === null) {
|
|
5934
|
-
throw
|
|
5935
|
-
value: "E1285",
|
|
5936
|
-
enumerable: false,
|
|
5937
|
-
configurable: true
|
|
5938
|
-
});
|
|
6098
|
+
throw new _invarianterror.InvariantError('Cache Components error recovery expected an original resume data cache');
|
|
5939
6099
|
}
|
|
5940
6100
|
if (originalPrerenderStore === null) {
|
|
5941
|
-
throw
|
|
5942
|
-
value: "E1284",
|
|
5943
|
-
enumerable: false,
|
|
5944
|
-
configurable: true
|
|
5945
|
-
});
|
|
6101
|
+
throw new _invarianterror.InvariantError('Cache Components error recovery expected an original prerender store');
|
|
5946
6102
|
}
|
|
5947
6103
|
const originalCollectedStale = selectStaleTime(originalPrerenderStore.stale);
|
|
5948
6104
|
// The final recovery still belongs to Cache Components. Render the error
|
|
@@ -5963,20 +6119,20 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
5963
6119
|
stagedRendering: null,
|
|
5964
6120
|
cacheSignal: null,
|
|
5965
6121
|
dynamicTracking: errorServerDynamicTracking,
|
|
5966
|
-
revalidate: typeof (prerenderStore == null ? void 0 : prerenderStore.revalidate) !== 'undefined' ? prerenderStore.revalidate :
|
|
5967
|
-
expire: typeof (prerenderStore == null ? void 0 : prerenderStore.expire) !== 'undefined' ? prerenderStore.expire :
|
|
5968
|
-
stale: typeof (prerenderStore == null ? void 0 : prerenderStore.stale) !== 'undefined' ? prerenderStore.stale :
|
|
6122
|
+
revalidate: typeof (prerenderStore == null ? void 0 : prerenderStore.revalidate) !== 'undefined' ? prerenderStore.revalidate : _constants2.INFINITE_CACHE,
|
|
6123
|
+
expire: typeof (prerenderStore == null ? void 0 : prerenderStore.expire) !== 'undefined' ? prerenderStore.expire : _constants2.INFINITE_CACHE,
|
|
6124
|
+
stale: typeof (prerenderStore == null ? void 0 : prerenderStore.stale) !== 'undefined' ? prerenderStore.stale : _constants2.INFINITE_CACHE,
|
|
5969
6125
|
tags: [
|
|
5970
6126
|
...(prerenderStore == null ? void 0 : prerenderStore.tags) || implicitTags.tags
|
|
5971
6127
|
],
|
|
5972
6128
|
resumeDataCache: originalResumeDataCache,
|
|
5973
6129
|
hmrRefreshHash: undefined,
|
|
5974
6130
|
varyParamsAccumulator: null,
|
|
5975
|
-
|
|
5976
|
-
|
|
6131
|
+
ensureStaticLevel: null,
|
|
6132
|
+
prerenderDataTracking: null,
|
|
5977
6133
|
isFallbackUpgradeable: renderOpts.isFallbackUpgradeable === true
|
|
5978
6134
|
};
|
|
5979
|
-
const errorRSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(errorPrerenderStore, getErrorRSCPayload, tree, ctx, reactServerErrorsByDigest.has(err.digest) ? undefined : err, errorType, // The recovery shell only bootstraps the original Flight data. Avoid
|
|
6135
|
+
const errorRSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(errorPrerenderStore, getErrorRSCPayload, tree, ctx, reactServerErrorsByDigest.has(err == null ? void 0 : err.digest) ? undefined : err, errorType, // The recovery shell only bootstraps the original Flight data. Avoid
|
|
5980
6136
|
// blocking that shell on error-page metadata or viewport.
|
|
5981
6137
|
false);
|
|
5982
6138
|
const errorServerResult = await (0, _apprenderprerenderutils.createReactServerPrerenderResult)((0, _apprenderrenderutils.runInSequentialTasks)(async ()=>{
|
|
@@ -6082,10 +6238,13 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
6082
6238
|
});
|
|
6083
6239
|
let errorHtmlStream = prelude;
|
|
6084
6240
|
if (originalFlightPrerenderResultIsDynamic) {
|
|
6085
|
-
metadata.postponed = await (0, _postponedstate.getDynamicDataPostponedState)(originalResumeDataCache, cacheComponents);
|
|
6241
|
+
metadata.postponed = await (0, _postponedstate.getDynamicDataPostponedState)(originalResumeDataCache, cacheComponents, renderOpts.experimental.maxPostponedStateSizeBytes, renderOpts.experimental.disableResumeDataCacheCompression, fallbackRouteParams);
|
|
6086
6242
|
originalFlightPrerenderResult.consume();
|
|
6087
6243
|
errorServerResult.consume();
|
|
6088
6244
|
return {
|
|
6245
|
+
error: errorType !== undefined ? undefined : {
|
|
6246
|
+
thrownValue: err
|
|
6247
|
+
},
|
|
6089
6248
|
digestErrorsMap: reactServerErrorsByDigest,
|
|
6090
6249
|
ssrErrors: allCapturedErrors,
|
|
6091
6250
|
stream: await (0, _streamops.continueDynamicPrerender)(errorHtmlStream, {
|
|
@@ -6113,22 +6272,21 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
6113
6272
|
nonce: nonce,
|
|
6114
6273
|
images: ctx.renderOpts.images
|
|
6115
6274
|
}), JSON.parse(JSON.stringify(errorPostponed)), {
|
|
6116
|
-
signal: (0,
|
|
6275
|
+
signal: (0, _renderinbrowser.createRenderInBrowserAbortSignal)(ctx.renderOpts.experimental.reactBrowserBailout),
|
|
6117
6276
|
onError: htmlRendererErrorHandler,
|
|
6118
6277
|
nonce
|
|
6119
6278
|
});
|
|
6120
6279
|
errorHtmlStream = (0, _streamops.chainStreams)(prelude, resumePrelude);
|
|
6121
6280
|
}
|
|
6122
6281
|
if (workStore.forceDynamic) {
|
|
6123
|
-
throw
|
|
6124
|
-
value: "E598",
|
|
6125
|
-
enumerable: false,
|
|
6126
|
-
configurable: true
|
|
6127
|
-
});
|
|
6282
|
+
throw new _staticgenerationbailout.StaticGenBailoutError('Invariant: a Page with `dynamic = "force-dynamic"` did not trigger the dynamic pathway. This is a bug in Next.js');
|
|
6128
6283
|
}
|
|
6129
6284
|
const stream = await continueStaticPrerenderWithInlinedData(errorHtmlStream, originalFlightPrerenderResult, fallbackRouteParams, createInlinedDataStream, formState, nonce, getServerInsertedHTML, getServerInsertedMetadata, ctx.sharedContext.deploymentId, ComponentMod, renderFlightStream, clientModules, filterStackFrame, serverComponentsErrorHandler);
|
|
6130
6285
|
errorServerResult.consume();
|
|
6131
6286
|
return {
|
|
6287
|
+
error: errorType !== undefined ? undefined : {
|
|
6288
|
+
thrownValue: err
|
|
6289
|
+
},
|
|
6132
6290
|
digestErrorsMap: reactServerErrorsByDigest,
|
|
6133
6291
|
ssrErrors: allCapturedErrors,
|
|
6134
6292
|
stream,
|
|
@@ -6152,14 +6310,14 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
6152
6310
|
phase: 'render',
|
|
6153
6311
|
rootParams,
|
|
6154
6312
|
implicitTags: implicitTags,
|
|
6155
|
-
revalidate: typeof (prerenderStore == null ? void 0 : prerenderStore.revalidate) !== 'undefined' ? prerenderStore.revalidate :
|
|
6156
|
-
expire: typeof (prerenderStore == null ? void 0 : prerenderStore.expire) !== 'undefined' ? prerenderStore.expire :
|
|
6157
|
-
stale: typeof (prerenderStore == null ? void 0 : prerenderStore.stale) !== 'undefined' ? prerenderStore.stale :
|
|
6313
|
+
revalidate: typeof (prerenderStore == null ? void 0 : prerenderStore.revalidate) !== 'undefined' ? prerenderStore.revalidate : _constants2.INFINITE_CACHE,
|
|
6314
|
+
expire: typeof (prerenderStore == null ? void 0 : prerenderStore.expire) !== 'undefined' ? prerenderStore.expire : _constants2.INFINITE_CACHE,
|
|
6315
|
+
stale: typeof (prerenderStore == null ? void 0 : prerenderStore.stale) !== 'undefined' ? prerenderStore.stale : _constants2.INFINITE_CACHE,
|
|
6158
6316
|
tags: [
|
|
6159
6317
|
...(prerenderStore == null ? void 0 : prerenderStore.tags) || implicitTags.tags
|
|
6160
6318
|
]
|
|
6161
6319
|
};
|
|
6162
|
-
const errorRSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(prerenderLegacyStore, getErrorRSCPayload, tree, ctx, reactServerErrorsByDigest.has(err.digest) ? undefined : err, errorType, // Legacy prerender recovery should include the error payload head.
|
|
6320
|
+
const errorRSCPayload = await _workunitasyncstorageexternal.workUnitAsyncStorage.run(prerenderLegacyStore, getErrorRSCPayload, tree, ctx, reactServerErrorsByDigest.has(err == null ? void 0 : err.digest) ? undefined : err, errorType, // Legacy prerender recovery should include the error payload head.
|
|
6163
6321
|
true);
|
|
6164
6322
|
const errorServerStream = _workunitasyncstorageexternal.workUnitAsyncStorage.run(prerenderLegacyStore, renderFlightStream, ComponentMod, errorRSCPayload, clientModules, {
|
|
6165
6323
|
filterStackFrame,
|
|
@@ -6183,17 +6341,16 @@ async function prerenderToStream(req, res, ctx, metadata, tree, fallbackRoutePar
|
|
|
6183
6341
|
}, {
|
|
6184
6342
|
waitForAllReady: true
|
|
6185
6343
|
});
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
await collectSegmentData(flightData, prerenderLegacyStore, ComponentMod, renderOpts, ctx.pagePath, metadata);
|
|
6190
|
-
}
|
|
6344
|
+
const flightData = await (0, _streamops.streamToBuffer)(reactServerPrerenderResult.asStream());
|
|
6345
|
+
metadata.flightData = flightData;
|
|
6346
|
+
await collectSegmentData(flightData, prerenderLegacyStore, ComponentMod, renderOpts, ctx.pagePath, metadata);
|
|
6191
6347
|
return {
|
|
6348
|
+
error: undefined,
|
|
6192
6349
|
digestErrorsMap: reactServerErrorsByDigest,
|
|
6193
6350
|
ssrErrors: allCapturedErrors,
|
|
6194
6351
|
stream: await (0, _streamops.continueFizzStream)(errorHtmlStream, {
|
|
6195
6352
|
inlinedDataStream: createInlinedDataStream(reactServerPrerenderResult.consumeAsStream(), nonce, formState),
|
|
6196
|
-
|
|
6353
|
+
waitForAllReady: true,
|
|
6197
6354
|
getServerInsertedHTML: (0, _makegetserverinsertedhtml.makeGetServerInsertedHTML)({
|
|
6198
6355
|
polyfills,
|
|
6199
6356
|
renderServerInsertedHTML,
|
|
@@ -6228,11 +6385,7 @@ function createStreamPendingState() {
|
|
|
6228
6385
|
return {
|
|
6229
6386
|
get isPending () {
|
|
6230
6387
|
if (_isPending === undefined) {
|
|
6231
|
-
throw
|
|
6232
|
-
value: "E1281",
|
|
6233
|
-
enumerable: false,
|
|
6234
|
-
configurable: true
|
|
6235
|
-
});
|
|
6388
|
+
throw new _invarianterror.InvariantError('Expected stream state to be initialized before reading');
|
|
6236
6389
|
}
|
|
6237
6390
|
return _isPending;
|
|
6238
6391
|
},
|
|
@@ -6241,22 +6394,18 @@ function createStreamPendingState() {
|
|
|
6241
6394
|
}
|
|
6242
6395
|
};
|
|
6243
6396
|
}
|
|
6244
|
-
function createPrerenderChunksAccumulator() {
|
|
6397
|
+
function createPrerenderChunksAccumulator(collectAllChunks = process.env.NODE_ENV === 'development') {
|
|
6245
6398
|
return {
|
|
6246
6399
|
// Chunks emitted before aborting the render.
|
|
6247
6400
|
prerenderChunks: [],
|
|
6248
|
-
//
|
|
6249
|
-
//
|
|
6250
|
-
//
|
|
6251
|
-
|
|
6252
|
-
// so have to use something like `createNodeStreamWithLateRelease`
|
|
6253
|
-
// to make the errors unobservable.
|
|
6254
|
-
allChunks: process.env.NODE_ENV === 'development' ? [] : null
|
|
6401
|
+
// The complete render includes abort errors for pending components.
|
|
6402
|
+
// Recovery uses these errors; development validation delays them with
|
|
6403
|
+
// createNodeStreamWithLateRelease to expose only debug information.
|
|
6404
|
+
allChunks: collectAllChunks ? [] : null
|
|
6255
6405
|
};
|
|
6256
6406
|
}
|
|
6257
6407
|
function collectPrerenderChunk(chunks, signal, chunk) {
|
|
6258
|
-
var //
|
|
6259
|
-
// to improve error messages.
|
|
6408
|
+
var // Retain the complete stream when recovery or debug information needs it.
|
|
6260
6409
|
_chunks_allChunks;
|
|
6261
6410
|
// The chunks emitted after an abort are not part of the prerender...
|
|
6262
6411
|
if (!signal.aborted) {
|
|
@@ -6264,15 +6413,13 @@ function collectPrerenderChunk(chunks, signal, chunk) {
|
|
|
6264
6413
|
}
|
|
6265
6414
|
(_chunks_allChunks = chunks.allChunks) == null ? void 0 : _chunks_allChunks.push(chunk);
|
|
6266
6415
|
}
|
|
6267
|
-
async function iterateStreamingPrerenderChunks(stream, signal, onChunk, streamState) {
|
|
6416
|
+
async function iterateStreamingPrerenderChunks(stream, signal, onChunk, streamState, drainAfterAbort = process.env.NODE_ENV === 'development') {
|
|
6268
6417
|
if (stream instanceof ReadableStream) {
|
|
6269
6418
|
const reader = stream.getReader();
|
|
6270
6419
|
if (streamState) {
|
|
6271
6420
|
streamState.isPending = true;
|
|
6272
6421
|
}
|
|
6273
|
-
|
|
6274
|
-
// anything emitted after the abort and can cancel immediately.
|
|
6275
|
-
if (process.env.NODE_ENV !== 'development') {
|
|
6422
|
+
if (!drainAfterAbort) {
|
|
6276
6423
|
signal.addEventListener('abort', ()=>{
|
|
6277
6424
|
reader.cancel(signal.reason);
|
|
6278
6425
|
}, {
|
|
@@ -6295,9 +6442,7 @@ async function iterateStreamingPrerenderChunks(stream, signal, onChunk, streamSt
|
|
|
6295
6442
|
streamState.isPending = true;
|
|
6296
6443
|
}
|
|
6297
6444
|
let cancelled = false;
|
|
6298
|
-
|
|
6299
|
-
// anything emitted after the abort and can cancel immediately.
|
|
6300
|
-
if (process.env.NODE_ENV !== 'development') {
|
|
6445
|
+
if (!drainAfterAbort) {
|
|
6301
6446
|
signal.addEventListener('abort', ()=>{
|
|
6302
6447
|
if (!cancelled) {
|
|
6303
6448
|
cancelled = true;
|
|
@@ -6325,11 +6470,7 @@ async function iterateStreamingPrerenderChunks(stream, signal, onChunk, streamSt
|
|
|
6325
6470
|
const getGlobalErrorStyles = async (tree, ctx)=>{
|
|
6326
6471
|
const globalErrorModule = (0, _parseloadertree.parseLoaderTree)(tree).modules['global-error'];
|
|
6327
6472
|
if (!globalErrorModule) {
|
|
6328
|
-
throw
|
|
6329
|
-
value: "E983",
|
|
6330
|
-
enumerable: false,
|
|
6331
|
-
configurable: true
|
|
6332
|
-
});
|
|
6473
|
+
throw new Error('Invariant: global-error module is required but not found in loader tree');
|
|
6333
6474
|
}
|
|
6334
6475
|
const { componentMod: { createElement } } = ctx;
|
|
6335
6476
|
// Get the GlobalError component and styles from the loader tree
|
|
@@ -6407,22 +6548,16 @@ async function collectSegmentData(fullPageDataBuffer, prerenderStore, ComponentM
|
|
|
6407
6548
|
let hints;
|
|
6408
6549
|
const prefetchInlining = renderOpts.experimental.prefetchInlining;
|
|
6409
6550
|
if (renderOpts.isBuildTimePrerendering) {
|
|
6410
|
-
// Whether the client should attempt
|
|
6411
|
-
//
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
// time — see trackRuntimeDataAccessed — so only the settled value is
|
|
6416
|
-
// read here. Only the modern (cacheComponents) prerender tracks
|
|
6417
|
-
// accesses; legacy prerenders conservatively never set the hint.
|
|
6418
|
-
const hintCell = prerenderStore.type === 'prerender' ? prerenderStore.shouldAttemptStaticPrefetch : null;
|
|
6419
|
-
const shouldAttemptStaticPrefetch = hintCell !== null && hintCell.current;
|
|
6420
|
-
if (prefetchInlining || shouldAttemptStaticPrefetch) {
|
|
6551
|
+
// Whether the client should attempt to use static requests for
|
|
6552
|
+
// shells and prefetches. Only applies in routes with Partial Prefetching.
|
|
6553
|
+
const prerenderDataTracking = prerenderStore.type === 'prerender' ? prerenderStore.prerenderDataTracking : null;
|
|
6554
|
+
const { shouldAttemptStaticShell = false, shouldAttemptStaticPrefetch = false } = prerenderDataTracking ?? {};
|
|
6555
|
+
if (prefetchInlining || shouldAttemptStaticShell || shouldAttemptStaticPrefetch) {
|
|
6421
6556
|
// Build time: compute fresh hints and store in metadata for the
|
|
6422
6557
|
// manifest. When prefetch inlining is disabled there are no sizes to
|
|
6423
6558
|
// measure, but the static-prefetch hint still rides the manifest —
|
|
6424
6559
|
// collectPrefetchHints then only builds the tree shape carrying it.
|
|
6425
|
-
hints = await ComponentMod.collectPrefetchHints(fullPageDataBuffer, staleTime, clientModules, serverConsumerManifest, prefetchInlining, shouldAttemptStaticPrefetch);
|
|
6560
|
+
hints = await ComponentMod.collectPrefetchHints(renderOpts.cacheComponents, fullPageDataBuffer, staleTime, clientModules, serverConsumerManifest, prefetchInlining, shouldAttemptStaticShell, shouldAttemptStaticPrefetch);
|
|
6426
6561
|
metadata.prefetchHints = hints;
|
|
6427
6562
|
} else {
|
|
6428
6563
|
// Inlining is disabled and the hint didn't qualify — there's nothing
|
|
@@ -6479,10 +6614,10 @@ async function collectSegmentData(fullPageDataBuffer, prerenderStore, ComponentM
|
|
|
6479
6614
|
const fallbackRouteParams = 'fallbackRouteParams' in prerenderStore ? prerenderStore.fallbackRouteParams : null;
|
|
6480
6615
|
const isUpgradeableISRFallback = fallbackRouteParams != null && fallbackRouteParams.size > 0 && renderOpts.isFallbackUpgradeable === true;
|
|
6481
6616
|
// Pass the resolved hints so collectSegmentData can union them into
|
|
6482
|
-
// the
|
|
6617
|
+
// the /_tree response. During the initial build the transport tree in
|
|
6483
6618
|
// the buffer doesn't have inlining hints yet (they were just computed
|
|
6484
6619
|
// above), so we need to merge them in here. At runtime/ISR the hints
|
|
6485
|
-
// are already embedded in the
|
|
6620
|
+
// are already embedded in the buffer's tree, so this is null.
|
|
6486
6621
|
metadata.segmentData = await ComponentMod.collectSegmentData(renderOpts.cacheComponents, fullPageDataBuffer, staleTime, clientModules, serverConsumerManifest, Boolean(renderOpts.experimental.prefetchInlining), hints, isUpgradeableISRFallback);
|
|
6487
6622
|
}
|
|
6488
6623
|
function isBypassingCachesInDev(requestStore, workStore) {
|