@semiont/frontend 0.3.3 → 0.3.4
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/package.json +1 -1
- package/standalone/apps/frontend/.next/BUILD_ID +1 -1
- package/standalone/apps/frontend/.next/app-path-routes-manifest.json +8 -8
- package/standalone/apps/frontend/.next/build-manifest.json +6 -6
- package/standalone/apps/frontend/.next/prerender-manifest.json +3 -3
- package/standalone/apps/frontend/.next/react-loadable-manifest.json +2 -2
- package/standalone/apps/frontend/.next/required-server-files.json +18 -6
- package/standalone/apps/frontend/.next/routes-manifest.json +1 -0
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js +776 -516
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js +1718 -1455
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js +724 -461
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js +370 -109
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js +581 -318
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js +449 -186
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js +430 -168
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js +31 -16
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js +388 -126
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js +537 -275
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js +388 -126
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js +745 -482
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js +366 -103
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js +600 -339
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js +956 -691
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js +1699 -1436
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js +390 -127
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js +1779 -1518
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js +1601 -1338
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js +2048 -1785
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/page.js +462 -204
- package/standalone/apps/frontend/.next/server/app/[locale]/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js +476 -216
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js +489 -229
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error/page.js +627 -240
- package/standalone/apps/frontend/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.html +1 -2
- package/standalone/apps/frontend/.next/server/app/_global-error.rsc +13 -9
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_full.segment.rsc +13 -9
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error.segment.rsc +2 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_index.segment.rsc +2 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found/page.js +814 -559
- package/standalone/apps/frontend/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.html +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.rsc +8 -6
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_full.segment.rsc +8 -6
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found.segment.rsc +2 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js +54 -39
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js +49 -34
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js +24 -9
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js +24 -9
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app-paths-manifest.json +8 -8
- package/standalone/apps/frontend/.next/server/chunks/2617.js +43 -7
- package/standalone/apps/frontend/.next/server/chunks/3144.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4741.js +60 -252
- package/standalone/apps/frontend/.next/server/chunks/730.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7420.js +21 -288
- package/standalone/apps/frontend/.next/server/chunks/7873.js +24 -2
- package/standalone/apps/frontend/.next/server/chunks/{7246.js → 8569.js} +1169 -282
- package/standalone/apps/frontend/.next/server/chunks/{2628.js → 9927.js} +11422 -4290
- package/standalone/apps/frontend/.next/server/middleware-build-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/middleware.js +17991 -10692
- package/standalone/apps/frontend/.next/server/pages/404.html +1 -1
- package/standalone/apps/frontend/.next/server/pages/500.html +1 -2
- package/standalone/apps/frontend/.next/server/prefetch-hints.json +1 -0
- package/standalone/apps/frontend/.next/server/server-reference-manifest.json +1 -1
- package/standalone/apps/frontend/.next/static/I_XveRdyStDMqYJPcAAy5/_buildManifest.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/1315.3f76aa23520d903e.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/{432.4c1d971431c60454.js → 432.8cb455bfe72957a9.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/87c73c54-e11922cda838f8cc.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/{891cff7f-c20ce667b1225aa7.js → 891cff7f-d7677a8f46c597cc.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/{layout-4b67f7b5d5ba4728.js → layout-956ba0ffa1199bff.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/{layout-f76e1916749e66f6.js → layout-262d8dd6c6e33738.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/{layout-a403fd7a4877cc04.js → layout-c072ce8c7aeaa92e.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/{layout-2d4e9c2be4b4a4c7.js → layout-b60605082e447f42.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/{common-ac307b22cd0a4080.js → common-42653c14d34c8864.js} +7 -7
- package/standalone/apps/frontend/.next/static/chunks/framework-b879567b90d34fb5.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/vendors-63213253c18580f4.js +40 -0
- package/standalone/apps/frontend/.next/static/chunks/{webpack-abf2ad17f175f867.js → webpack-a0284d55d288650f.js} +1 -1
- package/standalone/apps/frontend/package.json +5 -5
- package/standalone/apps/frontend/server.js +1 -1
- package/standalone/node_modules/@next/env/package.json +1 -1
- package/standalone/node_modules/next/dist/build/adapter/setup-node-env.external.js +15 -0
- package/standalone/node_modules/next/dist/build/analysis/extract-const-value.js +78 -63
- package/standalone/node_modules/next/dist/build/analysis/get-page-static-info.js +64 -40
- package/standalone/node_modules/next/dist/build/create-compiler-aliases.js +2 -0
- package/standalone/node_modules/next/dist/build/define-env.js +29 -11
- package/standalone/node_modules/next/dist/build/duration-to-string.js +1 -1
- package/standalone/node_modules/next/dist/build/entries.js +55 -295
- package/standalone/node_modules/next/dist/build/file-classifier.js +76 -0
- package/standalone/node_modules/next/dist/build/get-supported-browsers.js +38 -0
- package/standalone/node_modules/next/dist/build/load-jsconfig.js +7 -7
- package/standalone/node_modules/next/dist/build/lockfile.js +90 -9
- package/standalone/node_modules/next/dist/build/next-config-ts/transpile-config.js +128 -49
- package/standalone/node_modules/next/dist/build/print-build-errors.js +72 -0
- package/standalone/node_modules/next/dist/build/route-discovery.js +353 -0
- package/standalone/node_modules/next/dist/build/segment-config/app/app-segment-config.js +34 -17
- package/standalone/node_modules/next/dist/build/static-paths/app.js +68 -15
- package/standalone/node_modules/next/dist/build/static-paths/pages.js +3 -3
- package/standalone/node_modules/next/dist/build/swc/index.js +125 -48
- package/standalone/node_modules/next/dist/build/swc/loaderWorkerPool.js +40 -0
- package/standalone/node_modules/next/dist/build/swc/options.js +23 -6
- package/standalone/node_modules/next/dist/build/utils.js +48 -94
- package/standalone/node_modules/next/dist/build/webpack/config/blocks/css/index.js +14 -3
- package/standalone/node_modules/next/dist/build/webpack/config/blocks/css/loaders/global.js +4 -2
- package/standalone/node_modules/next/dist/build/webpack/config/blocks/css/loaders/modules.js +4 -2
- package/standalone/node_modules/next/dist/build/webpack/config/blocks/css/loaders/next-font.js +1 -0
- package/standalone/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js +5 -5
- package/standalone/node_modules/next/dist/build/webpack/config/index.js +3 -2
- package/standalone/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js +2 -1
- package/standalone/node_modules/next/dist/build/webpack/loaders/css-loader/src/plugins/postcss-url-parser.js +8 -1
- package/standalone/node_modules/next/dist/build/webpack/loaders/lightningcss-loader/src/loader.js +13 -4
- package/standalone/node_modules/next/dist/build/webpack/loaders/next-middleware-loader.js +3 -1
- package/standalone/node_modules/next/dist/build/webpack/plugins/build-manifest-plugin-utils.js +2 -16
- package/standalone/node_modules/next/dist/build/webpack/plugins/build-manifest-plugin.js +2 -2
- package/standalone/node_modules/next/dist/build/webpack/plugins/deferred-entries-plugin.js +106 -0
- package/standalone/node_modules/next/dist/build/webpack/plugins/flight-client-entry-plugin.js +16 -8
- package/standalone/node_modules/next/dist/build/webpack/plugins/flight-manifest-plugin.js +24 -11
- package/standalone/node_modules/next/dist/build/webpack/plugins/middleware-plugin.js +21 -2
- package/standalone/node_modules/next/dist/build/webpack/plugins/next-types-plugin/index.js +6 -5
- package/standalone/node_modules/next/dist/build/webpack/plugins/nextjs-require-cache-hot-reloader.js +10 -14
- package/standalone/node_modules/next/dist/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.js +18 -4
- package/standalone/node_modules/next/dist/build/webpack/plugins/wellknown-errors-plugin/parseScss.js +5 -4
- package/standalone/node_modules/next/dist/build/webpack-config.js +18 -8
- package/standalone/node_modules/next/dist/cli/next-test.js +4 -3
- package/standalone/node_modules/next/dist/client/app-find-source-map-url.js +2 -1
- package/standalone/node_modules/next/dist/client/components/app-router-headers.js +10 -0
- package/standalone/node_modules/next/dist/client/components/app-router-instance.js +82 -4
- package/standalone/node_modules/next/dist/client/components/app-router.js +39 -20
- package/standalone/node_modules/next/dist/client/components/builtin/app-error.js +29 -65
- package/standalone/node_modules/next/dist/client/components/builtin/error-styles.js +165 -0
- package/standalone/node_modules/next/dist/client/components/builtin/global-error.js +56 -38
- package/standalone/node_modules/next/dist/client/components/error-boundary.js +16 -6
- package/standalone/node_modules/next/dist/client/components/forbidden.js +1 -1
- package/standalone/node_modules/next/dist/client/components/handle-isr-error.js +3 -4
- package/standalone/node_modules/next/dist/client/components/links.js +7 -0
- package/standalone/node_modules/next/dist/client/components/navigation-untracked.js +2 -0
- package/standalone/node_modules/next/dist/client/components/navigation.js +27 -0
- package/standalone/node_modules/next/dist/client/components/navigation.react-server.js +5 -2
- package/standalone/node_modules/next/dist/client/components/not-found.js +1 -1
- package/standalone/node_modules/next/dist/client/components/redirect-boundary.js +1 -1
- package/standalone/node_modules/next/dist/client/components/redirect-error.js +0 -9
- package/standalone/node_modules/next/dist/client/components/redirect.js +2 -2
- package/standalone/node_modules/next/dist/client/components/router-reducer/compute-changed-path.js +73 -0
- package/standalone/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +102 -8
- package/standalone/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +165 -48
- package/standalone/node_modules/next/dist/client/components/router-reducer/is-navigating-to-new-root-layout.js +19 -11
- package/standalone/node_modules/next/dist/client/components/router-reducer/ppr-navigations.js +669 -457
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/committed-state.js +49 -0
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/find-head-in-cache.js +19 -20
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +5 -117
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +34 -19
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +16 -32
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +85 -57
- package/standalone/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +12 -10
- package/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer-types.js +10 -1
- package/standalone/node_modules/next/dist/client/components/router-reducer/router-reducer.js +1 -1
- package/standalone/node_modules/next/dist/client/components/segment-cache/bfcache.js +128 -0
- package/standalone/node_modules/next/dist/client/components/segment-cache/cache.js +732 -231
- package/standalone/node_modules/next/dist/client/components/segment-cache/lru.js +13 -6
- package/standalone/node_modules/next/dist/client/components/segment-cache/navigation-testing-lock.js +194 -0
- package/standalone/node_modules/next/dist/client/components/segment-cache/navigation.js +388 -250
- package/standalone/node_modules/next/dist/client/components/segment-cache/optimistic-routes.js +543 -0
- package/standalone/node_modules/next/dist/client/components/segment-cache/scheduler.js +154 -55
- package/standalone/node_modules/next/dist/client/components/segment-cache/vary-path.js +63 -1
- package/standalone/node_modules/next/dist/client/components/unauthorized.js +1 -1
- package/standalone/node_modules/next/dist/client/components/use-action-queue.js +49 -3
- package/standalone/node_modules/next/dist/client/dev/hot-reloader/app/hot-reloader-app.js +9 -1
- package/standalone/node_modules/next/dist/client/flight-data-helpers.js +42 -29
- package/standalone/node_modules/next/dist/client/lib/javascript-url.js +32 -0
- package/standalone/node_modules/next/dist/client/lib/promise.js +53 -0
- package/standalone/node_modules/next/dist/client/{app-build-id.js → navigation-build-id.js} +17 -13
- package/standalone/node_modules/next/dist/client/react-client-callbacks/on-recoverable-error.js +14 -0
- package/standalone/node_modules/next/dist/client/route-loader.js +9 -46
- package/standalone/node_modules/next/dist/client/router.js +1 -1
- package/standalone/node_modules/next/dist/compiled/@next/font/dist/google/font-data.json +74 -3
- package/standalone/node_modules/next/dist/compiled/babel/bundle.js +1 -1
- package/standalone/node_modules/next/dist/compiled/babel-packages/packages-bundle.js +4 -4
- package/standalone/node_modules/next/dist/compiled/browserslist/index.js +1 -1
- package/standalone/node_modules/next/dist/compiled/http-proxy/index.js +5 -5
- package/standalone/node_modules/next/dist/compiled/next-devtools/index.js +2209 -23
- package/standalone/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js +42 -12
- package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +42 -12
- package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +42 -12
- package/standalone/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js +42 -12
- package/standalone/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js +2 -2
- package/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +10 -10
- package/standalone/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js +10 -10
- package/standalone/node_modules/next/dist/compiled/react-is/package.json +1 -1
- package/standalone/node_modules/next/dist/compiled/tar/index.min.js +1 -0
- package/standalone/node_modules/next/dist/compiled/tar/package.json +1 -1
- package/standalone/node_modules/next/dist/compiled/unistore/unistore.js +1 -1
- package/standalone/node_modules/next/dist/lib/bundler.js +97 -0
- package/standalone/node_modules/next/dist/lib/constants.js +19 -4
- package/standalone/node_modules/next/dist/lib/download-swc.js +2 -2
- package/standalone/node_modules/next/dist/lib/find-root.js +11 -7
- package/standalone/node_modules/next/dist/lib/format-server-error.js +1 -0
- package/standalone/node_modules/next/dist/lib/generate-interception-routes-rewrites.js +3 -20
- package/standalone/node_modules/next/dist/lib/interop-default.js +1 -0
- package/standalone/node_modules/next/dist/lib/is-interception-route-rewrite.js +18 -0
- package/standalone/node_modules/next/dist/lib/load-custom-routes.js +49 -5
- package/standalone/node_modules/next/dist/lib/memory/trace.js +109 -0
- package/standalone/node_modules/next/dist/lib/metadata/get-metadata-route.js +11 -2
- package/standalone/node_modules/next/dist/lib/needs-experimental-react.js +2 -2
- package/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +5 -5
- package/standalone/node_modules/next/dist/lib/try-to-parse-path.js +1 -2
- package/standalone/node_modules/next/dist/lib/turbopack-warning.js +0 -1
- package/standalone/node_modules/next/dist/lib/typescript/diagnosticFormatter.js +6 -3
- package/standalone/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +1 -1
- package/standalone/node_modules/next/dist/lib/typescript/missingDependencyError.js +1 -1
- package/standalone/node_modules/next/dist/lib/typescript/runTypeCheck.js +6 -8
- package/standalone/node_modules/next/dist/lib/typescript/type-paths.js +7 -12
- package/standalone/node_modules/next/dist/lib/typescript/writeAppTypeDeclarations.js +17 -7
- package/standalone/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js +9 -12
- package/standalone/node_modules/next/dist/lib/verify-typescript-setup.js +66 -16
- package/standalone/node_modules/next/dist/next-devtools/server/shared.js +6 -10
- package/standalone/node_modules/next/dist/next-devtools/shared/webpack-module-path.js +4 -4
- package/standalone/node_modules/next/dist/next-devtools/userspace/app/app-dev-overlay-error-boundary.js +22 -4
- package/standalone/node_modules/next/dist/next-devtools/userspace/app/errors/stitched-error.js +7 -1
- package/standalone/node_modules/next/dist/next-devtools/userspace/app/forward-logs.js +18 -13
- package/standalone/node_modules/next/dist/next-devtools/userspace/app/segment-explorer-node.js +7 -4
- package/standalone/node_modules/next/dist/server/app-render/action-handler.js +83 -15
- package/standalone/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +0 -82
- package/standalone/node_modules/next/dist/server/app-render/app-render-render-utils.js +45 -81
- package/standalone/node_modules/next/dist/server/app-render/app-render.js +1746 -803
- package/standalone/node_modules/next/dist/server/app-render/create-component-tree.js +136 -50
- package/standalone/node_modules/next/dist/server/app-render/create-error-handler.js +6 -4
- package/standalone/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js +52 -26
- package/standalone/node_modules/next/dist/server/app-render/csrf-protection.js +14 -3
- package/standalone/node_modules/next/dist/server/app-render/debug-channel-server.js +30 -0
- package/standalone/node_modules/next/dist/server/app-render/debug-channel-server.web.js +71 -0
- package/standalone/node_modules/next/dist/server/app-render/dynamic-rendering.js +353 -37
- package/standalone/node_modules/next/dist/server/app-render/get-asset-query-string.js +2 -2
- package/standalone/node_modules/next/dist/server/app-render/get-layer-assets.js +1 -1
- package/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js +13 -0
- package/standalone/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js +18 -0
- package/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-config.js +181 -0
- package/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-samples-client.js +128 -0
- package/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js +432 -0
- package/standalone/node_modules/next/dist/server/app-render/instant-validation/instant-validation-error.js +33 -0
- package/standalone/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js +96 -0
- package/standalone/node_modules/next/dist/server/app-render/manifests-singleton.js +8 -1
- package/standalone/node_modules/next/dist/server/app-render/postponed-state.js +2 -1
- package/standalone/node_modules/next/dist/server/app-render/prospective-render-utils.js +1 -0
- package/standalone/node_modules/next/dist/server/app-render/segment-explorer-path.js +35 -10
- package/standalone/node_modules/next/dist/server/app-render/staged-rendering.js +142 -72
- package/standalone/node_modules/next/dist/server/app-render/stale-time.js +111 -0
- package/standalone/node_modules/next/dist/server/app-render/stream-ops.js +106 -0
- package/standalone/node_modules/next/dist/server/app-render/stream-ops.web.js +163 -0
- package/standalone/node_modules/next/dist/server/app-render/types.js +10 -4
- package/standalone/node_modules/next/dist/server/app-render/use-flight-response.js +3 -1
- package/standalone/node_modules/next/dist/server/app-render/vary-params.js +336 -0
- package/standalone/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +59 -12
- package/standalone/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +54 -26
- package/standalone/node_modules/next/dist/server/async-storage/request-store.js +4 -4
- package/standalone/node_modules/next/dist/server/async-storage/work-store.js +2 -5
- package/standalone/node_modules/next/dist/server/base-server.js +65 -53
- package/standalone/node_modules/next/dist/server/config-schema.js +93 -8
- package/standalone/node_modules/next/dist/server/config-shared.js +57 -7
- package/standalone/node_modules/next/dist/server/config.js +96 -25
- package/standalone/node_modules/next/dist/server/dev/browser-logs/file-logger.js +9 -6
- package/standalone/node_modules/next/dist/server/dev/browser-logs/receive-logs.js +46 -0
- package/standalone/node_modules/next/dist/server/dev/browser-logs/source-map.js +1 -4
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +264 -33
- package/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +8 -4
- package/standalone/node_modules/next/dist/server/dev/log-requests.js +10 -2
- package/standalone/node_modules/next/dist/server/dev/middleware-turbopack.js +20 -10
- package/standalone/node_modules/next/dist/server/dev/middleware-webpack.js +13 -3
- package/standalone/node_modules/next/dist/server/dev/next-dev-server.js +19 -6
- package/standalone/node_modules/next/dist/server/dev/on-demand-entry-handler.js +69 -0
- package/standalone/node_modules/next/dist/server/dev/require-cache.js +51 -21
- package/standalone/node_modules/next/dist/server/dev/server-action-logger.js +37 -0
- package/standalone/node_modules/next/dist/server/dev/static-paths-worker.js +1 -0
- package/standalone/node_modules/next/dist/server/dev/turbopack-utils.js +6 -15
- package/standalone/node_modules/next/dist/server/dynamic-rendering-utils.js +22 -0
- package/standalone/node_modules/next/dist/server/image-optimizer.js +157 -27
- package/standalone/node_modules/next/dist/server/lib/app-info-log.js +16 -38
- package/standalone/node_modules/next/dist/server/lib/cache-control.js +1 -1
- package/standalone/node_modules/next/dist/server/lib/clone-response.js +16 -16
- package/standalone/node_modules/next/dist/server/lib/cpu-profile.js +47 -16
- package/standalone/node_modules/next/dist/server/lib/dev-bundler-service.js +2 -2
- package/standalone/node_modules/next/dist/server/lib/disk-lru-cache.external.js +57 -0
- package/standalone/node_modules/next/dist/server/lib/find-page-file.js +27 -7
- package/standalone/node_modules/next/dist/server/lib/implicit-tags.js +3 -3
- package/standalone/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +5 -3
- package/standalone/node_modules/next/dist/server/lib/incremental-cache/index.js +32 -10
- package/standalone/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +18 -1
- package/standalone/node_modules/next/dist/server/lib/install-code-frame.js +22 -0
- package/standalone/node_modules/next/dist/server/lib/lru-cache.js +9 -1
- package/standalone/node_modules/next/dist/server/lib/patch-fetch.js +40 -7
- package/standalone/node_modules/next/dist/server/lib/postponed-request-body.js +64 -0
- package/standalone/node_modules/next/dist/server/lib/render-server.js +4 -1
- package/standalone/node_modules/next/dist/server/lib/router-server.js +24 -13
- package/standalone/node_modules/next/dist/server/lib/router-utils/block-cross-site-dev.js +110 -0
- package/standalone/node_modules/next/dist/server/lib/router-utils/filesystem.js +16 -15
- package/standalone/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +32 -11
- package/standalone/node_modules/next/dist/server/lib/router-utils/route-types-utils.js +3 -3
- package/standalone/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js +71 -71
- package/standalone/node_modules/next/dist/server/lib/router-utils/typegen.js +247 -2
- package/standalone/node_modules/next/dist/server/lib/server-ipc/utils.js +2 -1
- package/standalone/node_modules/next/dist/server/lib/start-server.js +73 -39
- package/standalone/node_modules/next/dist/server/lib/trace/tracer.js +11 -1
- package/standalone/node_modules/next/dist/server/lib/utils.js +40 -11
- package/standalone/node_modules/next/dist/server/load-components.js +2 -0
- package/standalone/node_modules/next/dist/server/load-manifest.external.js +37 -17
- package/standalone/node_modules/next/dist/server/mcp/tools/get-errors.js +11 -4
- package/standalone/node_modules/next/dist/server/mcp/tools/get-logs.js +9 -3
- package/standalone/node_modules/next/dist/server/mcp/tools/get-page-metadata.js +52 -44
- package/standalone/node_modules/next/dist/server/mcp/tools/get-project-metadata.js +6 -2
- package/standalone/node_modules/next/dist/server/mcp/tools/get-routes.js +44 -79
- package/standalone/node_modules/next/dist/server/mcp/tools/get-server-action-by-id.js +12 -4
- package/standalone/node_modules/next/dist/server/mcp/tools/utils/format-errors.js +62 -72
- package/standalone/node_modules/next/dist/server/next-server.js +69 -99
- package/standalone/node_modules/next/dist/server/next.js +3 -0
- package/standalone/node_modules/next/dist/server/node-environment-extensions/console-dim.external.js +61 -6
- package/standalone/node_modules/next/dist/server/node-environment-extensions/date.js +4 -4
- package/standalone/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +13 -6
- package/standalone/node_modules/next/dist/server/node-environment-extensions/{utils.js → io-utils.js} +14 -5
- package/standalone/node_modules/next/dist/server/node-environment-extensions/node-crypto.js +8 -8
- package/standalone/node_modules/next/dist/server/node-environment-extensions/process-error-handlers.js +91 -0
- package/standalone/node_modules/next/dist/server/node-environment-extensions/random.js +2 -2
- package/standalone/node_modules/next/dist/server/node-environment-extensions/{unhandled-rejection.js → unhandled-rejection.external.js} +23 -4
- package/standalone/node_modules/next/dist/server/node-environment-extensions/web-crypto.js +3 -3
- package/standalone/node_modules/next/dist/server/node-environment.js +1 -1
- package/standalone/node_modules/next/dist/server/normalizers/request/segment-prefix-rsc.js +2 -1
- package/standalone/node_modules/next/dist/server/patch-error-inspect.js +37 -20
- package/standalone/node_modules/next/dist/server/render-result.js +9 -0
- package/standalone/node_modules/next/dist/server/render.js +27 -25
- package/standalone/node_modules/next/dist/server/require-hook.js +19 -8
- package/standalone/node_modules/next/dist/server/response-cache/utils.js +1 -0
- package/standalone/node_modules/next/dist/server/resume-data-cache/cache-store.js +35 -23
- package/standalone/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +16 -7
- package/standalone/node_modules/next/dist/server/revalidation-utils.js +12 -7
- package/standalone/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-page-route-matcher-provider.js +2 -1
- package/standalone/node_modules/next/dist/server/route-modules/app-page/helpers/prerender-manifest-matcher.js +4 -1
- package/standalone/node_modules/next/dist/server/route-modules/app-page/module.js +31 -1
- package/standalone/node_modules/next/dist/server/route-modules/app-page/normalize-request-url.js +25 -0
- package/standalone/node_modules/next/dist/server/route-modules/pages/pages-handler.js +31 -8
- package/standalone/node_modules/next/dist/server/route-modules/route-module.js +71 -18
- package/standalone/node_modules/next/dist/server/stream-utils/encoded-tags.js +8 -0
- package/standalone/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +239 -58
- package/standalone/node_modules/next/dist/server/stream-utils/uint8array-helpers.js +7 -2
- package/standalone/node_modules/next/dist/server/typescript/constant.js +1 -0
- package/standalone/node_modules/next/dist/server/typescript/rules/config.js +14 -3
- package/standalone/node_modules/next/dist/server/web/adapter.js +7 -3
- package/standalone/node_modules/next/dist/server/web/next-url.js +6 -2
- package/standalone/node_modules/next/dist/server/web/sandbox/sandbox.js +3 -0
- package/standalone/node_modules/next/dist/shared/lib/app-router-types.js +30 -11
- package/standalone/node_modules/next/dist/shared/lib/constants.js +7 -7
- package/standalone/node_modules/next/dist/shared/lib/deployment-id.js +37 -10
- package/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/standalone/node_modules/next/dist/shared/lib/errors/code-frame.js +20 -0
- package/standalone/node_modules/next/dist/shared/lib/format-webpack-messages.js +22 -2
- package/standalone/node_modules/next/dist/shared/lib/image-config.js +3 -1
- package/standalone/node_modules/next/dist/shared/lib/is-internal.js +2 -0
- package/standalone/node_modules/next/dist/shared/lib/magic-identifier.js +6 -6
- package/standalone/node_modules/next/dist/shared/lib/router/router.js +32 -0
- package/standalone/node_modules/next/dist/shared/lib/router/utils/app-paths.js +11 -0
- package/standalone/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +11 -4
- package/standalone/node_modules/next/dist/shared/lib/router/utils/parse-loader-tree.js +3 -2
- package/standalone/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js +9 -2
- package/standalone/node_modules/next/dist/shared/lib/router/utils/parse-url.js +8 -2
- package/standalone/node_modules/next/dist/shared/lib/segment-cache/vary-params-decoding.js +32 -0
- package/standalone/node_modules/next/dist/shared/lib/server-reference-info.js +4 -0
- package/standalone/node_modules/next/dist/shared/lib/size-limit.js +6 -1
- package/standalone/node_modules/next/dist/shared/lib/turbopack/compilation-events.js +47 -10
- package/standalone/node_modules/next/dist/shared/lib/turbopack/manifest-loader.js +90 -116
- package/standalone/node_modules/next/dist/shared/lib/turbopack/utils.js +14 -26
- package/standalone/node_modules/next/dist/shared/lib/utils/reflect-utils.js +69 -0
- package/standalone/node_modules/next/dist/shared/lib/utils.js +2 -2
- package/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/standalone/node_modules/next/dist/trace/index.js +4 -0
- package/standalone/node_modules/next/dist/trace/report/to-json-build.js +11 -108
- package/standalone/node_modules/next/dist/trace/report/to-json.js +52 -38
- package/standalone/node_modules/next/dist/trace/trace.js +15 -1
- package/standalone/node_modules/next/package.json +21 -23
- package/standalone/node_modules/react/cjs/react.development.js +1284 -0
- package/standalone/package.json +3 -3
- package/standalone/packages/core/package.json +1 -1
- package/standalone/apps/frontend/.next/static/chunks/1315.18c68981a2eab4fe.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/87c73c54-c5fda2db2a4bd732.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/framework-86c2a58f458066a5.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/vendors-c7197feb11002a6e.js +0 -10
- package/standalone/apps/frontend/.next/static/xSLAuzRvOCf1TdGHvLFQ0/_buildManifest.js +0 -1
- package/standalone/node_modules/next/dist/client/components/router-reducer/handle-mutable.js +0 -66
- package/standalone/node_modules/next/dist/compiled/babel/code-frame.js +0 -1
- package/standalone/node_modules/next/dist/compiled/babel-code-frame/index.js +0 -1
- package/standalone/node_modules/next/dist/compiled/babel-code-frame/package.json +0 -1
- package/standalone/node_modules/next/dist/compiled/tar/index.js +0 -1
- package/standalone/node_modules/next/dist/server/app-render/staged-validation.js +0 -32
- package/standalone/node_modules/next/dist/server/lib/router-utils/block-cross-site.js +0 -76
- package/standalone/node_modules/next/dist/shared/lib/segment-cache/output-export-prefetch-encoding.js +0 -52
- package/standalone/node_modules/typescript/lib/typescript.js +0 -200276
- package/standalone/node_modules/typescript/package.json +0 -120
- /package/standalone/apps/frontend/.next/static/{xSLAuzRvOCf1TdGHvLFQ0 → I_XveRdyStDMqYJPcAAy5}/_ssgManifest.js +0 -0
|
@@ -4,26 +4,43 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
0 && (module.exports = {
|
|
6
6
|
EntryStatus: null,
|
|
7
|
+
attemptToFulfillDynamicSegmentFromBFCache: null,
|
|
8
|
+
attemptToUpgradeSegmentFromBFCache: null,
|
|
7
9
|
canNewFetchStrategyProvideMoreContent: null,
|
|
10
|
+
convertReusedFlightRouterStateToRouteTree: null,
|
|
11
|
+
convertRootFlightRouterStateToRouteTree: null,
|
|
8
12
|
convertRouteTreeToFlightRouterState: null,
|
|
9
13
|
createDetachedSegmentCacheEntry: null,
|
|
14
|
+
createMetadataRouteTree: null,
|
|
15
|
+
deprecated_requestOptimisticRouteCacheEntry: null,
|
|
16
|
+
fetchInlinedSegmentsOnCacheMiss: null,
|
|
10
17
|
fetchRouteOnCacheMiss: null,
|
|
11
18
|
fetchSegmentOnCacheMiss: null,
|
|
12
19
|
fetchSegmentPrefetchesUsingDynamicRequest: null,
|
|
13
|
-
|
|
20
|
+
fulfillRouteCacheEntry: null,
|
|
21
|
+
getCurrentRouteCacheVersion: null,
|
|
22
|
+
getCurrentSegmentCacheVersion: null,
|
|
23
|
+
getStaleAt: null,
|
|
14
24
|
getStaleTimeMs: null,
|
|
25
|
+
invalidateEntirePrefetchCache: null,
|
|
26
|
+
invalidateRouteCacheEntries: null,
|
|
27
|
+
invalidateSegmentCacheEntries: null,
|
|
28
|
+
markRouteEntryAsDynamicRewrite: null,
|
|
15
29
|
overwriteRevalidatingSegmentCacheEntry: null,
|
|
16
30
|
pingInvalidationListeners: null,
|
|
31
|
+
processRuntimePrefetchStream: null,
|
|
17
32
|
readOrCreateRevalidatingSegmentEntry: null,
|
|
18
33
|
readOrCreateRouteCacheEntry: null,
|
|
19
34
|
readOrCreateSegmentCacheEntry: null,
|
|
20
35
|
readRouteCacheEntry: null,
|
|
21
36
|
readSegmentCacheEntry: null,
|
|
22
|
-
|
|
23
|
-
revalidateEntireCache: null,
|
|
37
|
+
stripIsPartialByte: null,
|
|
24
38
|
upgradeToPendingSegment: null,
|
|
25
39
|
upsertSegmentEntry: null,
|
|
26
|
-
waitForSegmentCacheEntry: null
|
|
40
|
+
waitForSegmentCacheEntry: null,
|
|
41
|
+
writeDynamicRenderResponseIntoCache: null,
|
|
42
|
+
writeRouteIntoCache: null,
|
|
43
|
+
writeStaticStageResponseIntoCache: null
|
|
27
44
|
});
|
|
28
45
|
function _export(target, all) {
|
|
29
46
|
for(var name in all)Object.defineProperty(target, name, {
|
|
@@ -35,15 +52,36 @@ _export(exports, {
|
|
|
35
52
|
EntryStatus: function() {
|
|
36
53
|
return EntryStatus;
|
|
37
54
|
},
|
|
55
|
+
attemptToFulfillDynamicSegmentFromBFCache: function() {
|
|
56
|
+
return attemptToFulfillDynamicSegmentFromBFCache;
|
|
57
|
+
},
|
|
58
|
+
attemptToUpgradeSegmentFromBFCache: function() {
|
|
59
|
+
return attemptToUpgradeSegmentFromBFCache;
|
|
60
|
+
},
|
|
38
61
|
canNewFetchStrategyProvideMoreContent: function() {
|
|
39
62
|
return canNewFetchStrategyProvideMoreContent;
|
|
40
63
|
},
|
|
64
|
+
convertReusedFlightRouterStateToRouteTree: function() {
|
|
65
|
+
return convertReusedFlightRouterStateToRouteTree;
|
|
66
|
+
},
|
|
67
|
+
convertRootFlightRouterStateToRouteTree: function() {
|
|
68
|
+
return convertRootFlightRouterStateToRouteTree;
|
|
69
|
+
},
|
|
41
70
|
convertRouteTreeToFlightRouterState: function() {
|
|
42
71
|
return convertRouteTreeToFlightRouterState;
|
|
43
72
|
},
|
|
44
73
|
createDetachedSegmentCacheEntry: function() {
|
|
45
74
|
return createDetachedSegmentCacheEntry;
|
|
46
75
|
},
|
|
76
|
+
createMetadataRouteTree: function() {
|
|
77
|
+
return createMetadataRouteTree;
|
|
78
|
+
},
|
|
79
|
+
deprecated_requestOptimisticRouteCacheEntry: function() {
|
|
80
|
+
return deprecated_requestOptimisticRouteCacheEntry;
|
|
81
|
+
},
|
|
82
|
+
fetchInlinedSegmentsOnCacheMiss: function() {
|
|
83
|
+
return fetchInlinedSegmentsOnCacheMiss;
|
|
84
|
+
},
|
|
47
85
|
fetchRouteOnCacheMiss: function() {
|
|
48
86
|
return fetchRouteOnCacheMiss;
|
|
49
87
|
},
|
|
@@ -53,18 +91,42 @@ _export(exports, {
|
|
|
53
91
|
fetchSegmentPrefetchesUsingDynamicRequest: function() {
|
|
54
92
|
return fetchSegmentPrefetchesUsingDynamicRequest;
|
|
55
93
|
},
|
|
56
|
-
|
|
57
|
-
return
|
|
94
|
+
fulfillRouteCacheEntry: function() {
|
|
95
|
+
return fulfillRouteCacheEntry;
|
|
96
|
+
},
|
|
97
|
+
getCurrentRouteCacheVersion: function() {
|
|
98
|
+
return getCurrentRouteCacheVersion;
|
|
99
|
+
},
|
|
100
|
+
getCurrentSegmentCacheVersion: function() {
|
|
101
|
+
return getCurrentSegmentCacheVersion;
|
|
102
|
+
},
|
|
103
|
+
getStaleAt: function() {
|
|
104
|
+
return getStaleAt;
|
|
58
105
|
},
|
|
59
106
|
getStaleTimeMs: function() {
|
|
60
107
|
return getStaleTimeMs;
|
|
61
108
|
},
|
|
109
|
+
invalidateEntirePrefetchCache: function() {
|
|
110
|
+
return invalidateEntirePrefetchCache;
|
|
111
|
+
},
|
|
112
|
+
invalidateRouteCacheEntries: function() {
|
|
113
|
+
return invalidateRouteCacheEntries;
|
|
114
|
+
},
|
|
115
|
+
invalidateSegmentCacheEntries: function() {
|
|
116
|
+
return invalidateSegmentCacheEntries;
|
|
117
|
+
},
|
|
118
|
+
markRouteEntryAsDynamicRewrite: function() {
|
|
119
|
+
return markRouteEntryAsDynamicRewrite;
|
|
120
|
+
},
|
|
62
121
|
overwriteRevalidatingSegmentCacheEntry: function() {
|
|
63
122
|
return overwriteRevalidatingSegmentCacheEntry;
|
|
64
123
|
},
|
|
65
124
|
pingInvalidationListeners: function() {
|
|
66
125
|
return pingInvalidationListeners;
|
|
67
126
|
},
|
|
127
|
+
processRuntimePrefetchStream: function() {
|
|
128
|
+
return processRuntimePrefetchStream;
|
|
129
|
+
},
|
|
68
130
|
readOrCreateRevalidatingSegmentEntry: function() {
|
|
69
131
|
return readOrCreateRevalidatingSegmentEntry;
|
|
70
132
|
},
|
|
@@ -80,11 +142,8 @@ _export(exports, {
|
|
|
80
142
|
readSegmentCacheEntry: function() {
|
|
81
143
|
return readSegmentCacheEntry;
|
|
82
144
|
},
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
},
|
|
86
|
-
revalidateEntireCache: function() {
|
|
87
|
-
return revalidateEntireCache;
|
|
145
|
+
stripIsPartialByte: function() {
|
|
146
|
+
return stripIsPartialByte;
|
|
88
147
|
},
|
|
89
148
|
upgradeToPendingSegment: function() {
|
|
90
149
|
return upgradeToPendingSegment;
|
|
@@ -94,14 +153,22 @@ _export(exports, {
|
|
|
94
153
|
},
|
|
95
154
|
waitForSegmentCacheEntry: function() {
|
|
96
155
|
return waitForSegmentCacheEntry;
|
|
156
|
+
},
|
|
157
|
+
writeDynamicRenderResponseIntoCache: function() {
|
|
158
|
+
return writeDynamicRenderResponseIntoCache;
|
|
159
|
+
},
|
|
160
|
+
writeRouteIntoCache: function() {
|
|
161
|
+
return writeRouteIntoCache;
|
|
162
|
+
},
|
|
163
|
+
writeStaticStageResponseIntoCache: function() {
|
|
164
|
+
return writeStaticStageResponseIntoCache;
|
|
97
165
|
}
|
|
98
166
|
});
|
|
99
|
-
const
|
|
167
|
+
const _varyparamsdecoding = require("../../../shared/lib/segment-cache/vary-params-decoding");
|
|
100
168
|
const _approuterheaders = require("../app-router-headers");
|
|
101
169
|
const _fetchserverresponse = require("../router-reducer/fetch-server-response");
|
|
102
170
|
const _scheduler = require("./scheduler");
|
|
103
171
|
const _varypath = require("./vary-path");
|
|
104
|
-
const _appbuildid = require("../../app-build-id");
|
|
105
172
|
const _createhreffromurl = require("../router-reducer/create-href-from-url");
|
|
106
173
|
const _cachekey = require("./cache-key");
|
|
107
174
|
const _routeparams = require("../../route-params");
|
|
@@ -113,6 +180,11 @@ const _links = require("../links");
|
|
|
113
180
|
const _segment = require("../../../shared/lib/segment");
|
|
114
181
|
const _types = require("./types");
|
|
115
182
|
const _promisewithresolvers = require("../../../shared/lib/promise-with-resolvers");
|
|
183
|
+
const _bfcache = require("./bfcache");
|
|
184
|
+
const _optimisticroutes = require("./optimistic-routes");
|
|
185
|
+
const _navigation = require("./navigation");
|
|
186
|
+
const _navigationbuildid = require("../../navigation-build-id");
|
|
187
|
+
const _constants = require("../../../lib/constants");
|
|
116
188
|
function getStaleTimeMs(staleTimeSeconds) {
|
|
117
189
|
return Math.max(staleTimeSeconds, 30) * 1000;
|
|
118
190
|
}
|
|
@@ -139,26 +211,32 @@ let segmentCacheMap = (0, _cachemap.createCacheMap)();
|
|
|
139
211
|
// the listeners and allow the caller to poll the prefetch cache with a new
|
|
140
212
|
// prefetch task if desired.
|
|
141
213
|
let invalidationListeners = null;
|
|
142
|
-
// Incrementing
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
214
|
+
// Incrementing counters used to track cache invalidations. Route and segment
|
|
215
|
+
// caches have separate versions so they can be invalidated independently.
|
|
216
|
+
// Invalidation does not eagerly evict anything from the cache; entries are
|
|
217
|
+
// lazily evicted when read.
|
|
218
|
+
let currentRouteCacheVersion = 0;
|
|
219
|
+
let currentSegmentCacheVersion = 0;
|
|
220
|
+
function getCurrentRouteCacheVersion() {
|
|
221
|
+
return currentRouteCacheVersion;
|
|
222
|
+
}
|
|
223
|
+
function getCurrentSegmentCacheVersion() {
|
|
224
|
+
return currentSegmentCacheVersion;
|
|
225
|
+
}
|
|
226
|
+
function invalidateEntirePrefetchCache(nextUrl, tree) {
|
|
227
|
+
currentRouteCacheVersion++;
|
|
228
|
+
currentSegmentCacheVersion++;
|
|
229
|
+
(0, _links.pingVisibleLinks)(nextUrl, tree);
|
|
230
|
+
pingInvalidationListeners(nextUrl, tree);
|
|
146
231
|
}
|
|
147
|
-
function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
currentCacheVersion++;
|
|
155
|
-
// Start a cooldown before re-prefetching to allow CDN cache propagation.
|
|
156
|
-
(0, _scheduler.startRevalidationCooldown)();
|
|
157
|
-
// Prefetch all the currently visible links again, to re-fill the cache.
|
|
232
|
+
function invalidateRouteCacheEntries(nextUrl, tree) {
|
|
233
|
+
currentRouteCacheVersion++;
|
|
234
|
+
(0, _links.pingVisibleLinks)(nextUrl, tree);
|
|
235
|
+
pingInvalidationListeners(nextUrl, tree);
|
|
236
|
+
}
|
|
237
|
+
function invalidateSegmentCacheEntries(nextUrl, tree) {
|
|
238
|
+
currentSegmentCacheVersion++;
|
|
158
239
|
(0, _links.pingVisibleLinks)(nextUrl, tree);
|
|
159
|
-
// Similarly, notify all invalidation listeners (i.e. those passed to
|
|
160
|
-
// `router.prefetch(onInvalidate)`), so they can trigger a new prefetch
|
|
161
|
-
// if needed.
|
|
162
240
|
pingInvalidationListeners(nextUrl, tree);
|
|
163
241
|
}
|
|
164
242
|
function attachInvalidationListener(task) {
|
|
@@ -213,15 +291,24 @@ function pingInvalidationListeners(nextUrl, tree) {
|
|
|
213
291
|
function readRouteCacheEntry(now, key) {
|
|
214
292
|
const varyPath = (0, _varypath.getRouteVaryPath)(key.pathname, key.search, key.nextUrl);
|
|
215
293
|
const isRevalidation = false;
|
|
216
|
-
|
|
294
|
+
const existingEntry = (0, _cachemap.getFromCacheMap)(now, getCurrentRouteCacheVersion(), routeCacheMap, varyPath, isRevalidation);
|
|
295
|
+
if (existingEntry !== null) {
|
|
296
|
+
return existingEntry;
|
|
297
|
+
}
|
|
298
|
+
// No cache hit. Attempt to construct from template using the new
|
|
299
|
+
// optimistic routing mechanism (pattern-based matching).
|
|
300
|
+
if (process.env.__NEXT_OPTIMISTIC_ROUTING) {
|
|
301
|
+
return (0, _optimisticroutes.matchKnownRoute)(key.pathname, key.search);
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
217
304
|
}
|
|
218
305
|
function readSegmentCacheEntry(now, varyPath) {
|
|
219
306
|
const isRevalidation = false;
|
|
220
|
-
return (0, _cachemap.getFromCacheMap)(now,
|
|
307
|
+
return (0, _cachemap.getFromCacheMap)(now, getCurrentSegmentCacheVersion(), segmentCacheMap, varyPath, isRevalidation);
|
|
221
308
|
}
|
|
222
309
|
function readRevalidatingSegmentCacheEntry(now, varyPath) {
|
|
223
310
|
const isRevalidation = true;
|
|
224
|
-
return (0, _cachemap.getFromCacheMap)(now,
|
|
311
|
+
return (0, _cachemap.getFromCacheMap)(now, getCurrentSegmentCacheVersion(), segmentCacheMap, varyPath, isRevalidation);
|
|
225
312
|
}
|
|
226
313
|
function waitForSegmentCacheEntry(pendingEntry) {
|
|
227
314
|
// Because the entry is pending, there's already a in-progress request.
|
|
@@ -234,14 +321,8 @@ function waitForSegmentCacheEntry(pendingEntry) {
|
|
|
234
321
|
}
|
|
235
322
|
return promiseWithResolvers.promise;
|
|
236
323
|
}
|
|
237
|
-
function
|
|
238
|
-
|
|
239
|
-
const existingEntry = readRouteCacheEntry(now, key);
|
|
240
|
-
if (existingEntry !== null) {
|
|
241
|
-
return existingEntry;
|
|
242
|
-
}
|
|
243
|
-
// Create a pending entry and add it to the cache.
|
|
244
|
-
const pendingEntry = {
|
|
324
|
+
function createDetachedRouteCacheEntry() {
|
|
325
|
+
return {
|
|
245
326
|
canonicalUrl: null,
|
|
246
327
|
status: 0,
|
|
247
328
|
blockedTasks: null,
|
|
@@ -252,7 +333,7 @@ function readOrCreateRouteCacheEntry(now, task, key) {
|
|
|
252
333
|
// from the server.
|
|
253
334
|
couldBeIntercepted: true,
|
|
254
335
|
// Similarly, we don't yet know if the route supports PPR.
|
|
255
|
-
|
|
336
|
+
supportsPerSegmentPrefetching: false,
|
|
256
337
|
renderedSearch: null,
|
|
257
338
|
// Map-related fields
|
|
258
339
|
ref: null,
|
|
@@ -260,14 +341,23 @@ function readOrCreateRouteCacheEntry(now, task, key) {
|
|
|
260
341
|
// Since this is an empty entry, there's no reason to ever evict it. It will
|
|
261
342
|
// be updated when the data is populated.
|
|
262
343
|
staleAt: Infinity,
|
|
263
|
-
version:
|
|
344
|
+
version: getCurrentRouteCacheVersion()
|
|
264
345
|
};
|
|
346
|
+
}
|
|
347
|
+
function readOrCreateRouteCacheEntry(now, task, key) {
|
|
348
|
+
attachInvalidationListener(task);
|
|
349
|
+
const existingEntry = readRouteCacheEntry(now, key);
|
|
350
|
+
if (existingEntry !== null) {
|
|
351
|
+
return existingEntry;
|
|
352
|
+
}
|
|
353
|
+
// Create a pending entry and add it to the cache.
|
|
354
|
+
const pendingEntry = createDetachedRouteCacheEntry();
|
|
265
355
|
const varyPath = (0, _varypath.getRouteVaryPath)(key.pathname, key.search, key.nextUrl);
|
|
266
356
|
const isRevalidation = false;
|
|
267
357
|
(0, _cachemap.setInCacheMap)(routeCacheMap, varyPath, pendingEntry, isRevalidation);
|
|
268
358
|
return pendingEntry;
|
|
269
359
|
}
|
|
270
|
-
function
|
|
360
|
+
function deprecated_requestOptimisticRouteCacheEntry(now, requestedUrl, nextUrl) {
|
|
271
361
|
// This function is called during a navigation when there was no matching
|
|
272
362
|
// route tree in the prefetch cache. Before de-opting to a blocking,
|
|
273
363
|
// unprefetched navigation, we will first attempt to construct an "optimistic"
|
|
@@ -321,8 +411,8 @@ function requestOptimisticRouteCacheEntry(now, requestedUrl, nextUrl) {
|
|
|
321
411
|
const optimisticUrl = new URL(routeWithNoSearchParams.canonicalUrl, location.origin);
|
|
322
412
|
optimisticUrl.search = optimisticCanonicalSearch;
|
|
323
413
|
const optimisticCanonicalUrl = (0, _createhreffromurl.createHrefFromUrl)(optimisticUrl);
|
|
324
|
-
const optimisticRouteTree =
|
|
325
|
-
const optimisticMetadataTree =
|
|
414
|
+
const optimisticRouteTree = deprecated_createOptimisticRouteTree(routeWithNoSearchParams.tree, optimisticRenderedSearch);
|
|
415
|
+
const optimisticMetadataTree = deprecated_createOptimisticRouteTree(routeWithNoSearchParams.metadata, optimisticRenderedSearch);
|
|
326
416
|
// Clone the base route tree, and override the relevant fields with our
|
|
327
417
|
// optimistic values.
|
|
328
418
|
const optimisticEntry = {
|
|
@@ -333,7 +423,8 @@ function requestOptimisticRouteCacheEntry(now, requestedUrl, nextUrl) {
|
|
|
333
423
|
tree: optimisticRouteTree,
|
|
334
424
|
metadata: optimisticMetadataTree,
|
|
335
425
|
couldBeIntercepted: routeWithNoSearchParams.couldBeIntercepted,
|
|
336
|
-
|
|
426
|
+
supportsPerSegmentPrefetching: routeWithNoSearchParams.supportsPerSegmentPrefetching,
|
|
427
|
+
hasDynamicRewrite: routeWithNoSearchParams.hasDynamicRewrite,
|
|
337
428
|
// Override the rendered search with the optimistic value.
|
|
338
429
|
renderedSearch: optimisticRenderedSearch,
|
|
339
430
|
// Map-related fields
|
|
@@ -346,7 +437,7 @@ function requestOptimisticRouteCacheEntry(now, requestedUrl, nextUrl) {
|
|
|
346
437
|
// perform the current navigation. Just return it to the caller.
|
|
347
438
|
return optimisticEntry;
|
|
348
439
|
}
|
|
349
|
-
function
|
|
440
|
+
function deprecated_createOptimisticRouteTree(tree, newRenderedSearch) {
|
|
350
441
|
// Create a new route tree that identical to the original one except for
|
|
351
442
|
// the rendered search string, which is contained in the vary path.
|
|
352
443
|
let clonedSlots = null;
|
|
@@ -355,7 +446,7 @@ function createOptimisticRouteTree(tree, newRenderedSearch) {
|
|
|
355
446
|
clonedSlots = {};
|
|
356
447
|
for(const parallelRouteKey in originalSlots){
|
|
357
448
|
const childTree = originalSlots[parallelRouteKey];
|
|
358
|
-
clonedSlots[parallelRouteKey] =
|
|
449
|
+
clonedSlots[parallelRouteKey] = deprecated_createOptimisticRouteTree(childTree, newRenderedSearch);
|
|
359
450
|
}
|
|
360
451
|
}
|
|
361
452
|
// We only need to clone the vary path if the route is a page.
|
|
@@ -363,38 +454,38 @@ function createOptimisticRouteTree(tree, newRenderedSearch) {
|
|
|
363
454
|
return {
|
|
364
455
|
requestKey: tree.requestKey,
|
|
365
456
|
segment: tree.segment,
|
|
457
|
+
refreshState: tree.refreshState,
|
|
366
458
|
varyPath: (0, _varypath.clonePageVaryPathWithNewSearchParams)(tree.varyPath, newRenderedSearch),
|
|
367
459
|
isPage: true,
|
|
368
460
|
slots: clonedSlots,
|
|
369
|
-
|
|
370
|
-
hasLoadingBoundary: tree.hasLoadingBoundary,
|
|
371
|
-
hasRuntimePrefetch: tree.hasRuntimePrefetch
|
|
461
|
+
prefetchHints: tree.prefetchHints
|
|
372
462
|
};
|
|
373
463
|
}
|
|
374
464
|
return {
|
|
375
465
|
requestKey: tree.requestKey,
|
|
376
466
|
segment: tree.segment,
|
|
467
|
+
refreshState: tree.refreshState,
|
|
377
468
|
varyPath: tree.varyPath,
|
|
378
469
|
isPage: false,
|
|
379
470
|
slots: clonedSlots,
|
|
380
|
-
|
|
381
|
-
hasLoadingBoundary: tree.hasLoadingBoundary,
|
|
382
|
-
hasRuntimePrefetch: tree.hasRuntimePrefetch
|
|
471
|
+
prefetchHints: tree.prefetchHints
|
|
383
472
|
};
|
|
384
473
|
}
|
|
385
|
-
function readOrCreateSegmentCacheEntry(now, fetchStrategy,
|
|
474
|
+
function readOrCreateSegmentCacheEntry(now, fetchStrategy, tree) {
|
|
386
475
|
const existingEntry = readSegmentCacheEntry(now, tree.varyPath);
|
|
387
476
|
if (existingEntry !== null) {
|
|
388
477
|
return existingEntry;
|
|
389
478
|
}
|
|
390
|
-
// Create a pending entry and add it to the cache.
|
|
479
|
+
// Create a pending entry and add it to the cache. The stale time is set to a
|
|
480
|
+
// default value; the actual stale time will be set when the entry is
|
|
481
|
+
// fulfilled with data from the server response.
|
|
391
482
|
const varyPathForRequest = (0, _varypath.getSegmentVaryPathForRequest)(fetchStrategy, tree);
|
|
392
|
-
const pendingEntry = createDetachedSegmentCacheEntry(
|
|
483
|
+
const pendingEntry = createDetachedSegmentCacheEntry(now);
|
|
393
484
|
const isRevalidation = false;
|
|
394
485
|
(0, _cachemap.setInCacheMap)(segmentCacheMap, varyPathForRequest, pendingEntry, isRevalidation);
|
|
395
486
|
return pendingEntry;
|
|
396
487
|
}
|
|
397
|
-
function readOrCreateRevalidatingSegmentEntry(now, fetchStrategy,
|
|
488
|
+
function readOrCreateRevalidatingSegmentEntry(now, fetchStrategy, tree) {
|
|
398
489
|
// This function is called when we've already confirmed that a particular
|
|
399
490
|
// segment is cached, but we want to perform another request anyway in case it
|
|
400
491
|
// returns more complete and/or fresher data than we already have. The logic
|
|
@@ -425,19 +516,23 @@ function readOrCreateRevalidatingSegmentEntry(now, fetchStrategy, route, tree) {
|
|
|
425
516
|
if (existingEntry !== null) {
|
|
426
517
|
return existingEntry;
|
|
427
518
|
}
|
|
428
|
-
// Create a pending entry and add it to the cache.
|
|
519
|
+
// Create a pending entry and add it to the cache. The stale time is set to a
|
|
520
|
+
// default value; the actual stale time will be set when the entry is
|
|
521
|
+
// fulfilled with data from the server response.
|
|
429
522
|
const varyPathForRequest = (0, _varypath.getSegmentVaryPathForRequest)(fetchStrategy, tree);
|
|
430
|
-
const pendingEntry = createDetachedSegmentCacheEntry(
|
|
523
|
+
const pendingEntry = createDetachedSegmentCacheEntry(now);
|
|
431
524
|
const isRevalidation = true;
|
|
432
525
|
(0, _cachemap.setInCacheMap)(segmentCacheMap, varyPathForRequest, pendingEntry, isRevalidation);
|
|
433
526
|
return pendingEntry;
|
|
434
527
|
}
|
|
435
|
-
function overwriteRevalidatingSegmentCacheEntry(
|
|
528
|
+
function overwriteRevalidatingSegmentCacheEntry(now, fetchStrategy, tree) {
|
|
436
529
|
// This function is called when we've already decided to replace an existing
|
|
437
530
|
// revalidation entry. Create a new entry and write it into the cache,
|
|
438
|
-
// overwriting the previous value.
|
|
531
|
+
// overwriting the previous value. The stale time is set to a default value;
|
|
532
|
+
// the actual stale time will be set when the entry is fulfilled with data
|
|
533
|
+
// from the server response.
|
|
439
534
|
const varyPathForRequest = (0, _varypath.getSegmentVaryPathForRequest)(fetchStrategy, tree);
|
|
440
|
-
const pendingEntry = createDetachedSegmentCacheEntry(
|
|
535
|
+
const pendingEntry = createDetachedSegmentCacheEntry(now);
|
|
441
536
|
const isRevalidation = true;
|
|
442
537
|
(0, _cachemap.setInCacheMap)(segmentCacheMap, varyPathForRequest, pendingEntry, isRevalidation);
|
|
443
538
|
return pendingEntry;
|
|
@@ -449,7 +544,7 @@ function upsertSegmentEntry(now, varyPath, candidateEntry) {
|
|
|
449
544
|
// TODO: We should not upsert an entry if its key was invalidated in the time
|
|
450
545
|
// since the request was made. We can do that by passing the "owner" entry to
|
|
451
546
|
// this function and confirming it's the same as `existingEntry`.
|
|
452
|
-
if ((0, _cachemap.isValueExpired)(now,
|
|
547
|
+
if ((0, _cachemap.isValueExpired)(now, getCurrentSegmentCacheVersion(), candidateEntry)) {
|
|
453
548
|
// The entry is expired. We cannot upsert it.
|
|
454
549
|
return null;
|
|
455
550
|
}
|
|
@@ -470,7 +565,6 @@ function upsertSegmentEntry(now, varyPath, candidateEntry) {
|
|
|
470
565
|
// the entry expires.
|
|
471
566
|
const rejectedEntry = candidateEntry;
|
|
472
567
|
rejectedEntry.status = 3;
|
|
473
|
-
rejectedEntry.loading = null;
|
|
474
568
|
rejectedEntry.rsc = null;
|
|
475
569
|
return null;
|
|
476
570
|
}
|
|
@@ -481,14 +575,16 @@ function upsertSegmentEntry(now, varyPath, candidateEntry) {
|
|
|
481
575
|
(0, _cachemap.setInCacheMap)(segmentCacheMap, varyPath, candidateEntry, isRevalidation);
|
|
482
576
|
return candidateEntry;
|
|
483
577
|
}
|
|
484
|
-
function createDetachedSegmentCacheEntry(
|
|
578
|
+
function createDetachedSegmentCacheEntry(now) {
|
|
579
|
+
// Default stale time for pending segment cache entries. The actual stale time
|
|
580
|
+
// is set when the entry is fulfilled with data from the server response.
|
|
581
|
+
const staleAt = now + 30 * 1000;
|
|
485
582
|
const emptyEntry = {
|
|
486
583
|
status: 0,
|
|
487
584
|
// Default to assuming the fetch strategy will be PPR. This will be updated
|
|
488
585
|
// when a fetch is actually initiated.
|
|
489
586
|
fetchStrategy: _types.FetchStrategy.PPR,
|
|
490
587
|
rsc: null,
|
|
491
|
-
loading: null,
|
|
492
588
|
isPartial: true,
|
|
493
589
|
promise: null,
|
|
494
590
|
// Map-related fields
|
|
@@ -510,13 +606,60 @@ function upgradeToPendingSegment(emptyEntry, fetchStrategy) {
|
|
|
510
606
|
pendingEntry.isPartial = false;
|
|
511
607
|
}
|
|
512
608
|
// Set the version here, since this is right before the request is initiated.
|
|
513
|
-
// The next time the
|
|
609
|
+
// The next time the segment cache version is incremented, the entry will
|
|
514
610
|
// effectively be evicted. This happens before initiating the request, rather
|
|
515
611
|
// than when receiving the response, because it's guaranteed to happen
|
|
516
612
|
// before the data is read on the server.
|
|
517
|
-
pendingEntry.version =
|
|
613
|
+
pendingEntry.version = getCurrentSegmentCacheVersion();
|
|
518
614
|
return pendingEntry;
|
|
519
615
|
}
|
|
616
|
+
function attemptToFulfillDynamicSegmentFromBFCache(now, segment, tree) {
|
|
617
|
+
// Attempts to fulfill an empty segment cache entry using data from the
|
|
618
|
+
// bfcache. This is only valid during a Full prefetch (i.e. one that includes
|
|
619
|
+
// dynamic data), because the bfcache stores data from navigations which
|
|
620
|
+
// always include dynamic data.
|
|
621
|
+
// We always use the canonical vary path when checking the bfcache. This is
|
|
622
|
+
// the same operation we'd use to access the cache during a
|
|
623
|
+
// regular navigation.
|
|
624
|
+
const varyPath = tree.varyPath;
|
|
625
|
+
// Read from the BFCache without expiring it (pass -1). We check freshness
|
|
626
|
+
// ourselves using navigatedAt, because the BFCache's staleAt may have been
|
|
627
|
+
// overridden by a per-page unstable_dynamicStaleTime and can't be used to
|
|
628
|
+
// derive the original request time.
|
|
629
|
+
const bfcacheEntry = (0, _bfcache.readFromBFCache)(varyPath);
|
|
630
|
+
if (bfcacheEntry !== null) {
|
|
631
|
+
// The stale time for dynamic prefetches (default: 5 mins) is different
|
|
632
|
+
// from the stale time for regular navigations (default: 0 secs). Use
|
|
633
|
+
// navigatedAt to compute the correct expiry for prefetch purposes.
|
|
634
|
+
const dynamicPrefetchStaleAt = bfcacheEntry.navigatedAt + _navigatereducer.STATIC_STALETIME_MS;
|
|
635
|
+
if (now > dynamicPrefetchStaleAt) {
|
|
636
|
+
return null;
|
|
637
|
+
}
|
|
638
|
+
const pendingSegment = upgradeToPendingSegment(segment, _types.FetchStrategy.Full);
|
|
639
|
+
const isPartial = false;
|
|
640
|
+
return fulfillSegmentCacheEntry(pendingSegment, bfcacheEntry.rsc, dynamicPrefetchStaleAt, isPartial);
|
|
641
|
+
}
|
|
642
|
+
return null;
|
|
643
|
+
}
|
|
644
|
+
function attemptToUpgradeSegmentFromBFCache(now, tree) {
|
|
645
|
+
const varyPath = tree.varyPath;
|
|
646
|
+
const bfcacheEntry = (0, _bfcache.readFromBFCache)(varyPath);
|
|
647
|
+
if (bfcacheEntry !== null) {
|
|
648
|
+
const dynamicPrefetchStaleAt = bfcacheEntry.navigatedAt + _navigatereducer.STATIC_STALETIME_MS;
|
|
649
|
+
if (now > dynamicPrefetchStaleAt) {
|
|
650
|
+
return null;
|
|
651
|
+
}
|
|
652
|
+
const pendingSegment = upgradeToPendingSegment(createDetachedSegmentCacheEntry(now), _types.FetchStrategy.Full);
|
|
653
|
+
const isPartial = false;
|
|
654
|
+
const newEntry = fulfillSegmentCacheEntry(pendingSegment, bfcacheEntry.rsc, dynamicPrefetchStaleAt, isPartial);
|
|
655
|
+
const segmentVaryPath = (0, _varypath.getSegmentVaryPathForRequest)(_types.FetchStrategy.Full, tree);
|
|
656
|
+
const upserted = upsertSegmentEntry(now, segmentVaryPath, newEntry);
|
|
657
|
+
if (upserted !== null && upserted.status === 2) {
|
|
658
|
+
return upserted;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
520
663
|
function pingBlockedTasks(entry) {
|
|
521
664
|
const blockedTasks = entry.blockedTasks;
|
|
522
665
|
if (blockedTasks !== null) {
|
|
@@ -526,7 +669,7 @@ function pingBlockedTasks(entry) {
|
|
|
526
669
|
entry.blockedTasks = null;
|
|
527
670
|
}
|
|
528
671
|
}
|
|
529
|
-
function
|
|
672
|
+
function createMetadataRouteTree(metadataVaryPath) {
|
|
530
673
|
// The Head is not actually part of the route tree, but other than that, it's
|
|
531
674
|
// fetched and cached like a segment. Some functions expect a RouteTree
|
|
532
675
|
// object, so rather than fork the logic in all those places, we use this
|
|
@@ -534,33 +677,56 @@ function fulfillRouteCacheEntry(entry, tree, metadataVaryPath, staleAt, couldBeI
|
|
|
534
677
|
const metadata = {
|
|
535
678
|
requestKey: _segmentvalueencoding.HEAD_REQUEST_KEY,
|
|
536
679
|
segment: _segmentvalueencoding.HEAD_REQUEST_KEY,
|
|
680
|
+
refreshState: null,
|
|
537
681
|
varyPath: metadataVaryPath,
|
|
538
682
|
// The metadata isn't really a "page" (though it isn't really a "segment"
|
|
539
683
|
// either) but for the purposes of how this field is used, it behaves like
|
|
540
684
|
// one. If this logic ever gets more complex we can change this to an enum.
|
|
541
685
|
isPage: true,
|
|
542
686
|
slots: null,
|
|
543
|
-
|
|
544
|
-
hasLoadingBoundary: _approutertypes.HasLoadingBoundary.SubtreeHasNoLoadingBoundary,
|
|
545
|
-
hasRuntimePrefetch: false
|
|
687
|
+
prefetchHints: 0
|
|
546
688
|
};
|
|
689
|
+
return metadata;
|
|
690
|
+
}
|
|
691
|
+
function fulfillRouteCacheEntry(now, entry, tree, metadataVaryPath, couldBeIntercepted, canonicalUrl, supportsPerSegmentPrefetching) {
|
|
692
|
+
// Get the rendered search from the vary path
|
|
693
|
+
const renderedSearch = (0, _varypath.getRenderedSearchFromVaryPath)(metadataVaryPath) ?? '';
|
|
547
694
|
const fulfilledEntry = entry;
|
|
548
695
|
fulfilledEntry.status = 2;
|
|
549
696
|
fulfilledEntry.tree = tree;
|
|
550
|
-
fulfilledEntry.metadata =
|
|
551
|
-
|
|
697
|
+
fulfilledEntry.metadata = createMetadataRouteTree(metadataVaryPath);
|
|
698
|
+
// Route structure is essentially static — it only changes on deploy.
|
|
699
|
+
// Always use the static stale time.
|
|
700
|
+
// NOTE: An exception is rewrites/redirects in middleware or proxy, which can
|
|
701
|
+
// change routes dynamically. We have other strategies for handling those.
|
|
702
|
+
fulfilledEntry.staleAt = now + _navigatereducer.STATIC_STALETIME_MS;
|
|
552
703
|
fulfilledEntry.couldBeIntercepted = couldBeIntercepted;
|
|
553
704
|
fulfilledEntry.canonicalUrl = canonicalUrl;
|
|
554
705
|
fulfilledEntry.renderedSearch = renderedSearch;
|
|
555
|
-
fulfilledEntry.
|
|
706
|
+
fulfilledEntry.supportsPerSegmentPrefetching = supportsPerSegmentPrefetching;
|
|
707
|
+
fulfilledEntry.hasDynamicRewrite = false;
|
|
556
708
|
pingBlockedTasks(entry);
|
|
557
709
|
return fulfilledEntry;
|
|
558
710
|
}
|
|
559
|
-
function
|
|
711
|
+
function writeRouteIntoCache(now, pathname, nextUrl, tree, metadataVaryPath, couldBeIntercepted, canonicalUrl, supportsPerSegmentPrefetching) {
|
|
712
|
+
const pendingEntry = createDetachedRouteCacheEntry();
|
|
713
|
+
const fulfilledEntry = fulfillRouteCacheEntry(now, pendingEntry, tree, metadataVaryPath, couldBeIntercepted, canonicalUrl, supportsPerSegmentPrefetching);
|
|
714
|
+
const renderedSearch = fulfilledEntry.renderedSearch;
|
|
715
|
+
const varyPath = (0, _varypath.getFulfilledRouteVaryPath)(pathname, renderedSearch, nextUrl, couldBeIntercepted);
|
|
716
|
+
const isRevalidation = false;
|
|
717
|
+
(0, _cachemap.setInCacheMap)(routeCacheMap, varyPath, fulfilledEntry, isRevalidation);
|
|
718
|
+
return fulfilledEntry;
|
|
719
|
+
}
|
|
720
|
+
function markRouteEntryAsDynamicRewrite(entry) {
|
|
721
|
+
entry.hasDynamicRewrite = true;
|
|
722
|
+
// Note: The caller is responsible for also calling invalidateRouteCacheEntries
|
|
723
|
+
// to invalidate other entries that may have been derived from this template
|
|
724
|
+
// before we knew it had a dynamic rewrite.
|
|
725
|
+
}
|
|
726
|
+
function fulfillSegmentCacheEntry(segmentCacheEntry, rsc, staleAt, isPartial) {
|
|
560
727
|
const fulfilledEntry = segmentCacheEntry;
|
|
561
728
|
fulfilledEntry.status = 2;
|
|
562
729
|
fulfilledEntry.rsc = rsc;
|
|
563
|
-
fulfilledEntry.loading = loading;
|
|
564
730
|
fulfilledEntry.staleAt = staleAt;
|
|
565
731
|
fulfilledEntry.isPartial = isPartial;
|
|
566
732
|
// Resolve any listeners that were waiting for this data.
|
|
@@ -611,15 +777,14 @@ function convertTreePrefetchToRouteTree(prefetch, segment, partialVaryPath, requ
|
|
|
611
777
|
slots = {};
|
|
612
778
|
for(let parallelRouteKey in prefetchSlots){
|
|
613
779
|
const childPrefetch = prefetchSlots[parallelRouteKey];
|
|
614
|
-
const
|
|
615
|
-
const
|
|
616
|
-
const childServerSentParamKey = childPrefetch.paramKey;
|
|
780
|
+
const childSegmentName = childPrefetch.name;
|
|
781
|
+
const childParam = childPrefetch.param;
|
|
617
782
|
let childDoesAppearInURL;
|
|
618
783
|
let childSegment;
|
|
619
784
|
let childPartialVaryPath;
|
|
620
|
-
if (
|
|
785
|
+
if (childParam !== null) {
|
|
621
786
|
// This segment is parameterized. Get the param from the pathname.
|
|
622
|
-
const childParamValue = (0, _routeparams.parseDynamicParamFromURLPart)(
|
|
787
|
+
const childParamValue = (0, _routeparams.parseDynamicParamFromURLPart)(childParam.type, pathnameParts, pathnamePartsIndex);
|
|
623
788
|
// Assign a cache key to the segment, based on the param value. In the
|
|
624
789
|
// pre-Segment Cache implementation, the server computes this and sends
|
|
625
790
|
// it in the body of the response. In the Segment Cache implementation,
|
|
@@ -631,20 +796,21 @@ function convertTreePrefetchToRouteTree(prefetch, segment, partialVaryPath, requ
|
|
|
631
796
|
// doing anyway.
|
|
632
797
|
const childParamKey = // The server omits this field from the prefetch response when
|
|
633
798
|
// cacheComponents is enabled.
|
|
634
|
-
|
|
635
|
-
childPartialVaryPath = (0, _varypath.appendLayoutVaryPath)(partialVaryPath, childParamKey);
|
|
799
|
+
childParam.key !== null ? childParam.key : (0, _routeparams.getCacheKeyForDynamicParam)(childParamValue, '');
|
|
800
|
+
childPartialVaryPath = (0, _varypath.appendLayoutVaryPath)(partialVaryPath, childParamKey, childSegmentName);
|
|
636
801
|
childSegment = [
|
|
637
|
-
|
|
802
|
+
childSegmentName,
|
|
638
803
|
childParamKey,
|
|
639
|
-
|
|
804
|
+
childParam.type,
|
|
805
|
+
childParam.siblings
|
|
640
806
|
];
|
|
641
807
|
childDoesAppearInURL = true;
|
|
642
808
|
} else {
|
|
643
809
|
// This segment does not have a param. Inherit the partial vary path of
|
|
644
810
|
// the parent.
|
|
645
811
|
childPartialVaryPath = partialVaryPath;
|
|
646
|
-
childSegment =
|
|
647
|
-
childDoesAppearInURL = (0, _routeparams.doesStaticSegmentAppearInURL)(
|
|
812
|
+
childSegment = childSegmentName;
|
|
813
|
+
childDoesAppearInURL = (0, _routeparams.doesStaticSegmentAppearInURL)(childSegmentName);
|
|
648
814
|
}
|
|
649
815
|
// Only increment the index if the segment appears in the URL. If it's a
|
|
650
816
|
// "virtual" segment, like a route group, it remains the same.
|
|
@@ -676,27 +842,48 @@ function convertTreePrefetchToRouteTree(prefetch, segment, partialVaryPath, requ
|
|
|
676
842
|
return {
|
|
677
843
|
requestKey,
|
|
678
844
|
segment,
|
|
679
|
-
|
|
845
|
+
refreshState: null,
|
|
680
846
|
// TODO: Cheating the type system here a bit because TypeScript can't tell
|
|
681
847
|
// that the type of isPage and varyPath are consistent. The fix would be to
|
|
682
848
|
// create separate constructors and call the appropriate one from each of
|
|
683
849
|
// the branches above. Just seems a bit overkill only for one field so I'll
|
|
684
850
|
// leave it as-is for now. If isPage were wrong it would break the behavior
|
|
685
851
|
// and we'd catch it quickly, anyway.
|
|
852
|
+
varyPath: varyPath,
|
|
686
853
|
isPage: isPage,
|
|
687
854
|
slots,
|
|
688
|
-
|
|
689
|
-
// This field is only relevant to dynamic routes. For a PPR/static route,
|
|
690
|
-
// there's always some partial loading state we can fetch.
|
|
691
|
-
hasLoadingBoundary: _approutertypes.HasLoadingBoundary.SegmentHasLoadingBoundary,
|
|
692
|
-
hasRuntimePrefetch: prefetch.hasRuntimePrefetch
|
|
855
|
+
prefetchHints: prefetch.prefetchHints
|
|
693
856
|
};
|
|
694
857
|
}
|
|
695
858
|
function convertRootFlightRouterStateToRouteTree(flightRouterState, renderedSearch, acc) {
|
|
696
859
|
return convertFlightRouterStateToRouteTree(flightRouterState, _segmentvalueencoding.ROOT_SEGMENT_REQUEST_KEY, null, renderedSearch, acc);
|
|
697
860
|
}
|
|
698
|
-
function
|
|
861
|
+
function convertReusedFlightRouterStateToRouteTree(parentRouteTree, parallelRouteKey, flightRouterState, renderedSearch, acc) {
|
|
862
|
+
// Create a RouteTree for a FlightRouterState that was reused from an older
|
|
863
|
+
// route. This happens during a navigation when a parallel route slot does not
|
|
864
|
+
// match the target route; we reuse whatever slot was already active.
|
|
865
|
+
// Unlike a FlightRouterState, the RouteTree type contains backreferences to
|
|
866
|
+
// the parent segments. Append the vary path to the parent's vary path.
|
|
867
|
+
const parentPartialVaryPath = parentRouteTree.isPage ? (0, _varypath.getPartialPageVaryPath)(parentRouteTree.varyPath) : (0, _varypath.getPartialLayoutVaryPath)(parentRouteTree.varyPath);
|
|
868
|
+
const segment = flightRouterState[0];
|
|
869
|
+
// And the request key.
|
|
870
|
+
const parentRequestKey = parentRouteTree.requestKey;
|
|
871
|
+
const requestKeyPart = (0, _segmentvalueencoding.createSegmentRequestKeyPart)(segment);
|
|
872
|
+
const requestKey = (0, _segmentvalueencoding.appendSegmentRequestKeyPart)(parentRequestKey, parallelRouteKey, requestKeyPart);
|
|
873
|
+
return convertFlightRouterStateToRouteTree(flightRouterState, requestKey, parentPartialVaryPath, renderedSearch, acc);
|
|
874
|
+
}
|
|
875
|
+
function convertFlightRouterStateToRouteTree(flightRouterState, requestKey, parentPartialVaryPath, parentRenderedSearch, acc) {
|
|
699
876
|
const originalSegment = flightRouterState[0];
|
|
877
|
+
// If the FlightRouterState has a refresh state, then this segment is part of
|
|
878
|
+
// an inactive parallel route. It has a different rendered search query than
|
|
879
|
+
// the outer parent route. In order to construct the inactive route correctly,
|
|
880
|
+
// we must restore the query that was originally used to render it.
|
|
881
|
+
const compressedRefreshState = flightRouterState[2] ?? null;
|
|
882
|
+
const refreshState = compressedRefreshState !== null ? {
|
|
883
|
+
canonicalUrl: compressedRefreshState[0],
|
|
884
|
+
renderedSearch: compressedRefreshState[1]
|
|
885
|
+
} : null;
|
|
886
|
+
const renderedSearch = refreshState !== null ? refreshState.renderedSearch : parentRenderedSearch;
|
|
700
887
|
let segment;
|
|
701
888
|
let partialVaryPath;
|
|
702
889
|
let isPage;
|
|
@@ -704,7 +891,8 @@ function convertFlightRouterStateToRouteTree(flightRouterState, requestKey, pare
|
|
|
704
891
|
if (Array.isArray(originalSegment)) {
|
|
705
892
|
isPage = false;
|
|
706
893
|
const paramCacheKey = originalSegment[1];
|
|
707
|
-
|
|
894
|
+
const paramName = originalSegment[0];
|
|
895
|
+
partialVaryPath = (0, _varypath.appendLayoutVaryPath)(parentPartialVaryPath, paramCacheKey, paramName);
|
|
708
896
|
varyPath = (0, _varypath.finalizeLayoutVaryPath)(requestKey, partialVaryPath);
|
|
709
897
|
segment = originalSegment;
|
|
710
898
|
} else {
|
|
@@ -763,20 +951,17 @@ function convertFlightRouterStateToRouteTree(flightRouterState, requestKey, pare
|
|
|
763
951
|
return {
|
|
764
952
|
requestKey,
|
|
765
953
|
segment,
|
|
766
|
-
|
|
954
|
+
refreshState,
|
|
767
955
|
// TODO: Cheating the type system here a bit because TypeScript can't tell
|
|
768
956
|
// that the type of isPage and varyPath are consistent. The fix would be to
|
|
769
957
|
// create separate constructors and call the appropriate one from each of
|
|
770
958
|
// the branches above. Just seems a bit overkill only for one field so I'll
|
|
771
959
|
// leave it as-is for now. If isPage were wrong it would break the behavior
|
|
772
960
|
// and we'd catch it quickly, anyway.
|
|
961
|
+
varyPath: varyPath,
|
|
773
962
|
isPage: isPage,
|
|
774
963
|
slots,
|
|
775
|
-
|
|
776
|
-
hasLoadingBoundary: flightRouterState[5] !== undefined ? flightRouterState[5] : _approutertypes.HasLoadingBoundary.SubtreeHasNoLoadingBoundary,
|
|
777
|
-
// Non-static tree responses are only used by apps that haven't adopted
|
|
778
|
-
// Cache Components. So this is always false.
|
|
779
|
-
hasRuntimePrefetch: false
|
|
964
|
+
prefetchHints: flightRouterState[4] ?? 0
|
|
780
965
|
};
|
|
781
966
|
}
|
|
782
967
|
function convertRouteTreeToFlightRouterState(routeTree) {
|
|
@@ -790,12 +975,11 @@ function convertRouteTreeToFlightRouterState(routeTree) {
|
|
|
790
975
|
routeTree.segment,
|
|
791
976
|
parallelRoutes,
|
|
792
977
|
null,
|
|
793
|
-
null
|
|
794
|
-
routeTree.isRootLayout
|
|
978
|
+
null
|
|
795
979
|
];
|
|
796
980
|
return flightRouterState;
|
|
797
981
|
}
|
|
798
|
-
async function fetchRouteOnCacheMiss(entry,
|
|
982
|
+
async function fetchRouteOnCacheMiss(entry, key) {
|
|
799
983
|
// This function is allowed to use async/await because it contains the actual
|
|
800
984
|
// fetch that gets issued on a cache miss. Notice it writes the result to the
|
|
801
985
|
// cache entry directly, rather than return data that is then written by
|
|
@@ -812,6 +996,9 @@ async function fetchRouteOnCacheMiss(entry, task, key) {
|
|
|
812
996
|
if (nextUrl !== null) {
|
|
813
997
|
headers[_approuterheaders.NEXT_URL] = nextUrl;
|
|
814
998
|
}
|
|
999
|
+
// Tell the server to perform a static pre-render for the Instant Navigation
|
|
1000
|
+
// Testing API. Static pre-renders don't normally happen during development.
|
|
1001
|
+
addInstantPrefetchHeaderIfLocked(headers);
|
|
815
1002
|
try {
|
|
816
1003
|
const url = new URL(pathname + search, location.origin);
|
|
817
1004
|
let response;
|
|
@@ -900,7 +1087,13 @@ async function fetchRouteOnCacheMiss(entry, task, key) {
|
|
|
900
1087
|
// Check whether the response varies based on the Next-Url header.
|
|
901
1088
|
const varyHeader = response.headers.get('vary');
|
|
902
1089
|
const couldBeIntercepted = varyHeader !== null && varyHeader.includes(_approuterheaders.NEXT_URL);
|
|
903
|
-
//
|
|
1090
|
+
// TODO: The `closed` promise was originally used to track when a streaming
|
|
1091
|
+
// network connection closes, so the scheduler could limit concurrent
|
|
1092
|
+
// connections. Now that prefetch responses are buffered, `closed` is
|
|
1093
|
+
// resolved immediately after buffering — before the outer function even
|
|
1094
|
+
// returns. This mechanism is only still meaningful for dynamic (Full)
|
|
1095
|
+
// prefetches, which use incremental streaming. Consider removing the
|
|
1096
|
+
// `closed` plumbing for buffered prefetch paths.
|
|
904
1097
|
const closed = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
905
1098
|
// This checks whether the response was served from the per-segment cache,
|
|
906
1099
|
// rather than the old prefetching flow. If it fails, it implies that PPR
|
|
@@ -910,16 +1103,15 @@ async function fetchRouteOnCacheMiss(entry, task, key) {
|
|
|
910
1103
|
// because all data is static in this mode.
|
|
911
1104
|
isOutputExportMode;
|
|
912
1105
|
if (routeIsPPREnabled) {
|
|
913
|
-
const prefetchStream =
|
|
914
|
-
|
|
1106
|
+
const { stream: prefetchStream, size: responseSize } = await createNonTaskyPrefetchResponseStream(response.body);
|
|
1107
|
+
closed.resolve();
|
|
1108
|
+
(0, _cachemap.setSizeInCacheMap)(entry, responseSize);
|
|
1109
|
+
const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
|
|
1110
|
+
allowPartialStream: true
|
|
915
1111
|
});
|
|
916
|
-
|
|
917
|
-
if (serverData.buildId !== (0, _appbuildid.getAppBuildId)()) {
|
|
1112
|
+
if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.buildId) !== (0, _navigationbuildid.getNavigationBuildId)()) {
|
|
918
1113
|
// The server build does not match the client. Treat as a 404. During
|
|
919
1114
|
// an actual navigation, the router will trigger an MPA navigation.
|
|
920
|
-
// TODO: Consider moving the build ID to a response header so we can check
|
|
921
|
-
// it before decoding the response, and so there's one way of checking
|
|
922
|
-
// across all response types.
|
|
923
1115
|
// TODO: We should cache the fact that this is an MPA navigation.
|
|
924
1116
|
rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
|
|
925
1117
|
return null;
|
|
@@ -943,31 +1135,34 @@ async function fetchRouteOnCacheMiss(entry, task, key) {
|
|
|
943
1135
|
rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
|
|
944
1136
|
return null;
|
|
945
1137
|
}
|
|
946
|
-
|
|
947
|
-
|
|
1138
|
+
(0, _optimisticroutes.discoverKnownRoute)(Date.now(), pathname, nextUrl, entry, routeTree, metadataVaryPath, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, false // hasDynamicRewrite
|
|
1139
|
+
);
|
|
948
1140
|
} else {
|
|
949
1141
|
// PPR is not enabled for this route. The server responds with a
|
|
950
1142
|
// different format (FlightRouterState) that we need to convert.
|
|
951
1143
|
// TODO: We will unify the responses eventually. I'm keeping the types
|
|
952
1144
|
// separate for now because FlightRouterState has so many
|
|
953
1145
|
// overloaded concerns.
|
|
954
|
-
const prefetchStream =
|
|
955
|
-
|
|
1146
|
+
const { stream: prefetchStream, size: responseSize } = await createNonTaskyPrefetchResponseStream(response.body);
|
|
1147
|
+
closed.resolve();
|
|
1148
|
+
(0, _cachemap.setSizeInCacheMap)(entry, responseSize);
|
|
1149
|
+
const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
|
|
1150
|
+
allowPartialStream: true
|
|
956
1151
|
});
|
|
957
|
-
|
|
958
|
-
if (serverData.b !== (0, _appbuildid.getAppBuildId)()) {
|
|
1152
|
+
if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.b) !== (0, _navigationbuildid.getNavigationBuildId)()) {
|
|
959
1153
|
// The server build does not match the client. Treat as a 404. During
|
|
960
1154
|
// an actual navigation, the router will trigger an MPA navigation.
|
|
961
|
-
// TODO: Consider moving the build ID to a response header so we can check
|
|
962
|
-
// it before decoding the response, and so there's one way of checking
|
|
963
|
-
// across all response types.
|
|
964
1155
|
// TODO: We should cache the fact that this is an MPA navigation.
|
|
965
1156
|
rejectRouteCacheEntry(entry, Date.now() + 10 * 1000);
|
|
966
1157
|
return null;
|
|
967
1158
|
}
|
|
968
|
-
|
|
1159
|
+
// Read head vary params synchronously. Individual segments carry their
|
|
1160
|
+
// own thenables in CacheNodeSeedData.
|
|
1161
|
+
const headVaryParamsThenable = serverData.h;
|
|
1162
|
+
const headVaryParams = headVaryParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(headVaryParamsThenable) : null;
|
|
1163
|
+
writeDynamicTreeResponseIntoCache(Date.now(), // The non-PPR response format is what we'd get if we prefetched these segments
|
|
969
1164
|
// using the LoadingBoundary fetch strategy, so mark their cache entries accordingly.
|
|
970
|
-
_types.FetchStrategy.LoadingBoundary, response, serverData, entry, couldBeIntercepted, canonicalUrl, routeIsPPREnabled);
|
|
1165
|
+
_types.FetchStrategy.LoadingBoundary, response, serverData, entry, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, headVaryParams, pathname, nextUrl);
|
|
971
1166
|
}
|
|
972
1167
|
if (!couldBeIntercepted) {
|
|
973
1168
|
// This route will never be intercepted. So we can use this entry for all
|
|
@@ -1026,6 +1221,9 @@ async function fetchSegmentOnCacheMiss(route, segmentCacheEntry, routeKey, tree)
|
|
|
1026
1221
|
if (nextUrl !== null) {
|
|
1027
1222
|
headers[_approuterheaders.NEXT_URL] = nextUrl;
|
|
1028
1223
|
}
|
|
1224
|
+
// Tell the server to perform a static pre-render for the Instant Navigation
|
|
1225
|
+
// Testing API. Static pre-renders don't normally happen during development.
|
|
1226
|
+
addInstantPrefetchHeaderIfLocked(headers);
|
|
1029
1227
|
const requestUrl = isOutputExportMode ? addSegmentPathToUrlInOutputExportMode(url, normalizedRequestKey) : url;
|
|
1030
1228
|
try {
|
|
1031
1229
|
const response = await fetchPrefetchResponse(requestUrl, headers);
|
|
@@ -1044,27 +1242,36 @@ async function fetchSegmentOnCacheMiss(route, segmentCacheEntry, routeKey, tree)
|
|
|
1044
1242
|
rejectSegmentCacheEntry(segmentCacheEntry, Date.now() + 10 * 1000);
|
|
1045
1243
|
return null;
|
|
1046
1244
|
}
|
|
1047
|
-
//
|
|
1245
|
+
// See TODO in fetchRouteOnCacheMiss about removing `closed` for
|
|
1246
|
+
// buffered prefetch paths.
|
|
1048
1247
|
const closed = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1248
|
+
const { stream: prefetchStream, size: responseSize } = await createNonTaskyPrefetchResponseStream(response.body);
|
|
1249
|
+
closed.resolve();
|
|
1250
|
+
(0, _cachemap.setSizeInCacheMap)(segmentCacheEntry, responseSize);
|
|
1251
|
+
const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
|
|
1252
|
+
allowPartialStream: true
|
|
1053
1253
|
});
|
|
1054
|
-
|
|
1055
|
-
if (serverData.buildId !== (0, _appbuildid.getAppBuildId)()) {
|
|
1254
|
+
if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.buildId) !== (0, _navigationbuildid.getNavigationBuildId)()) {
|
|
1056
1255
|
// The server build does not match the client. Treat as a 404. During
|
|
1057
1256
|
// an actual navigation, the router will trigger an MPA navigation.
|
|
1058
|
-
// TODO: Consider moving the build ID to a response header so we can check
|
|
1059
|
-
// it before decoding the response, and so there's one way of checking
|
|
1060
|
-
// across all response types.
|
|
1061
1257
|
rejectSegmentCacheEntry(segmentCacheEntry, Date.now() + 10 * 1000);
|
|
1062
1258
|
return null;
|
|
1063
1259
|
}
|
|
1260
|
+
const now = Date.now();
|
|
1261
|
+
const staleAt = now + getStaleTimeMs(serverData.staleTime);
|
|
1262
|
+
const fulfilledEntry = fulfillSegmentCacheEntry(segmentCacheEntry, serverData.rsc, staleAt, serverData.isPartial);
|
|
1263
|
+
// If the server tells us which params the segment varies by, we can re-key
|
|
1264
|
+
// the entry to a more generic vary path. This allows the entry to be reused
|
|
1265
|
+
// across different param values for params that the segment doesn't
|
|
1266
|
+
// actually depend on.
|
|
1267
|
+
const varyParams = serverData.varyParams;
|
|
1268
|
+
const fulfilledVaryPath = process.env.__NEXT_VARY_PARAMS && varyParams !== null ? (0, _varypath.getFulfilledSegmentVaryPath)(tree.varyPath, varyParams) : (0, _varypath.getSegmentVaryPathForRequest)(segmentCacheEntry.fetchStrategy, tree);
|
|
1269
|
+
// Re-key and upsert the entry at the fulfilled vary path. This ensures
|
|
1270
|
+
// the entry is stored at the most generic path possible based on which
|
|
1271
|
+
// params the segment actually depends on.
|
|
1272
|
+
upsertSegmentEntry(now, fulfilledVaryPath, fulfilledEntry);
|
|
1064
1273
|
return {
|
|
1065
|
-
value:
|
|
1066
|
-
// So we use the stale time of the route.
|
|
1067
|
-
route.staleAt, serverData.isPartial),
|
|
1274
|
+
value: fulfilledEntry,
|
|
1068
1275
|
// Return a promise that resolves when the network connection closes, so
|
|
1069
1276
|
// the scheduler can track the number of concurrent network connections.
|
|
1070
1277
|
closed: closed.promise
|
|
@@ -1076,6 +1283,95 @@ async function fetchSegmentOnCacheMiss(route, segmentCacheEntry, routeKey, tree)
|
|
|
1076
1283
|
return null;
|
|
1077
1284
|
}
|
|
1078
1285
|
}
|
|
1286
|
+
async function fetchInlinedSegmentsOnCacheMiss(route, routeKey, tree, spawnedEntries) {
|
|
1287
|
+
// When prefetch inlining is enabled, all segment data for a route is bundled
|
|
1288
|
+
// into a single /_inlined response instead of individual per-segment
|
|
1289
|
+
// requests. This function fetches that response and walks the tree to fill
|
|
1290
|
+
// all segment cache entries at once.
|
|
1291
|
+
const url = new URL(route.canonicalUrl, location.origin);
|
|
1292
|
+
const nextUrl = routeKey.nextUrl;
|
|
1293
|
+
const headers = {
|
|
1294
|
+
[_approuterheaders.RSC_HEADER]: '1',
|
|
1295
|
+
[_approuterheaders.NEXT_ROUTER_PREFETCH_HEADER]: '1',
|
|
1296
|
+
[_approuterheaders.NEXT_ROUTER_SEGMENT_PREFETCH_HEADER]: '/' + _segment.PAGE_SEGMENT_KEY
|
|
1297
|
+
};
|
|
1298
|
+
if (nextUrl !== null) {
|
|
1299
|
+
headers[_approuterheaders.NEXT_URL] = nextUrl;
|
|
1300
|
+
}
|
|
1301
|
+
addInstantPrefetchHeaderIfLocked(headers);
|
|
1302
|
+
try {
|
|
1303
|
+
const response = await fetchPrefetchResponse(url, headers);
|
|
1304
|
+
if (!response || !response.ok || response.status === 204 || response.headers.get(_approuterheaders.NEXT_DID_POSTPONE_HEADER) !== '2' && !isOutputExportMode || !response.body) {
|
|
1305
|
+
rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
|
|
1306
|
+
return null;
|
|
1307
|
+
}
|
|
1308
|
+
// See TODO in fetchRouteOnCacheMiss about removing `closed` for
|
|
1309
|
+
// buffered prefetch paths.
|
|
1310
|
+
const closed = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
1311
|
+
const { stream: prefetchStream } = await createNonTaskyPrefetchResponseStream(response.body);
|
|
1312
|
+
closed.resolve();
|
|
1313
|
+
const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
|
|
1314
|
+
allowPartialStream: true
|
|
1315
|
+
});
|
|
1316
|
+
if ((response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.tree.segment.buildId) !== (0, _navigationbuildid.getNavigationBuildId)()) {
|
|
1317
|
+
rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
|
|
1318
|
+
return null;
|
|
1319
|
+
}
|
|
1320
|
+
const now = Date.now();
|
|
1321
|
+
// Walk the inlined tree in parallel with the RouteTree and fill
|
|
1322
|
+
// segment cache entries.
|
|
1323
|
+
fillInlinedSegmentEntries(now, route, tree, serverData.tree, spawnedEntries);
|
|
1324
|
+
// Fill the head entry.
|
|
1325
|
+
const headStaleAt = now + getStaleTimeMs(serverData.head.staleTime);
|
|
1326
|
+
const headKey = route.metadata.requestKey;
|
|
1327
|
+
const ownedHeadEntry = spawnedEntries.get(headKey);
|
|
1328
|
+
if (ownedHeadEntry !== undefined) {
|
|
1329
|
+
fulfillSegmentCacheEntry(ownedHeadEntry, serverData.head.rsc, headStaleAt, serverData.head.isPartial);
|
|
1330
|
+
} else {
|
|
1331
|
+
// The head was already cached. Try to upsert if the entry is empty.
|
|
1332
|
+
const existingEntry = readOrCreateSegmentCacheEntry(now, _types.FetchStrategy.PPR, route.metadata);
|
|
1333
|
+
if (existingEntry.status === 0) {
|
|
1334
|
+
fulfillSegmentCacheEntry(upgradeToPendingSegment(existingEntry, _types.FetchStrategy.PPR), serverData.head.rsc, headStaleAt, serverData.head.isPartial);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
// Reject any remaining entries that were not fulfilled by the response.
|
|
1338
|
+
rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
|
|
1339
|
+
return {
|
|
1340
|
+
value: null,
|
|
1341
|
+
closed: closed.promise
|
|
1342
|
+
};
|
|
1343
|
+
} catch (error) {
|
|
1344
|
+
rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
|
|
1345
|
+
return null;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
function fillInlinedSegmentEntries(now, route, tree, inlinedNode, spawnedEntries) {
|
|
1349
|
+
// Check if the spawned entries map has an entry for this segment's key.
|
|
1350
|
+
const segment = inlinedNode.segment;
|
|
1351
|
+
const staleAt = now + getStaleTimeMs(segment.staleTime);
|
|
1352
|
+
const ownedEntry = spawnedEntries.get(tree.requestKey);
|
|
1353
|
+
if (ownedEntry !== undefined) {
|
|
1354
|
+
// We own this entry. Fulfill it directly.
|
|
1355
|
+
fulfillSegmentCacheEntry(ownedEntry, segment.rsc, staleAt, segment.isPartial);
|
|
1356
|
+
} else {
|
|
1357
|
+
// Not owned by us — this is extra data from the inlined response for a
|
|
1358
|
+
// segment that was already cached. Try to upsert if the entry is empty.
|
|
1359
|
+
const existingEntry = readOrCreateSegmentCacheEntry(now, _types.FetchStrategy.PPR, tree);
|
|
1360
|
+
if (existingEntry.status === 0) {
|
|
1361
|
+
fulfillSegmentCacheEntry(upgradeToPendingSegment(existingEntry, _types.FetchStrategy.PPR), segment.rsc, staleAt, segment.isPartial);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
// Recurse into children.
|
|
1365
|
+
if (tree.slots !== null && inlinedNode.slots !== null) {
|
|
1366
|
+
for(const parallelRouteKey in tree.slots){
|
|
1367
|
+
const childTree = tree.slots[parallelRouteKey];
|
|
1368
|
+
const childInlinedNode = inlinedNode.slots[parallelRouteKey];
|
|
1369
|
+
if (childInlinedNode !== undefined) {
|
|
1370
|
+
fillInlinedSegmentEntries(now, route, childTree, childInlinedNode, spawnedEntries);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1079
1375
|
async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrategy, dynamicRequestTree, spawnedEntries) {
|
|
1080
1376
|
const key = task.key;
|
|
1081
1377
|
const url = new URL(route.canonicalUrl, location.origin);
|
|
@@ -1132,30 +1428,73 @@ async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrat
|
|
|
1132
1428
|
rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
|
|
1133
1429
|
return null;
|
|
1134
1430
|
}
|
|
1135
|
-
// Track when the network connection closes.
|
|
1431
|
+
// Track when the network connection closes. Only meaningful for Full
|
|
1432
|
+
// (dynamic) prefetches which use incremental streaming. For buffered
|
|
1433
|
+
// paths, this is resolved immediately — see TODO in fetchRouteOnCacheMiss.
|
|
1136
1434
|
const closed = (0, _promisewithresolvers.createPromiseWithResolvers)();
|
|
1137
1435
|
let fulfilledEntries = null;
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
//
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
(
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1436
|
+
let prefetchStream;
|
|
1437
|
+
let bufferedResponseSize = null;
|
|
1438
|
+
if (fetchStrategy === _types.FetchStrategy.Full) {
|
|
1439
|
+
// Full prefetches are dynamic responses stored in the prefetch cache.
|
|
1440
|
+
// They don't carry vary params or other cache metadata, so there's no
|
|
1441
|
+
// need to buffer them. Use the incremental version to allow data to be
|
|
1442
|
+
// processed as it arrives.
|
|
1443
|
+
prefetchStream = createIncrementalPrefetchResponseStream(response.body, closed.resolve, function onResponseSizeUpdate(totalBytesReceivedSoFar) {
|
|
1444
|
+
// When processing a dynamic response, we don't know how large each
|
|
1445
|
+
// individual segment is, so approximate by assigning each segment
|
|
1446
|
+
// the average of the total response size.
|
|
1447
|
+
if (fulfilledEntries === null) {
|
|
1448
|
+
// Haven't received enough data yet to know which segments
|
|
1449
|
+
// were included.
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
const averageSize = totalBytesReceivedSoFar / fulfilledEntries.length;
|
|
1453
|
+
for (const entry of fulfilledEntries){
|
|
1454
|
+
(0, _cachemap.setSizeInCacheMap)(entry, averageSize);
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
} else {
|
|
1458
|
+
const { stream, size } = await createNonTaskyPrefetchResponseStream(response.body);
|
|
1459
|
+
closed.resolve();
|
|
1460
|
+
prefetchStream = stream;
|
|
1461
|
+
bufferedResponseSize = size;
|
|
1462
|
+
}
|
|
1463
|
+
const [serverData, cacheData] = await Promise.all([
|
|
1464
|
+
(0, _fetchserverresponse.createFromNextReadableStream)(prefetchStream, headers, {
|
|
1465
|
+
allowPartialStream: true
|
|
1466
|
+
}),
|
|
1467
|
+
response.cacheData
|
|
1468
|
+
]);
|
|
1469
|
+
// Read head vary params synchronously. Individual segments carry their
|
|
1470
|
+
// own thenables in CacheNodeSeedData.
|
|
1471
|
+
const headVaryParamsThenable = serverData.h;
|
|
1472
|
+
const headVaryParams = headVaryParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(headVaryParamsThenable) : null;
|
|
1473
|
+
const now = Date.now();
|
|
1474
|
+
const staleAt = await getStaleAt(now, serverData.s, response);
|
|
1475
|
+
// PPRRuntime prefetches are partial when the server marks the response
|
|
1476
|
+
// as '~' (Partial). Full/LoadingBoundary prefetches are always complete.
|
|
1477
|
+
const isResponsePartial = fetchStrategy === _types.FetchStrategy.PPRRuntime && (cacheData?.isResponsePartial ?? false);
|
|
1155
1478
|
// Aside from writing the data into the cache, this function also returns
|
|
1156
1479
|
// the entries that were fulfilled, so we can streamingly update their sizes
|
|
1157
1480
|
// in the LRU as more data comes in.
|
|
1158
|
-
|
|
1481
|
+
const buildId = response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.b;
|
|
1482
|
+
const flightDatas = (0, _flightdatahelpers.normalizeFlightData)(serverData.f);
|
|
1483
|
+
if (typeof flightDatas === 'string') {
|
|
1484
|
+
rejectSegmentEntriesIfStillPending(spawnedEntries, Date.now() + 10 * 1000);
|
|
1485
|
+
return null;
|
|
1486
|
+
}
|
|
1487
|
+
const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, dynamicRequestTree, flightDatas, renderedSearch, // Not needed for prefetch responses; pass unknown to use the default.
|
|
1488
|
+
_bfcache.UnknownDynamicStaleTime);
|
|
1489
|
+
fulfilledEntries = writeDynamicRenderResponseIntoCache(now, fetchStrategy, flightDatas, buildId, isResponsePartial, headVaryParams, staleAt, navigationSeed, spawnedEntries);
|
|
1490
|
+
// For buffered responses, update LRU sizes now that we know which
|
|
1491
|
+
// entries were fulfilled.
|
|
1492
|
+
if (bufferedResponseSize !== null && fulfilledEntries !== null && fulfilledEntries.length > 0) {
|
|
1493
|
+
const averageSize = bufferedResponseSize / fulfilledEntries.length;
|
|
1494
|
+
for (const entry of fulfilledEntries){
|
|
1495
|
+
(0, _cachemap.setSizeInCacheMap)(entry, averageSize);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1159
1498
|
// Return a promise that resolves when the network connection closes, so
|
|
1160
1499
|
// the scheduler can track the number of concurrent network connections.
|
|
1161
1500
|
return {
|
|
@@ -1167,9 +1506,7 @@ async function fetchSegmentPrefetchesUsingDynamicRequest(task, route, fetchStrat
|
|
|
1167
1506
|
return null;
|
|
1168
1507
|
}
|
|
1169
1508
|
}
|
|
1170
|
-
function writeDynamicTreeResponseIntoCache(now,
|
|
1171
|
-
// Get the URL that was used to render the target page. This may be different
|
|
1172
|
-
// from the URL in the request URL, if the page was rewritten.
|
|
1509
|
+
function writeDynamicTreeResponseIntoCache(now, fetchStrategy, response, serverData, entry, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, headVaryParams, originalPathname, nextUrl) {
|
|
1173
1510
|
const renderedSearch = (0, _routeparams.getRenderedSearch)(response);
|
|
1174
1511
|
const normalizedFlightDataResult = (0, _flightdatahelpers.normalizeFlightData)(serverData.f);
|
|
1175
1512
|
if (// A string result means navigating to this route will result in an
|
|
@@ -1185,14 +1522,9 @@ function writeDynamicTreeResponseIntoCache(now, task, fetchStrategy, response, s
|
|
|
1185
1522
|
return;
|
|
1186
1523
|
}
|
|
1187
1524
|
const flightRouterState = flightData.tree;
|
|
1188
|
-
//
|
|
1189
|
-
//
|
|
1190
|
-
|
|
1191
|
-
const staleTimeMs = !isNaN(staleTimeSeconds) ? getStaleTimeMs(staleTimeSeconds) : _navigatereducer.STATIC_STALETIME_MS;
|
|
1192
|
-
// If the response contains dynamic holes, then we must conservatively assume
|
|
1193
|
-
// that any individual segment might contain dynamic holes, and also the
|
|
1194
|
-
// head. If it did not contain dynamic holes, then we can assume every segment
|
|
1195
|
-
// and the head is completely static.
|
|
1525
|
+
// If the response was postponed, segments may contain dynamic holes.
|
|
1526
|
+
// The head has its own partiality flag (flightDataEntry.isHeadPartial)
|
|
1527
|
+
// which is handled separately in writeDynamicRenderResponseIntoCache.
|
|
1196
1528
|
const isResponsePartial = response.headers.get(_approuterheaders.NEXT_DID_POSTPONE_HEADER) === '1';
|
|
1197
1529
|
// Convert the server-sent data into the RouteTree format used by the
|
|
1198
1530
|
// client cache.
|
|
@@ -1208,17 +1540,16 @@ function writeDynamicTreeResponseIntoCache(now, task, fetchStrategy, response, s
|
|
|
1208
1540
|
rejectRouteCacheEntry(entry, now + 10 * 1000);
|
|
1209
1541
|
return;
|
|
1210
1542
|
}
|
|
1211
|
-
|
|
1543
|
+
(0, _optimisticroutes.discoverKnownRoute)(now, originalPathname, nextUrl, entry, routeTree, metadataVaryPath, couldBeIntercepted, canonicalUrl, routeIsPPREnabled, false // hasDynamicRewrite
|
|
1544
|
+
);
|
|
1212
1545
|
// If the server sent segment data as part of the response, we should write
|
|
1213
1546
|
// it into the cache to prevent a second, redundant prefetch request.
|
|
1214
|
-
//
|
|
1215
|
-
//
|
|
1216
|
-
//
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
// remove the "client-only" option. Then, we can delete this function call.
|
|
1221
|
-
writeDynamicRenderResponseIntoCache(now, task, fetchStrategy, response, serverData, isResponsePartial, fulfilledEntry, null);
|
|
1547
|
+
// TODO: This is a leftover branch from before Client Segment Cache was
|
|
1548
|
+
// enabled everywhere. Tree prefetches should never include segment data. We
|
|
1549
|
+
// can delete it. Leaving for a subsequent PR.
|
|
1550
|
+
const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, flightRouterState, normalizedFlightDataResult, renderedSearch, _bfcache.UnknownDynamicStaleTime);
|
|
1551
|
+
const buildId = response.headers.get(_constants.NEXT_NAV_DEPLOYMENT_ID_HEADER) ?? serverData.b;
|
|
1552
|
+
writeDynamicRenderResponseIntoCache(now, fetchStrategy, normalizedFlightDataResult, buildId, isResponsePartial, headVaryParams, getStaleAtFromHeader(now, response), navigationSeed, null);
|
|
1222
1553
|
}
|
|
1223
1554
|
function rejectSegmentEntriesIfStillPending(entries, staleAt) {
|
|
1224
1555
|
const fulfilledEntries = [];
|
|
@@ -1231,31 +1562,19 @@ function rejectSegmentEntriesIfStillPending(entries, staleAt) {
|
|
|
1231
1562
|
}
|
|
1232
1563
|
return fulfilledEntries;
|
|
1233
1564
|
}
|
|
1234
|
-
function writeDynamicRenderResponseIntoCache(now,
|
|
1235
|
-
if (
|
|
1565
|
+
function writeDynamicRenderResponseIntoCache(now, fetchStrategy, flightDatas, buildId, isResponsePartial, headVaryParams, staleAt, navigationSeed, spawnedEntries) {
|
|
1566
|
+
if (buildId && buildId !== (0, _navigationbuildid.getNavigationBuildId)()) {
|
|
1236
1567
|
// The server build does not match the client. Treat as a 404. During
|
|
1237
1568
|
// an actual navigation, the router will trigger an MPA navigation.
|
|
1238
|
-
// TODO: Consider moving the build ID to a response header so we can check
|
|
1239
|
-
// it before decoding the response, and so there's one way of checking
|
|
1240
|
-
// across all response types.
|
|
1241
1569
|
if (spawnedEntries !== null) {
|
|
1242
1570
|
rejectSegmentEntriesIfStillPending(spawnedEntries, now + 10 * 1000);
|
|
1243
1571
|
}
|
|
1244
1572
|
return null;
|
|
1245
1573
|
}
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
return null;
|
|
1251
|
-
}
|
|
1252
|
-
// For runtime prefetches, stale time is in the payload at rp[1].
|
|
1253
|
-
// For other responses, fall back to the header.
|
|
1254
|
-
const staleTimeSeconds = typeof serverData.rp?.[1] === 'number' ? serverData.rp[1] : parseInt(response.headers.get(_approuterheaders.NEXT_ROUTER_STALE_TIME_HEADER) ?? '', 10);
|
|
1255
|
-
const staleTimeMs = !isNaN(staleTimeSeconds) ? getStaleTimeMs(staleTimeSeconds) : _navigatereducer.STATIC_STALETIME_MS;
|
|
1256
|
-
const staleAt = now + staleTimeMs;
|
|
1257
|
-
for (const flightData of flightDatas){
|
|
1258
|
-
const seedData = flightData.seedData;
|
|
1574
|
+
const routeTree = navigationSeed.routeTree;
|
|
1575
|
+
const metadataTree = navigationSeed.metadataVaryPath !== null ? createMetadataRouteTree(navigationSeed.metadataVaryPath) : null;
|
|
1576
|
+
for (const flightDataEntry of flightDatas){
|
|
1577
|
+
const seedData = flightDataEntry.seedData;
|
|
1259
1578
|
if (seedData !== null) {
|
|
1260
1579
|
// The data sent by the server represents only a subtree of the app. We
|
|
1261
1580
|
// need to find the part of the task tree that matches the response.
|
|
@@ -1264,8 +1583,8 @@ function writeDynamicRenderResponseIntoCache(now, task, fetchStrategy, response,
|
|
|
1264
1583
|
// pattern of parallel route key and segment:
|
|
1265
1584
|
//
|
|
1266
1585
|
// [string, Segment, string, Segment, string, Segment, ...]
|
|
1267
|
-
const segmentPath =
|
|
1268
|
-
let tree =
|
|
1586
|
+
const segmentPath = flightDataEntry.segmentPath;
|
|
1587
|
+
let tree = routeTree;
|
|
1269
1588
|
for(let i = 0; i < segmentPath.length; i += 2){
|
|
1270
1589
|
const parallelRouteKey = segmentPath[i];
|
|
1271
1590
|
if (tree?.slots?.[parallelRouteKey] !== undefined) {
|
|
@@ -1277,11 +1596,22 @@ function writeDynamicRenderResponseIntoCache(now, task, fetchStrategy, response,
|
|
|
1277
1596
|
return null;
|
|
1278
1597
|
}
|
|
1279
1598
|
}
|
|
1280
|
-
writeSeedDataIntoCache(now,
|
|
1599
|
+
writeSeedDataIntoCache(now, fetchStrategy, tree, staleAt, seedData, isResponsePartial, spawnedEntries);
|
|
1281
1600
|
}
|
|
1282
|
-
const head =
|
|
1283
|
-
if (head !== null) {
|
|
1284
|
-
|
|
1601
|
+
const head = flightDataEntry.head;
|
|
1602
|
+
if (head !== null && metadataTree !== null) {
|
|
1603
|
+
// When Cache Components is enabled, the server conservatively marks
|
|
1604
|
+
// the head as partial during static generation (isPossiblyPartialHead
|
|
1605
|
+
// in app-render.tsx), even for fully static pages where the head is
|
|
1606
|
+
// actually complete. When the response is non-partial, we override
|
|
1607
|
+
// this since the server confirmed no dynamic content exists.
|
|
1608
|
+
//
|
|
1609
|
+
// Without Cache Components, the server always sends the correct
|
|
1610
|
+
// isHeadPartial value, so no override is needed.
|
|
1611
|
+
const isHeadPartial = !isResponsePartial && process.env.__NEXT_CACHE_COMPONENTS ? false : flightDataEntry.isHeadPartial;
|
|
1612
|
+
fulfillEntrySpawnedByRuntimePrefetch(now, fetchStrategy, head, isHeadPartial, staleAt, // For head entries, use the head-specific vary params passed as
|
|
1613
|
+
// parameter.
|
|
1614
|
+
headVaryParams, metadataTree, spawnedEntries);
|
|
1285
1615
|
}
|
|
1286
1616
|
}
|
|
1287
1617
|
// Any entry that's still pending was intentionally not rendered by the
|
|
@@ -1298,13 +1628,17 @@ function writeDynamicRenderResponseIntoCache(now, task, fetchStrategy, response,
|
|
|
1298
1628
|
}
|
|
1299
1629
|
return null;
|
|
1300
1630
|
}
|
|
1301
|
-
function writeSeedDataIntoCache(now,
|
|
1631
|
+
function writeSeedDataIntoCache(now, fetchStrategy, tree, staleAt, seedData, isResponsePartial, entriesOwnedByCurrentTask) {
|
|
1302
1632
|
// This function is used to write the result of a runtime server request
|
|
1303
1633
|
// (CacheNodeSeedData) into the prefetch cache.
|
|
1304
1634
|
const rsc = seedData[0];
|
|
1305
|
-
const loading = seedData[2];
|
|
1306
1635
|
const isPartial = rsc === null || isResponsePartial;
|
|
1307
|
-
|
|
1636
|
+
const varyParamsThenable = seedData[4];
|
|
1637
|
+
// Each segment carries its own vary params thenable in the seed data. The
|
|
1638
|
+
// thenable resolves to the set of params the segment accessed during render.
|
|
1639
|
+
// A null thenable means tracking was not enabled (not a prerender).
|
|
1640
|
+
const varyParams = varyParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(varyParamsThenable) : null;
|
|
1641
|
+
fulfillEntrySpawnedByRuntimePrefetch(now, fetchStrategy, rsc, isPartial, staleAt, varyParams, tree, entriesOwnedByCurrentTask);
|
|
1308
1642
|
// Recursively write the child data into the cache.
|
|
1309
1643
|
const slots = tree.slots;
|
|
1310
1644
|
if (slots !== null) {
|
|
@@ -1313,30 +1647,45 @@ function writeSeedDataIntoCache(now, task, fetchStrategy, route, tree, staleAt,
|
|
|
1313
1647
|
const childTree = slots[parallelRouteKey];
|
|
1314
1648
|
const childSeedData = seedDataChildren[parallelRouteKey];
|
|
1315
1649
|
if (childSeedData !== null && childSeedData !== undefined) {
|
|
1316
|
-
writeSeedDataIntoCache(now,
|
|
1650
|
+
writeSeedDataIntoCache(now, fetchStrategy, childTree, staleAt, childSeedData, isResponsePartial, entriesOwnedByCurrentTask);
|
|
1317
1651
|
}
|
|
1318
1652
|
}
|
|
1319
1653
|
}
|
|
1320
1654
|
}
|
|
1321
|
-
function fulfillEntrySpawnedByRuntimePrefetch(now, fetchStrategy,
|
|
1655
|
+
function fulfillEntrySpawnedByRuntimePrefetch(now, fetchStrategy, rsc, isPartial, staleAt, segmentVaryParams, tree, entriesOwnedByCurrentTask) {
|
|
1322
1656
|
// We should only write into cache entries that are owned by us. Or create
|
|
1323
1657
|
// a new one and write into that. We must never write over an entry that was
|
|
1324
1658
|
// created by a different task, because that causes data races.
|
|
1325
1659
|
const ownedEntry = entriesOwnedByCurrentTask !== null ? entriesOwnedByCurrentTask.get(tree.requestKey) : undefined;
|
|
1326
1660
|
if (ownedEntry !== undefined) {
|
|
1327
|
-
fulfillSegmentCacheEntry(ownedEntry, rsc,
|
|
1661
|
+
const fulfilledEntry = fulfillSegmentCacheEntry(ownedEntry, rsc, staleAt, isPartial);
|
|
1662
|
+
// Re-key the entry based on which params the segment actually depends on.
|
|
1663
|
+
if (process.env.__NEXT_VARY_PARAMS && segmentVaryParams !== null) {
|
|
1664
|
+
const fulfilledVaryPath = (0, _varypath.getFulfilledSegmentVaryPath)(tree.varyPath, segmentVaryParams);
|
|
1665
|
+
const isRevalidation = false;
|
|
1666
|
+
(0, _cachemap.setInCacheMap)(segmentCacheMap, fulfilledVaryPath, fulfilledEntry, isRevalidation);
|
|
1667
|
+
}
|
|
1328
1668
|
} else {
|
|
1329
1669
|
// There's no matching entry. Attempt to create a new one.
|
|
1330
|
-
const possiblyNewEntry = readOrCreateSegmentCacheEntry(now, fetchStrategy,
|
|
1670
|
+
const possiblyNewEntry = readOrCreateSegmentCacheEntry(now, fetchStrategy, tree);
|
|
1331
1671
|
if (possiblyNewEntry.status === 0) {
|
|
1332
1672
|
// Confirmed this is a new entry. We can fulfill it.
|
|
1333
1673
|
const newEntry = possiblyNewEntry;
|
|
1334
|
-
fulfillSegmentCacheEntry(upgradeToPendingSegment(newEntry, fetchStrategy), rsc,
|
|
1674
|
+
const fulfilledEntry = fulfillSegmentCacheEntry(upgradeToPendingSegment(newEntry, fetchStrategy), rsc, staleAt, isPartial);
|
|
1675
|
+
// Re-key the entry based on which params the segment actually depends on.
|
|
1676
|
+
if (process.env.__NEXT_VARY_PARAMS && segmentVaryParams !== null) {
|
|
1677
|
+
const fulfilledVaryPath = (0, _varypath.getFulfilledSegmentVaryPath)(tree.varyPath, segmentVaryParams);
|
|
1678
|
+
const isRevalidation = false;
|
|
1679
|
+
(0, _cachemap.setInCacheMap)(segmentCacheMap, fulfilledVaryPath, fulfilledEntry, isRevalidation);
|
|
1680
|
+
}
|
|
1335
1681
|
} else {
|
|
1336
1682
|
// There was already an entry in the cache. But we may be able to
|
|
1337
1683
|
// replace it with the new one from the server.
|
|
1338
|
-
const newEntry = fulfillSegmentCacheEntry(upgradeToPendingSegment(createDetachedSegmentCacheEntry(
|
|
1339
|
-
|
|
1684
|
+
const newEntry = fulfillSegmentCacheEntry(upgradeToPendingSegment(createDetachedSegmentCacheEntry(now), fetchStrategy), rsc, staleAt, isPartial);
|
|
1685
|
+
// Use the fulfilled vary path if available, otherwise fall back to
|
|
1686
|
+
// the request vary path.
|
|
1687
|
+
const varyPath = process.env.__NEXT_VARY_PARAMS && segmentVaryParams !== null ? (0, _varypath.getFulfilledSegmentVaryPath)(tree.varyPath, segmentVaryParams) : (0, _varypath.getSegmentVaryPathForRequest)(fetchStrategy, tree);
|
|
1688
|
+
upsertSegmentEntry(now, varyPath, newEntry);
|
|
1340
1689
|
}
|
|
1341
1690
|
}
|
|
1342
1691
|
}
|
|
@@ -1345,7 +1694,7 @@ async function fetchPrefetchResponse(url, headers) {
|
|
|
1345
1694
|
// When issuing a prefetch request, don't immediately decode the response; we
|
|
1346
1695
|
// use the lower level `createFromResponse` API instead because we need to do
|
|
1347
1696
|
// some extra processing of the response stream. See
|
|
1348
|
-
// `
|
|
1697
|
+
// `createNonTaskyPrefetchResponseStream` for more details.
|
|
1349
1698
|
const shouldImmediatelyDecode = false;
|
|
1350
1699
|
const response = await (0, _fetchserverresponse.createFetch)(url, headers, fetchPriority, shouldImmediatelyDecode);
|
|
1351
1700
|
if (!response.ok) {
|
|
@@ -1366,20 +1715,69 @@ async function fetchPrefetchResponse(url, headers) {
|
|
|
1366
1715
|
}
|
|
1367
1716
|
return response;
|
|
1368
1717
|
}
|
|
1369
|
-
function
|
|
1370
|
-
//
|
|
1371
|
-
//
|
|
1372
|
-
//
|
|
1373
|
-
//
|
|
1374
|
-
//
|
|
1375
|
-
// (via useDeferredValue(dynamic, static)).
|
|
1718
|
+
async function createNonTaskyPrefetchResponseStream(body) {
|
|
1719
|
+
// Buffer the entire response before passing it to the Flight client. This
|
|
1720
|
+
// ensures that when Flight processes the stream, all model data is available
|
|
1721
|
+
// synchronously. This is important for readVaryParams, which synchronously
|
|
1722
|
+
// checks the thenable status — if data arrived in multiple network chunks,
|
|
1723
|
+
// the thenables might not yet be fulfilled.
|
|
1376
1724
|
//
|
|
1377
|
-
//
|
|
1378
|
-
//
|
|
1379
|
-
//
|
|
1380
|
-
//
|
|
1725
|
+
// TODO: There are too many intermediate stream transformations in the
|
|
1726
|
+
// prefetch response pipeline (e.g. stripIsPartialByte, this function).
|
|
1727
|
+
// These could all be consolidated into a single transformation. Refactor
|
|
1728
|
+
// once the cached navigations experiment lands.
|
|
1381
1729
|
//
|
|
1382
|
-
//
|
|
1730
|
+
// Read the entire response from the network.
|
|
1731
|
+
const reader = body.getReader();
|
|
1732
|
+
const chunks = [];
|
|
1733
|
+
let size = 0;
|
|
1734
|
+
while(true){
|
|
1735
|
+
const { done, value } = await reader.read();
|
|
1736
|
+
if (done) break;
|
|
1737
|
+
chunks.push(value);
|
|
1738
|
+
size += value.byteLength;
|
|
1739
|
+
}
|
|
1740
|
+
// Concatenate into a single chunk so that Flight's processBinaryChunk
|
|
1741
|
+
// processes all rows synchronously in one call. Multiple chunks would not
|
|
1742
|
+
// be sufficient: even though reader.read() resolves as a microtask for
|
|
1743
|
+
// already-enqueued data, the `await` continuation from
|
|
1744
|
+
// createFromReadableStream can interleave between chunks. If the root
|
|
1745
|
+
// model row isn't the first row (e.g. outlined values come first), the
|
|
1746
|
+
// PromiseResolveThenableJob from `await` can cause the root to initialize
|
|
1747
|
+
// eagerly, scheduling the continuation before remaining chunks (including
|
|
1748
|
+
// promise value rows) are processed. A single chunk avoids this.
|
|
1749
|
+
let buffer;
|
|
1750
|
+
if (chunks.length === 1) {
|
|
1751
|
+
buffer = chunks[0];
|
|
1752
|
+
} else if (chunks.length > 1) {
|
|
1753
|
+
buffer = new Uint8Array(size);
|
|
1754
|
+
let offset = 0;
|
|
1755
|
+
for (const chunk of chunks){
|
|
1756
|
+
buffer.set(chunk, offset);
|
|
1757
|
+
offset += chunk.byteLength;
|
|
1758
|
+
}
|
|
1759
|
+
} else {
|
|
1760
|
+
buffer = new Uint8Array(0);
|
|
1761
|
+
}
|
|
1762
|
+
const stream = new ReadableStream({
|
|
1763
|
+
start (controller) {
|
|
1764
|
+
controller.enqueue(buffer);
|
|
1765
|
+
controller.close();
|
|
1766
|
+
}
|
|
1767
|
+
});
|
|
1768
|
+
return {
|
|
1769
|
+
stream,
|
|
1770
|
+
size
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Creates a streaming (non-buffered) prefetch response stream for dynamic/Full
|
|
1775
|
+
* prefetches. These are essentially dynamic responses that get stored in the
|
|
1776
|
+
* prefetch cache — they don't carry vary params or other cache metadata that
|
|
1777
|
+
* requires synchronous thenable resolution, so there's no need to buffer them.
|
|
1778
|
+
* They should continue to stream so consumers can process data as it arrives.
|
|
1779
|
+
*/ function createIncrementalPrefetchResponseStream(originalFlightStream, onStreamClose, onResponseSizeUpdate) {
|
|
1780
|
+
// While processing the original stream, we incrementally update the size
|
|
1383
1781
|
// of the cache entry in the LRU.
|
|
1384
1782
|
let totalByteLength = 0;
|
|
1385
1783
|
const reader = originalFlightStream.getReader();
|
|
@@ -1392,15 +1790,11 @@ function createPrefetchResponseStream(originalFlightStream, onStreamClose, onRes
|
|
|
1392
1790
|
// from the server.
|
|
1393
1791
|
controller.enqueue(value);
|
|
1394
1792
|
// Incrementally update the size of the cache entry in the LRU.
|
|
1395
|
-
// NOTE: Since prefetch responses are delivered in a single chunk,
|
|
1396
|
-
// it's not really necessary to do this streamingly, but I'm doing it
|
|
1397
|
-
// anyway in case this changes in the future.
|
|
1398
1793
|
totalByteLength += value.byteLength;
|
|
1399
1794
|
onResponseSizeUpdate(totalByteLength);
|
|
1400
1795
|
continue;
|
|
1401
1796
|
}
|
|
1402
|
-
|
|
1403
|
-
// the target stream. We do notify the caller, though.
|
|
1797
|
+
controller.close();
|
|
1404
1798
|
onStreamClose();
|
|
1405
1799
|
return;
|
|
1406
1800
|
}
|
|
@@ -1422,6 +1816,113 @@ function addSegmentPathToUrlInOutputExportMode(url, segmentPath) {
|
|
|
1422
1816
|
function canNewFetchStrategyProvideMoreContent(currentStrategy, newStrategy) {
|
|
1423
1817
|
return currentStrategy < newStrategy;
|
|
1424
1818
|
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Adds the instant prefetch header if the navigation lock is active.
|
|
1821
|
+
* Uses a lazy require to ensure dead code elimination.
|
|
1822
|
+
*/ function addInstantPrefetchHeaderIfLocked(headers) {
|
|
1823
|
+
if (process.env.__NEXT_EXPOSE_TESTING_API) {
|
|
1824
|
+
const { isNavigationLocked } = require('./navigation-testing-lock');
|
|
1825
|
+
if (isNavigationLocked()) {
|
|
1826
|
+
headers[_approuterheaders.NEXT_INSTANT_PREFETCH_HEADER] = '1';
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
function getStaleAtFromHeader(now, response) {
|
|
1831
|
+
const staleTimeSeconds = parseInt(response.headers.get(_approuterheaders.NEXT_ROUTER_STALE_TIME_HEADER) ?? '', 10);
|
|
1832
|
+
const staleTimeMs = !isNaN(staleTimeSeconds) ? getStaleTimeMs(staleTimeSeconds) : _navigatereducer.STATIC_STALETIME_MS;
|
|
1833
|
+
return now + staleTimeMs;
|
|
1834
|
+
}
|
|
1835
|
+
async function getStaleAt(now, staleTimeIterable, response) {
|
|
1836
|
+
if (staleTimeIterable !== undefined) {
|
|
1837
|
+
// Iterate the async iterable and take the last yielded value. The server
|
|
1838
|
+
// yields updated staleTime values during the render; the last one is the
|
|
1839
|
+
// final staleTime.
|
|
1840
|
+
let staleTimeSeconds;
|
|
1841
|
+
for await (const value of staleTimeIterable){
|
|
1842
|
+
staleTimeSeconds = value;
|
|
1843
|
+
}
|
|
1844
|
+
if (staleTimeSeconds !== undefined) {
|
|
1845
|
+
const staleTimeMs = isNaN(staleTimeSeconds) ? _navigatereducer.STATIC_STALETIME_MS : getStaleTimeMs(staleTimeSeconds);
|
|
1846
|
+
return now + staleTimeMs;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
if (response !== undefined) {
|
|
1850
|
+
return getStaleAtFromHeader(now, response);
|
|
1851
|
+
}
|
|
1852
|
+
return now + _navigatereducer.STATIC_STALETIME_MS;
|
|
1853
|
+
}
|
|
1854
|
+
function writeStaticStageResponseIntoCache(now, flightData, buildId, headVaryParamsThenable, staleAt, baseTree, renderedSearch, isResponsePartial) {
|
|
1855
|
+
const fetchStrategy = isResponsePartial ? _types.FetchStrategy.PPR : _types.FetchStrategy.Full;
|
|
1856
|
+
const headVaryParams = headVaryParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(headVaryParamsThenable) : null;
|
|
1857
|
+
const flightDatas = (0, _flightdatahelpers.normalizeFlightData)(flightData);
|
|
1858
|
+
if (typeof flightDatas === 'string') {
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, baseTree, flightDatas, renderedSearch, _bfcache.UnknownDynamicStaleTime);
|
|
1862
|
+
writeDynamicRenderResponseIntoCache(now, fetchStrategy, flightDatas, buildId, isResponsePartial, headVaryParams, staleAt, navigationSeed, null // spawnedEntries — no pre-created entries; will create or upsert
|
|
1863
|
+
);
|
|
1864
|
+
}
|
|
1865
|
+
async function processRuntimePrefetchStream(now, runtimePrefetchStream, baseTree, renderedSearch) {
|
|
1866
|
+
const { stream, isPartial } = await stripIsPartialByte(runtimePrefetchStream);
|
|
1867
|
+
const serverData = await (0, _fetchserverresponse.createFromNextReadableStream)(stream, undefined, {
|
|
1868
|
+
allowPartialStream: true
|
|
1869
|
+
});
|
|
1870
|
+
const headVaryParamsThenable = serverData.h;
|
|
1871
|
+
const headVaryParams = headVaryParamsThenable !== null ? (0, _varyparamsdecoding.readVaryParams)(headVaryParamsThenable) : null;
|
|
1872
|
+
const staleAt = await getStaleAt(now, serverData.s);
|
|
1873
|
+
const flightDatas = (0, _flightdatahelpers.normalizeFlightData)(serverData.f);
|
|
1874
|
+
if (typeof flightDatas === 'string') {
|
|
1875
|
+
return null;
|
|
1876
|
+
}
|
|
1877
|
+
const navigationSeed = (0, _navigation.convertServerPatchToFullTree)(now, baseTree, flightDatas, renderedSearch, _bfcache.UnknownDynamicStaleTime);
|
|
1878
|
+
return {
|
|
1879
|
+
flightDatas,
|
|
1880
|
+
navigationSeed,
|
|
1881
|
+
buildId: serverData.b,
|
|
1882
|
+
isResponsePartial: isPartial,
|
|
1883
|
+
headVaryParams,
|
|
1884
|
+
staleAt
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
async function stripIsPartialByte(stream) {
|
|
1888
|
+
// When there is no recognized marker byte, the fallback depends on whether
|
|
1889
|
+
// Cached Navigations is enabled. When enabled, dynamic navigation responses
|
|
1890
|
+
// don't have a marker but may contain dynamic holes, so they are treated as
|
|
1891
|
+
// partial. When disabled, unmarked responses are treated as non-partial.
|
|
1892
|
+
const defaultIsPartial = !!process.env.__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS;
|
|
1893
|
+
const reader = stream.getReader();
|
|
1894
|
+
const { done, value } = await reader.read();
|
|
1895
|
+
if (done || !value || value.byteLength === 0) {
|
|
1896
|
+
return {
|
|
1897
|
+
stream: new ReadableStream({
|
|
1898
|
+
start: (c)=>c.close()
|
|
1899
|
+
}),
|
|
1900
|
+
isPartial: defaultIsPartial
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
const firstByte = value[0];
|
|
1904
|
+
const hasMarker = firstByte === 0x23 || firstByte === 0x7e;
|
|
1905
|
+
const isPartial = hasMarker ? firstByte === 0x7e : defaultIsPartial;
|
|
1906
|
+
const remainder = hasMarker ? value.byteLength > 1 ? value.subarray(1) : null : value;
|
|
1907
|
+
return {
|
|
1908
|
+
isPartial,
|
|
1909
|
+
stream: new ReadableStream({
|
|
1910
|
+
start (controller) {
|
|
1911
|
+
if (remainder) {
|
|
1912
|
+
controller.enqueue(remainder);
|
|
1913
|
+
}
|
|
1914
|
+
},
|
|
1915
|
+
async pull (controller) {
|
|
1916
|
+
const result = await reader.read();
|
|
1917
|
+
if (result.done) {
|
|
1918
|
+
controller.close();
|
|
1919
|
+
} else {
|
|
1920
|
+
controller.enqueue(result.value);
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
})
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1425
1926
|
|
|
1426
1927
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
1427
1928
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|