@rangojs/router 0.5.1 → 0.6.0
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/README.md +5 -1
- package/dist/bin/rango.js +343 -125
- package/dist/types/browser/event-controller.d.ts +6 -0
- package/dist/types/browser/react/use-router.d.ts +10 -3
- package/dist/types/browser/react/use-search-params.d.ts +57 -10
- package/dist/types/browser/types.d.ts +22 -0
- package/dist/types/build/merge-full-manifests.d.ts +3 -0
- package/dist/types/build/route-trie.d.ts +4 -73
- package/dist/types/build/route-types/per-module-writer.d.ts +6 -4
- package/dist/types/build/route-types/router-processing.d.ts +2 -3
- package/dist/types/cache/cache-exec-scope.d.ts +31 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +8 -1
- package/dist/types/cache/cf/cf-cache-store.d.ts +15 -1
- package/dist/types/cache/cf/cf-cache-types.d.ts +1 -1
- package/dist/types/cache/cf/cf-kv-utils.d.ts +21 -0
- package/dist/types/cache/taint.d.ts +12 -6
- package/dist/types/client-urls/client-root.d.ts +38 -0
- package/dist/types/client-urls/client-urls.d.ts +5 -0
- package/dist/types/client-urls/navigation.d.ts +38 -0
- package/dist/types/client-urls/revalidation-protocol.d.ts +25 -0
- package/dist/types/client-urls/server-projection.d.ts +62 -0
- package/dist/types/client-urls/types.d.ts +144 -0
- package/dist/types/client.d.ts +12 -4
- package/dist/types/client.rsc.d.ts +4 -1
- package/dist/types/decode-loader-results.d.ts +37 -0
- package/dist/types/errors.d.ts +1 -0
- package/dist/types/handles/is-thenable.d.ts +2 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/loader-redirect.d.ts +27 -0
- package/dist/types/outlet-context.d.ts +12 -0
- package/dist/types/outlet-provider.d.ts +3 -1
- package/dist/types/redirect-origin.d.ts +4 -0
- package/dist/types/route-content-wrapper.d.ts +42 -1
- package/dist/types/route-definition/helpers-types.d.ts +13 -2
- package/dist/types/router/error-handling.d.ts +35 -1
- package/dist/types/router/intercept-resolution.d.ts +12 -0
- package/dist/types/router/loader-resolution.d.ts +24 -2
- package/dist/types/router/revalidation.d.ts +7 -0
- package/dist/{types.backup/build/route-trie.d.ts → types/router/route-trie-builder.d.ts} +4 -16
- package/dist/types/router/router-interfaces.d.ts +20 -0
- package/dist/types/router/segment-resolution/helpers.d.ts +1 -1
- package/dist/types/router/trie-matching.d.ts +1 -1
- package/dist/types/rsc/helpers.d.ts +3 -0
- package/dist/types/rsc/manifest-init.d.ts +5 -5
- package/dist/types/rsc/render-pipeline.d.ts +9 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +17 -0
- package/dist/types/rsc/shell-capture.d.ts +9 -0
- package/dist/types/rsc/shell-serve.d.ts +11 -0
- package/dist/types/rsc/types.d.ts +30 -0
- package/dist/types/segment-system.d.ts +2 -0
- package/dist/types/server/context.d.ts +10 -0
- package/dist/types/server/handle-store.d.ts +34 -3
- package/dist/types/server/request-context.d.ts +14 -1
- package/dist/types/server.d.ts +1 -0
- package/dist/types/ssr/index.d.ts +22 -0
- package/dist/types/ssr/ssr-root.d.ts +10 -0
- package/dist/types/testing/dom.entry.d.ts +1 -1
- package/dist/types/testing/render-route.d.ts +16 -6
- package/dist/types/testing/run-loader.d.ts +9 -0
- package/dist/types/types/boundaries.d.ts +22 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/loader-types.d.ts +57 -5
- package/dist/types/types/segments.d.ts +7 -0
- package/dist/types/urls/path-helper-types.d.ts +10 -4
- package/dist/types/vite/discovery/client-urls-projection.d.ts +53 -0
- package/dist/types/vite/discovery/discover-routers.d.ts +1 -1
- package/dist/types/vite/discovery/state.d.ts +8 -1
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +10 -0
- package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
- package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
- package/dist/types/vite/utils/shared-utils.d.ts +12 -0
- package/dist/vite/index.js +5101 -2056
- package/package.json +3 -3
- package/skills/breadcrumbs/SKILL.md +39 -9
- package/skills/caching/SKILL.md +1 -1
- package/skills/catalog.json +7 -1
- package/skills/client-urls/SKILL.md +338 -0
- package/skills/comparison/references/framework-comparison.md +23 -9
- package/skills/hooks/SKILL.md +2 -2
- package/skills/hooks/data.md +11 -2
- package/skills/hooks/handle-and-actions.md +7 -0
- package/skills/hooks/outlets.md +26 -5
- package/skills/hooks/urls.md +40 -3
- package/skills/loader/SKILL.md +132 -20
- package/skills/migrate-nextjs/SKILL.md +70 -10
- package/skills/migrate-react-router/SKILL.md +49 -13
- package/skills/migrate-react-router/component-migration.md +18 -13
- package/skills/migrate-react-router/data-and-actions.md +14 -3
- package/skills/migrate-react-router/route-mapping.md +15 -2
- package/skills/mime-routes/SKILL.md +3 -1
- package/skills/parallel/SKILL.md +32 -1
- package/skills/ppr/SKILL.md +16 -6
- package/skills/prerender/SKILL.md +8 -4
- package/skills/rango/SKILL.md +21 -17
- package/skills/react-compiler/SKILL.md +3 -3
- package/skills/response-routes/SKILL.md +4 -2
- package/skills/route/SKILL.md +5 -2
- package/skills/router-setup/SKILL.md +16 -2
- package/skills/scripts/SKILL.md +16 -6
- package/skills/shell-manifest/SKILL.md +16 -7
- package/skills/testing/SKILL.md +2 -2
- package/skills/testing/client-components.md +6 -0
- package/skills/testing/handles.md +30 -8
- package/skills/testing/loader.md +51 -49
- package/skills/testing/middleware.md +1 -1
- package/skills/theme/SKILL.md +8 -5
- package/skills/typesafety/generated-files-and-cli.md +16 -9
- package/skills/typesafety/route-types.md +5 -1
- package/skills/use-cache/SKILL.md +47 -0
- package/src/bin/rango.ts +7 -3
- package/src/browser/event-controller.ts +40 -15
- package/src/browser/navigation-bridge.ts +6 -0
- package/src/browser/navigation-client.ts +5 -0
- package/src/browser/partial-update.ts +77 -10
- package/src/browser/react/NavigationProvider.tsx +7 -0
- package/src/browser/react/use-router.ts +40 -11
- package/src/browser/react/use-search-params.ts +140 -17
- package/src/browser/rsc-router.tsx +59 -0
- package/src/browser/server-action-bridge.ts +26 -0
- package/src/browser/types.ts +22 -0
- package/src/build/merge-full-manifests.ts +161 -0
- package/src/build/route-trie.ts +9 -332
- package/src/build/route-types/include-resolution.ts +66 -11
- package/src/build/route-types/per-module-writer.ts +11 -6
- package/src/build/route-types/router-processing.ts +184 -153
- package/src/build/runtime-discovery.ts +23 -12
- package/src/cache/cache-exec-scope.ts +47 -0
- package/src/cache/cache-runtime.ts +113 -40
- package/src/cache/cf/cf-cache-constants.ts +8 -1
- package/src/cache/cf/cf-cache-store.ts +41 -64
- package/src/cache/cf/cf-cache-types.ts +1 -1
- package/src/cache/cf/cf-kv-utils.ts +38 -0
- package/src/cache/segment-codec.ts +21 -5
- package/src/cache/taint.ts +28 -9
- package/src/client-urls/client-root.tsx +168 -0
- package/src/client-urls/client-urls.ts +698 -0
- package/src/client-urls/navigation.ts +237 -0
- package/src/client-urls/revalidation-protocol.ts +56 -0
- package/src/client-urls/server-projection.ts +579 -0
- package/src/client-urls/types.ts +195 -0
- package/src/client.rsc.tsx +12 -0
- package/src/client.tsx +49 -6
- package/src/decode-loader-results.ts +113 -0
- package/src/errors.ts +14 -0
- package/src/handles/deferred-resolution.ts +14 -7
- package/src/handles/is-thenable.ts +2 -4
- package/src/index.ts +1 -0
- package/src/loader-redirect.tsx +64 -0
- package/src/outlet-context.ts +12 -0
- package/src/outlet-provider.tsx +15 -1
- package/src/redirect-origin.ts +29 -0
- package/src/route-content-wrapper.tsx +96 -3
- package/src/route-definition/dsl-helpers.ts +28 -3
- package/src/route-definition/helpers-types.ts +13 -0
- package/src/route-definition/redirect.ts +17 -18
- package/src/router/error-handling.ts +65 -11
- package/src/router/intercept-resolution.ts +29 -0
- package/src/router/loader-resolution.ts +261 -28
- package/src/router/match-middleware/cache-lookup.ts +24 -15
- package/src/router/match-result.ts +7 -0
- package/src/router/revalidation.ts +24 -11
- package/src/router/route-trie-builder.ts +334 -0
- package/src/router/router-interfaces.ts +38 -0
- package/src/router/segment-resolution/fresh.ts +47 -0
- package/src/router/segment-resolution/helpers.ts +9 -11
- package/src/router/segment-resolution/loader-cache.ts +14 -24
- package/src/router/segment-resolution/revalidation.ts +20 -1
- package/src/router/trie-matching.ts +3 -3
- package/src/router.ts +46 -1
- package/src/rsc/full-payload.ts +6 -0
- package/src/rsc/handler.ts +36 -12
- package/src/rsc/helpers.ts +13 -0
- package/src/rsc/loader-fetch.ts +2 -2
- package/src/rsc/manifest-init.ts +28 -9
- package/src/rsc/progressive-enhancement.ts +247 -70
- package/src/rsc/render-pipeline.ts +68 -24
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +569 -302
- package/src/rsc/server-action.ts +180 -71
- package/src/rsc/shell-capture-constants.ts +18 -0
- package/src/rsc/shell-capture.ts +104 -21
- package/src/rsc/shell-serve.ts +15 -2
- package/src/rsc/ssr-setup.ts +10 -1
- package/src/rsc/types.ts +31 -2
- package/src/segment-system.tsx +83 -26
- package/src/server/context.ts +10 -0
- package/src/server/cookie-store.ts +19 -19
- package/src/server/handle-store.ts +185 -48
- package/src/server/request-context.ts +36 -6
- package/src/server.ts +7 -0
- package/src/ssr/index.tsx +37 -2
- package/src/ssr/ssr-root.tsx +30 -2
- package/src/testing/dom.entry.ts +1 -1
- package/src/testing/render-route.tsx +22 -8
- package/src/testing/run-loader.ts +51 -13
- package/src/types/boundaries.ts +19 -0
- package/src/types/index.ts +1 -0
- package/src/types/loader-types.ts +60 -5
- package/src/types/segments.ts +7 -0
- package/src/urls/include-helper.ts +22 -4
- package/src/urls/path-helper-types.ts +14 -1
- package/src/use-loader.tsx +67 -6
- package/src/vite/discovery/client-urls-projection.ts +322 -0
- package/src/vite/discovery/discover-routers.ts +43 -17
- package/src/vite/discovery/state.ts +11 -1
- package/src/vite/discovery/virtual-module-codegen.ts +20 -0
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/plugins/expose-action-id.ts +2 -2
- package/src/vite/plugins/expose-internal-ids.ts +46 -0
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/plugins/virtual-entries.ts +12 -3
- package/src/vite/rango.ts +9 -0
- package/src/vite/router-discovery.ts +184 -14
- package/src/vite/utils/shared-utils.ts +12 -7
- package/dist/types.backup/__internal.d.ts +0 -127
- package/dist/types.backup/bin/rango.d.ts +0 -1
- package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
- package/dist/types.backup/browser/action-fence.d.ts +0 -33
- package/dist/types.backup/browser/app-shell.d.ts +0 -34
- package/dist/types.backup/browser/app-version.d.ts +0 -6
- package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
- package/dist/types.backup/browser/cookie-name.d.ts +0 -66
- package/dist/types.backup/browser/event-controller.d.ts +0 -221
- package/dist/types.backup/browser/history-state.d.ts +0 -26
- package/dist/types.backup/browser/index.d.ts +0 -1
- package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
- package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
- package/dist/types.backup/browser/logging.d.ts +0 -33
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
- package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
- package/dist/types.backup/browser/navigation-client.d.ts +0 -17
- package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
- package/dist/types.backup/browser/navigation-store.d.ts +0 -95
- package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
- package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
- package/dist/types.backup/browser/partial-update.d.ts +0 -61
- package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
- package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
- package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
- package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
- package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
- package/dist/types.backup/browser/rango-state.d.ts +0 -52
- package/dist/types.backup/browser/react/Link.d.ts +0 -140
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
- package/dist/types.backup/browser/react/context.d.ts +0 -54
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
- package/dist/types.backup/browser/react/index.d.ts +0 -1
- package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
- package/dist/types.backup/browser/react/location-state.d.ts +0 -29
- package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
- package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
- package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
- package/dist/types.backup/browser/react/use-action.d.ts +0 -61
- package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
- package/dist/types.backup/browser/react/use-href.d.ts +0 -32
- package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
- package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
- package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
- package/dist/types.backup/browser/react/use-params.d.ts +0 -21
- package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
- package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
- package/dist/types.backup/browser/react/use-router.d.ts +0 -23
- package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
- package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
- package/dist/types.backup/browser/response-adapter.d.ts +0 -58
- package/dist/types.backup/browser/rsc-router.d.ts +0 -141
- package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
- package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
- package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
- package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
- package/dist/types.backup/browser/types.d.ts +0 -530
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
- package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
- package/dist/types.backup/build/generate-manifest.d.ts +0 -100
- package/dist/types.backup/build/generate-route-types.d.ts +0 -8
- package/dist/types.backup/build/index.d.ts +0 -21
- package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
- package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
- package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
- package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
- package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
- package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
- package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
- package/dist/types.backup/cache/background-task.d.ts +0 -21
- package/dist/types.backup/cache/cache-error.d.ts +0 -71
- package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
- package/dist/types.backup/cache/cache-policy.d.ts +0 -59
- package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
- package/dist/types.backup/cache/cache-scope.d.ts +0 -134
- package/dist/types.backup/cache/cache-tag.d.ts +0 -79
- package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
- package/dist/types.backup/cache/cf/index.d.ts +0 -3
- package/dist/types.backup/cache/document-cache.d.ts +0 -69
- package/dist/types.backup/cache/handle-capture.d.ts +0 -23
- package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
- package/dist/types.backup/cache/index.d.ts +0 -7
- package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
- package/dist/types.backup/cache/profile-registry.d.ts +0 -40
- package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
- package/dist/types.backup/cache/segment-codec.d.ts +0 -78
- package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
- package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
- package/dist/types.backup/cache/taint.d.ts +0 -71
- package/dist/types.backup/cache/types.d.ts +0 -407
- package/dist/types.backup/cache/vercel/index.d.ts +0 -1
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
- package/dist/types.backup/client.d.ts +0 -184
- package/dist/types.backup/client.rsc.d.ts +0 -39
- package/dist/types.backup/cloudflare/index.d.ts +0 -7
- package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
- package/dist/types.backup/component-utils.d.ts +0 -46
- package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
- package/dist/types.backup/context-var.d.ts +0 -84
- package/dist/types.backup/debug.d.ts +0 -57
- package/dist/types.backup/decode-loader-results.d.ts +0 -5
- package/dist/types.backup/default-error-boundary.d.ts +0 -10
- package/dist/types.backup/defer.d.ts +0 -89
- package/dist/types.backup/deps/browser.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
- package/dist/types.backup/deps/rsc.d.ts +0 -1
- package/dist/types.backup/deps/ssr.d.ts +0 -1
- package/dist/types.backup/encode-kv.d.ts +0 -35
- package/dist/types.backup/errors.d.ts +0 -226
- package/dist/types.backup/escape-script.d.ts +0 -44
- package/dist/types.backup/handle.d.ts +0 -93
- package/dist/types.backup/handles/MetaTags.d.ts +0 -17
- package/dist/types.backup/handles/Scripts.d.ts +0 -38
- package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
- package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
- package/dist/types.backup/handles/is-thenable.d.ts +0 -12
- package/dist/types.backup/handles/meta.d.ts +0 -43
- package/dist/types.backup/handles/script.d.ts +0 -139
- package/dist/types.backup/host/cookie-handler.d.ts +0 -8
- package/dist/types.backup/host/errors.d.ts +0 -40
- package/dist/types.backup/host/index.d.ts +0 -33
- package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
- package/dist/types.backup/host/router.d.ts +0 -12
- package/dist/types.backup/host/testing.d.ts +0 -41
- package/dist/types.backup/host/types.d.ts +0 -148
- package/dist/types.backup/host/utils.d.ts +0 -20
- package/dist/types.backup/href-client.d.ts +0 -214
- package/dist/types.backup/index.d.ts +0 -112
- package/dist/types.backup/index.rsc.d.ts +0 -51
- package/dist/types.backup/internal-debug.d.ts +0 -1
- package/dist/types.backup/loader-store.d.ts +0 -193
- package/dist/types.backup/loader.d.ts +0 -18
- package/dist/types.backup/loader.rsc.d.ts +0 -18
- package/dist/types.backup/missing-id-error.d.ts +0 -1
- package/dist/types.backup/outlet-context.d.ts +0 -12
- package/dist/types.backup/outlet-provider.d.ts +0 -12
- package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
- package/dist/types.backup/prerender/param-hash.d.ts +0 -6
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
- package/dist/types.backup/prerender/store.d.ts +0 -62
- package/dist/types.backup/prerender.d.ts +0 -292
- package/dist/types.backup/redirect-origin.d.ts +0 -55
- package/dist/types.backup/regex-escape.d.ts +0 -6
- package/dist/types.backup/render-error-thrower.d.ts +0 -13
- package/dist/types.backup/response-utils.d.ts +0 -35
- package/dist/types.backup/reverse.d.ts +0 -206
- package/dist/types.backup/root-error-boundary.d.ts +0 -32
- package/dist/types.backup/route-content-wrapper.d.ts +0 -40
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
- package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
- package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
- package/dist/types.backup/route-definition/index.d.ts +0 -7
- package/dist/types.backup/route-definition/redirect.d.ts +0 -48
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
- package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
- package/dist/types.backup/route-definition.d.ts +0 -1
- package/dist/types.backup/route-map-builder.d.ts +0 -127
- package/dist/types.backup/route-name.d.ts +0 -27
- package/dist/types.backup/route-types.d.ts +0 -172
- package/dist/types.backup/router/basename.d.ts +0 -10
- package/dist/types.backup/router/content-negotiation.d.ts +0 -91
- package/dist/types.backup/router/debug-manifest.d.ts +0 -7
- package/dist/types.backup/router/error-handling.d.ts +0 -76
- package/dist/types.backup/router/find-match.d.ts +0 -19
- package/dist/types.backup/router/handler-context.d.ts +0 -41
- package/dist/types.backup/router/instrument.d.ts +0 -161
- package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
- package/dist/types.backup/router/lazy-includes.d.ts +0 -26
- package/dist/types.backup/router/loader-resolution.d.ts +0 -63
- package/dist/types.backup/router/logging.d.ts +0 -41
- package/dist/types.backup/router/manifest.d.ts +0 -8
- package/dist/types.backup/router/match-api.d.ts +0 -19
- package/dist/types.backup/router/match-context.d.ts +0 -184
- package/dist/types.backup/router/match-handlers.d.ts +0 -49
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
- package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
- package/dist/types.backup/router/match-pipelines.d.ts +0 -103
- package/dist/types.backup/router/match-result.d.ts +0 -114
- package/dist/types.backup/router/metrics.d.ts +0 -6
- package/dist/types.backup/router/middleware-types.d.ts +0 -74
- package/dist/types.backup/router/middleware.d.ts +0 -116
- package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
- package/dist/types.backup/router/params-util.d.ts +0 -8
- package/dist/types.backup/router/parse-pattern.d.ts +0 -38
- package/dist/types.backup/router/pattern-matching.d.ts +0 -169
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
- package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
- package/dist/types.backup/router/prerender-match.d.ts +0 -50
- package/dist/types.backup/router/preview-match.d.ts +0 -22
- package/dist/types.backup/router/request-classification.d.ts +0 -104
- package/dist/types.backup/router/revalidation.d.ts +0 -57
- package/dist/types.backup/router/route-snapshot.d.ts +0 -112
- package/dist/types.backup/router/router-context.d.ts +0 -137
- package/dist/types.backup/router/router-interfaces.d.ts +0 -432
- package/dist/types.backup/router/router-options.d.ts +0 -738
- package/dist/types.backup/router/router-registry.d.ts +0 -15
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
- package/dist/types.backup/router/segment-resolution.d.ts +0 -3
- package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
- package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
- package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
- package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
- package/dist/types.backup/router/telemetry.d.ts +0 -215
- package/dist/types.backup/router/timeout.d.ts +0 -68
- package/dist/types.backup/router/tracing.d.ts +0 -125
- package/dist/types.backup/router/trie-matching.d.ts +0 -32
- package/dist/types.backup/router/types.d.ts +0 -98
- package/dist/types.backup/router/url-params.d.ts +0 -26
- package/dist/types.backup/router.d.ts +0 -7
- package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
- package/dist/types.backup/rsc/full-payload.d.ts +0 -22
- package/dist/types.backup/rsc/handler-context.d.ts +0 -31
- package/dist/types.backup/rsc/handler.d.ts +0 -9
- package/dist/types.backup/rsc/helpers.d.ts +0 -213
- package/dist/types.backup/rsc/index.d.ts +0 -17
- package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
- package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
- package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
- package/dist/types.backup/rsc/nonce.d.ts +0 -28
- package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
- package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
- package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
- package/dist/types.backup/rsc/response-error.d.ts +0 -19
- package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
- package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
- package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
- package/dist/types.backup/rsc/server-action.d.ts +0 -68
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
- package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
- package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
- package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
- package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
- package/dist/types.backup/rsc/types.d.ts +0 -290
- package/dist/types.backup/runtime-env.d.ts +0 -1
- package/dist/types.backup/search-params.d.ts +0 -125
- package/dist/types.backup/segment-content-promise.d.ts +0 -13
- package/dist/types.backup/segment-fragments.d.ts +0 -56
- package/dist/types.backup/segment-loader-promise.d.ts +0 -22
- package/dist/types.backup/segment-system.d.ts +0 -84
- package/dist/types.backup/serialize.d.ts +0 -164
- package/dist/types.backup/server/context.d.ts +0 -494
- package/dist/types.backup/server/cookie-parse.d.ts +0 -10
- package/dist/types.backup/server/cookie-store.d.ts +0 -107
- package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
- package/dist/types.backup/server/handle-store.d.ts +0 -100
- package/dist/types.backup/server/loader-registry.d.ts +0 -32
- package/dist/types.backup/server/request-context.d.ts +0 -596
- package/dist/types.backup/server/root-layout.d.ts +0 -3
- package/dist/types.backup/server.d.ts +0 -15
- package/dist/types.backup/ssr/index.d.ts +0 -233
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
- package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
- package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
- package/dist/types.backup/static-handler.d.ts +0 -57
- package/dist/types.backup/testing/cache-status.d.ts +0 -63
- package/dist/types.backup/testing/collect-handle.d.ts +0 -20
- package/dist/types.backup/testing/dispatch.d.ts +0 -123
- package/dist/types.backup/testing/dom.entry.d.ts +0 -15
- package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
- package/dist/types.backup/testing/e2e/index.d.ts +0 -30
- package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
- package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
- package/dist/types.backup/testing/e2e/server.d.ts +0 -35
- package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
- package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
- package/dist/types.backup/testing/flight-tree.d.ts +0 -192
- package/dist/types.backup/testing/flight.d.ts +0 -115
- package/dist/types.backup/testing/flight.entry.d.ts +0 -27
- package/dist/types.backup/testing/generated-routes.d.ts +0 -66
- package/dist/types.backup/testing/index.d.ts +0 -52
- package/dist/types.backup/testing/internal/context.d.ts +0 -225
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
- package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
- package/dist/types.backup/testing/render-handler.d.ts +0 -160
- package/dist/types.backup/testing/render-route.d.ts +0 -246
- package/dist/types.backup/testing/run-loader.d.ts +0 -186
- package/dist/types.backup/testing/run-middleware.d.ts +0 -132
- package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
- package/dist/types.backup/testing/vitest.d.ts +0 -205
- package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
- package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
- package/dist/types.backup/theme/constants.d.ts +0 -39
- package/dist/types.backup/theme/index.d.ts +0 -29
- package/dist/types.backup/theme/theme-context.d.ts +0 -21
- package/dist/types.backup/theme/theme-script.d.ts +0 -26
- package/dist/types.backup/theme/types.d.ts +0 -162
- package/dist/types.backup/theme/use-theme.d.ts +0 -8
- package/dist/types.backup/types/boundaries.d.ts +0 -93
- package/dist/types.backup/types/cache-types.d.ts +0 -191
- package/dist/types.backup/types/error-types.d.ts +0 -114
- package/dist/types.backup/types/global-namespace.d.ts +0 -90
- package/dist/types.backup/types/handler-context.d.ts +0 -658
- package/dist/types.backup/types/index.d.ts +0 -11
- package/dist/types.backup/types/loader-types.d.ts +0 -182
- package/dist/types.backup/types/request-scope.d.ts +0 -93
- package/dist/types.backup/types/route-config.d.ts +0 -105
- package/dist/types.backup/types/route-entry.d.ts +0 -95
- package/dist/types.backup/types/segments.d.ts +0 -234
- package/dist/types.backup/types.d.ts +0 -1
- package/dist/types.backup/urls/include-helper.d.ts +0 -17
- package/dist/types.backup/urls/include-provider.d.ts +0 -27
- package/dist/types.backup/urls/index.d.ts +0 -6
- package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
- package/dist/types.backup/urls/path-helper.d.ts +0 -12
- package/dist/types.backup/urls/pattern-types.d.ts +0 -166
- package/dist/types.backup/urls/response-types.d.ts +0 -67
- package/dist/types.backup/urls/type-extraction.d.ts +0 -157
- package/dist/types.backup/urls/urls-function.d.ts +0 -24
- package/dist/types.backup/urls.d.ts +0 -1
- package/dist/types.backup/use-loader.d.ts +0 -150
- package/dist/types.backup/vercel/index.d.ts +0 -10
- package/dist/types.backup/vercel/tracing.d.ts +0 -70
- package/dist/types.backup/vite/debug.d.ts +0 -80
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
- package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
- package/dist/types.backup/vite/discovery/state.d.ts +0 -162
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
- package/dist/types.backup/vite/index.d.ts +0 -11
- package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
- package/dist/types.backup/vite/plugin-types.d.ts +0 -298
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
- package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
- package/dist/types.backup/vite/rango.d.ts +0 -29
- package/dist/types.backup/vite/router-discovery.d.ts +0 -23
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
- package/dist/types.backup/vite/utils/banner.d.ts +0 -2
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
- package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
- package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
- package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
package/src/rsc/server-action.ts
CHANGED
|
@@ -29,11 +29,22 @@ import {
|
|
|
29
29
|
createSimpleRedirectResponse,
|
|
30
30
|
interceptRedirectForPartial,
|
|
31
31
|
attachLocationStateIfPresent,
|
|
32
|
+
matchAndRecordParams,
|
|
32
33
|
} from "./helpers.js";
|
|
33
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
createRenderStageTraceBridge,
|
|
36
|
+
renderRscResponse,
|
|
37
|
+
} from "./render-pipeline.js";
|
|
38
|
+
import {
|
|
39
|
+
createRoutineTrace,
|
|
40
|
+
runRoutine,
|
|
41
|
+
step,
|
|
42
|
+
type RoutinePlan,
|
|
43
|
+
} from "./routine-plan.js";
|
|
34
44
|
import { warnNonRedirectActionResponse } from "./runtime-warnings.js";
|
|
35
45
|
import type { HandlerContext } from "./handler-context.js";
|
|
36
46
|
import type { MatchResult } from "../types.js";
|
|
47
|
+
import { INTERNAL_RANGO_DEBUG } from "../internal-debug.js";
|
|
37
48
|
|
|
38
49
|
/**
|
|
39
50
|
* Data flowing from action execution to the revalidation phase.
|
|
@@ -350,6 +361,17 @@ export function revalidateAfterAction<TEnv>(
|
|
|
350
361
|
);
|
|
351
362
|
}
|
|
352
363
|
|
|
364
|
+
interface ActionRevalidationInput<TEnv> {
|
|
365
|
+
ctx: HandlerContext<TEnv>;
|
|
366
|
+
request: Request;
|
|
367
|
+
env: TEnv;
|
|
368
|
+
url: URL;
|
|
369
|
+
handleStore: ReturnType<typeof getRequestContext>["_handleStore"];
|
|
370
|
+
continuation: ActionContinuation;
|
|
371
|
+
renderSpan: TraceSpan;
|
|
372
|
+
reqCtx: ReturnType<typeof getRequestContext>;
|
|
373
|
+
}
|
|
374
|
+
|
|
353
375
|
async function revalidateAfterActionInner<TEnv>(
|
|
354
376
|
ctx: HandlerContext<TEnv>,
|
|
355
377
|
request: Request,
|
|
@@ -359,14 +381,8 @@ async function revalidateAfterActionInner<TEnv>(
|
|
|
359
381
|
continuation: ActionContinuation,
|
|
360
382
|
renderSpan: TraceSpan,
|
|
361
383
|
): Promise<Response> {
|
|
362
|
-
const {
|
|
363
|
-
returnValue,
|
|
364
|
-
actionStatus,
|
|
365
|
-
temporaryReferences,
|
|
366
|
-
actionContext,
|
|
367
|
-
errorBoundary,
|
|
368
|
-
} = continuation;
|
|
369
384
|
const reqCtx = getRequestContext();
|
|
385
|
+
const { actionContext } = continuation;
|
|
370
386
|
// Expose the action that triggered this revalidation to the transition({ when })
|
|
371
387
|
// gate (covers both the error-boundary and success gate calls below). Mirrors
|
|
372
388
|
// the action fields a revalidate() predicate sees.
|
|
@@ -381,76 +397,63 @@ async function revalidateAfterActionInner<TEnv>(
|
|
|
381
397
|
// in the background. See registerCachedFunction in cache/cache-runtime.ts.
|
|
382
398
|
reqCtx._inActionRevalidation = true;
|
|
383
399
|
|
|
400
|
+
const trace = INTERNAL_RANGO_DEBUG
|
|
401
|
+
? createRoutineTrace("action-revalidation")
|
|
402
|
+
: undefined;
|
|
403
|
+
const input: ActionRevalidationInput<TEnv> = {
|
|
404
|
+
ctx,
|
|
405
|
+
request,
|
|
406
|
+
env,
|
|
407
|
+
url,
|
|
408
|
+
handleStore,
|
|
409
|
+
continuation,
|
|
410
|
+
renderSpan,
|
|
411
|
+
reqCtx,
|
|
412
|
+
};
|
|
413
|
+
try {
|
|
414
|
+
return await runRoutine(actionRevalidationPlan(input), {
|
|
415
|
+
trace,
|
|
416
|
+
owner: reqCtx,
|
|
417
|
+
});
|
|
418
|
+
} finally {
|
|
419
|
+
if (trace) {
|
|
420
|
+
console.log(
|
|
421
|
+
`[routine] ${request.method} ${url.pathname} (${trace.name})\n${trace.format()}`,
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* The action-revalidation plan: render the deferred error boundary if the
|
|
429
|
+
* action threw and one matched, otherwise match affected segments (falling
|
|
430
|
+
* back to a full match for redirects) and render the partial payload.
|
|
431
|
+
*/
|
|
432
|
+
function* actionRevalidationPlan<TEnv>(
|
|
433
|
+
input: ActionRevalidationInput<TEnv>,
|
|
434
|
+
): RoutinePlan<Response> {
|
|
435
|
+
const { ctx, request, env, url, continuation } = input;
|
|
436
|
+
const { actionContext, errorBoundary } = continuation;
|
|
437
|
+
|
|
384
438
|
// Action threw and a boundary matched: render the (already-matched) error
|
|
385
439
|
// boundary here so it runs inside the route-middleware wrapper, exactly like
|
|
386
|
-
// the success branch below.
|
|
387
|
-
// pre-deferral render that executeServerAction used to do inline.
|
|
440
|
+
// the success branch below.
|
|
388
441
|
if (errorBoundary) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
metadata: {
|
|
393
|
-
pathname: url.pathname,
|
|
394
|
-
// routerId exposed for the frontend (current app identity); see
|
|
395
|
-
// rsc-rendering.ts partial branch.
|
|
396
|
-
routerId: ctx.router.id,
|
|
397
|
-
segments: gateTransitions(
|
|
398
|
-
errorBoundary.segments,
|
|
399
|
-
reqCtx,
|
|
400
|
-
ctx.router.onError,
|
|
401
|
-
),
|
|
402
|
-
isPartial: true,
|
|
403
|
-
matched: errorBoundary.matched,
|
|
404
|
-
diff: errorBoundary.diff,
|
|
405
|
-
resolvedIds: errorBoundary.resolvedIds,
|
|
406
|
-
params: errorBoundary.params,
|
|
407
|
-
isError: true,
|
|
408
|
-
handles: handleStore.stream(),
|
|
409
|
-
version: ctx.version,
|
|
410
|
-
},
|
|
411
|
-
returnValue,
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
// Intentionally omit attachLocationState for error payloads: location state
|
|
415
|
-
// is a success-only semantic. Error boundary responses update the error UI
|
|
416
|
-
// but should not mutate browser history state.
|
|
417
|
-
|
|
418
|
-
return renderRscResponse({
|
|
419
|
-
ctx,
|
|
420
|
-
request,
|
|
421
|
-
env,
|
|
422
|
-
url,
|
|
423
|
-
payload: errorPayload,
|
|
424
|
-
temporaryReferences,
|
|
425
|
-
init: {
|
|
426
|
-
status: actionStatus,
|
|
427
|
-
headers: {
|
|
428
|
-
"content-type": "text/x-component;charset=utf-8",
|
|
429
|
-
// Router identity for the client's pre-decode integrity check (the
|
|
430
|
-
// action apply path has no post-decode guard). See response-adapter.
|
|
431
|
-
"X-RSC-Router-Id": ctx.router.id,
|
|
432
|
-
},
|
|
433
|
-
},
|
|
434
|
-
tracking: {
|
|
435
|
-
mode: "action-revalidation",
|
|
436
|
-
routeKey: reqCtx._routeName,
|
|
437
|
-
actionId: actionContext?.actionId,
|
|
438
|
-
span: renderSpan,
|
|
439
|
-
},
|
|
440
|
-
});
|
|
442
|
+
return yield* step("render", () =>
|
|
443
|
+
renderActionBoundaryResponse(input, errorBoundary),
|
|
444
|
+
);
|
|
441
445
|
}
|
|
442
446
|
|
|
443
|
-
const matchResult =
|
|
444
|
-
request,
|
|
445
|
-
{ env },
|
|
446
|
-
actionContext,
|
|
447
|
+
const matchResult = yield* step("match:partial", () =>
|
|
448
|
+
matchPartialAndRecord(ctx, request, env, actionContext),
|
|
447
449
|
);
|
|
448
450
|
|
|
449
451
|
if (!matchResult) {
|
|
450
452
|
// matchPartial returns null when the route is a redirect or no previous-URL
|
|
451
453
|
// context could be resolved. Check for redirect first.
|
|
452
|
-
const fullMatch =
|
|
453
|
-
|
|
454
|
+
const fullMatch = yield* step("match:fallback", () =>
|
|
455
|
+
matchAndRecordParams(ctx, request, env),
|
|
456
|
+
);
|
|
454
457
|
|
|
455
458
|
if (fullMatch.redirect) {
|
|
456
459
|
// Action context is always partial — use X-RSC-Redirect header so
|
|
@@ -476,8 +479,111 @@ async function revalidateAfterActionInner<TEnv>(
|
|
|
476
479
|
);
|
|
477
480
|
}
|
|
478
481
|
|
|
479
|
-
|
|
480
|
-
|
|
482
|
+
return yield* step("render", () =>
|
|
483
|
+
renderRevalidationResponse(input, matchResult),
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** matchPartial that stamps params/routeName when a result exists. */
|
|
488
|
+
async function matchPartialAndRecord<TEnv>(
|
|
489
|
+
ctx: HandlerContext<TEnv>,
|
|
490
|
+
request: Request,
|
|
491
|
+
env: TEnv,
|
|
492
|
+
actionContext: ActionContinuation["actionContext"],
|
|
493
|
+
): Promise<
|
|
494
|
+
Awaited<ReturnType<HandlerContext<TEnv>["router"]["matchPartial"]>>
|
|
495
|
+
> {
|
|
496
|
+
const matchResult = await ctx.router.matchPartial(
|
|
497
|
+
request,
|
|
498
|
+
{ env },
|
|
499
|
+
actionContext,
|
|
500
|
+
);
|
|
501
|
+
if (matchResult) {
|
|
502
|
+
setRequestContextParams(matchResult.params, matchResult.routeName);
|
|
503
|
+
}
|
|
504
|
+
return matchResult;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Render the deferred action error boundary. setRequestContextParams + the
|
|
509
|
+
* payload mirror the pre-deferral render that executeServerAction used to do
|
|
510
|
+
* inline.
|
|
511
|
+
*/
|
|
512
|
+
function renderActionBoundaryResponse<TEnv>(
|
|
513
|
+
input: ActionRevalidationInput<TEnv>,
|
|
514
|
+
errorBoundary: MatchResult,
|
|
515
|
+
): Promise<Response> {
|
|
516
|
+
const { ctx, request, env, url, handleStore, continuation, reqCtx } = input;
|
|
517
|
+
const { returnValue, actionStatus, temporaryReferences, actionContext } =
|
|
518
|
+
continuation;
|
|
519
|
+
|
|
520
|
+
setRequestContextParams(errorBoundary.params, errorBoundary.routeName);
|
|
521
|
+
|
|
522
|
+
const errorPayload: RscPayload = {
|
|
523
|
+
metadata: {
|
|
524
|
+
pathname: url.pathname,
|
|
525
|
+
// routerId exposed for the frontend (current app identity); see
|
|
526
|
+
// rsc-rendering.ts partial branch.
|
|
527
|
+
routerId: ctx.router.id,
|
|
528
|
+
segments: gateTransitions(
|
|
529
|
+
errorBoundary.segments,
|
|
530
|
+
reqCtx,
|
|
531
|
+
ctx.router.onError,
|
|
532
|
+
),
|
|
533
|
+
isPartial: true,
|
|
534
|
+
matched: errorBoundary.matched,
|
|
535
|
+
diff: errorBoundary.diff,
|
|
536
|
+
resolvedIds: errorBoundary.resolvedIds,
|
|
537
|
+
params: errorBoundary.params,
|
|
538
|
+
isError: true,
|
|
539
|
+
handles: handleStore.stream(),
|
|
540
|
+
version: ctx.version,
|
|
541
|
+
},
|
|
542
|
+
returnValue,
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
// Intentionally omit attachLocationState for error payloads: location state
|
|
546
|
+
// is a success-only semantic. Error boundary responses update the error UI
|
|
547
|
+
// but should not mutate browser history state.
|
|
548
|
+
|
|
549
|
+
return renderRscResponse({
|
|
550
|
+
ctx,
|
|
551
|
+
request,
|
|
552
|
+
env,
|
|
553
|
+
url,
|
|
554
|
+
payload: errorPayload,
|
|
555
|
+
temporaryReferences,
|
|
556
|
+
init: {
|
|
557
|
+
status: actionStatus,
|
|
558
|
+
headers: {
|
|
559
|
+
"content-type": "text/x-component;charset=utf-8",
|
|
560
|
+
// Router identity for the client's pre-decode integrity check (the
|
|
561
|
+
// action apply path has no post-decode guard). See response-adapter.
|
|
562
|
+
"X-RSC-Router-Id": ctx.router.id,
|
|
563
|
+
},
|
|
564
|
+
},
|
|
565
|
+
tracking: {
|
|
566
|
+
mode: "action-revalidation",
|
|
567
|
+
routeKey: input.reqCtx._routeName,
|
|
568
|
+
actionId: actionContext?.actionId,
|
|
569
|
+
span: input.renderSpan,
|
|
570
|
+
onEvent:
|
|
571
|
+
reqCtx._activeRoutine &&
|
|
572
|
+
createRenderStageTraceBridge(reqCtx._activeRoutine),
|
|
573
|
+
},
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/** Render the updated segments after a successful action. */
|
|
578
|
+
function renderRevalidationResponse<TEnv>(
|
|
579
|
+
input: ActionRevalidationInput<TEnv>,
|
|
580
|
+
matchResult: NonNullable<
|
|
581
|
+
Awaited<ReturnType<HandlerContext<TEnv>["router"]["matchPartial"]>>
|
|
582
|
+
>,
|
|
583
|
+
): Promise<Response> {
|
|
584
|
+
const { ctx, request, env, url, handleStore, continuation, reqCtx } = input;
|
|
585
|
+
const { returnValue, actionStatus, temporaryReferences, actionContext } =
|
|
586
|
+
continuation;
|
|
481
587
|
|
|
482
588
|
const payload: RscPayload = {
|
|
483
589
|
metadata: {
|
|
@@ -524,7 +630,10 @@ async function revalidateAfterActionInner<TEnv>(
|
|
|
524
630
|
mode: "action-revalidation",
|
|
525
631
|
routeKey: reqCtx._routeName,
|
|
526
632
|
actionId: actionContext?.actionId,
|
|
527
|
-
span: renderSpan,
|
|
633
|
+
span: input.renderSpan,
|
|
634
|
+
onEvent:
|
|
635
|
+
reqCtx._activeRoutine &&
|
|
636
|
+
createRenderStageTraceBridge(reqCtx._activeRoutine),
|
|
528
637
|
},
|
|
529
638
|
});
|
|
530
639
|
}
|
|
@@ -25,3 +25,21 @@
|
|
|
25
25
|
* docs/design/ppr-shell-resume.md (Cost model).
|
|
26
26
|
*/
|
|
27
27
|
export const SHELL_CAPTURE_MAX_WAIT_MS = 15_000;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Hard cap on one capture TASK — runShellCapture end to end (both attempts +
|
|
31
|
+
* the in-place retry delay). SHELL_CAPTURE_MAX_WAIT_MS arms only inside
|
|
32
|
+
* captureShellHTML, AFTER the capture's router.match(); a handler wedged on a
|
|
33
|
+
* never-settling upstream await (autobarn pilot: a 30s+ tarpitting fetch)
|
|
34
|
+
* wedges the task with no deadline in force. The task's settle path releases
|
|
35
|
+
* the per-key stampede guard and the serialized capture-queue slot, so an
|
|
36
|
+
* unbounded task strands BOTH for the isolate's lifetime.
|
|
37
|
+
*
|
|
38
|
+
* 25s: above one full-budget attempt plus overhead (cutting a second attempt
|
|
39
|
+
* short is an acceptable loss — every terminal path backs the key off anyway),
|
|
40
|
+
* and below workerd's ~30s waitUntil grace so the cap timer still fires in a
|
|
41
|
+
* live context. When workerd kills the context BEFORE the cap fires, the timer
|
|
42
|
+
* dies with it — that stranding is healed by scheduleShellCapture's staleness
|
|
43
|
+
* check on the stampede guard, keyed off the same constant.
|
|
44
|
+
*/
|
|
45
|
+
export const SHELL_CAPTURE_TASK_HARD_CAP_MS = 25_000;
|
package/src/rsc/shell-capture.ts
CHANGED
|
@@ -26,7 +26,10 @@ import {
|
|
|
26
26
|
captureQueueDepths,
|
|
27
27
|
enqueueSerializedCapture,
|
|
28
28
|
} from "./capture-queue.js";
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
SHELL_CAPTURE_MAX_WAIT_MS,
|
|
31
|
+
SHELL_CAPTURE_TASK_HARD_CAP_MS,
|
|
32
|
+
} from "./shell-capture-constants.js";
|
|
30
33
|
import { INTERNAL_RANGO_DEBUG } from "../internal-debug.js";
|
|
31
34
|
import { observePhase, PHASES } from "../router/instrument.js";
|
|
32
35
|
import type { TraceSpan } from "../router/tracing.js";
|
|
@@ -185,15 +188,64 @@ function delay(ms: number): Promise<void> {
|
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
/**
|
|
188
|
-
*
|
|
191
|
+
* Bound one capture task at {@link SHELL_CAPTURE_TASK_HARD_CAP_MS}. Rejects on
|
|
192
|
+
* expiry so the caller's existing catch applies backoff + reporting and its
|
|
193
|
+
* settle path releases the stampede guard and queue slot; resolves/rejects
|
|
194
|
+
* transparently otherwise. The timer is unref'd so a pending cap never holds a
|
|
195
|
+
* Node dev process open.
|
|
196
|
+
*/
|
|
197
|
+
function raceTaskHardCap<T>(task: Promise<T>, key: string): Promise<T> {
|
|
198
|
+
return new Promise<T>((resolve, reject) => {
|
|
199
|
+
const timer = setTimeout(() => {
|
|
200
|
+
reject(
|
|
201
|
+
new Error(
|
|
202
|
+
`capture task for ${key} exceeded the ${SHELL_CAPTURE_TASK_HARD_CAP_MS}ms hard cap; ` +
|
|
203
|
+
`a handler is likely wedged on a never-settling await`,
|
|
204
|
+
),
|
|
205
|
+
);
|
|
206
|
+
}, SHELL_CAPTURE_TASK_HARD_CAP_MS);
|
|
207
|
+
(timer as { unref?: () => void }).unref?.();
|
|
208
|
+
task.then(
|
|
209
|
+
(value) => {
|
|
210
|
+
clearTimeout(timer);
|
|
211
|
+
resolve(value);
|
|
212
|
+
},
|
|
213
|
+
(error: unknown) => {
|
|
214
|
+
clearTimeout(timer);
|
|
215
|
+
reject(error);
|
|
216
|
+
},
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Module-level in-flight key map: the stampede guard for background captures, and
|
|
189
223
|
* its single owner. One capture runs per key per isolate; concurrent MISS/stale
|
|
190
224
|
* requests for the same key coalesce onto the first (the rest see the key present
|
|
191
225
|
* in scheduleShellCapture and skip). Added when a capture is scheduled and cleared
|
|
192
|
-
* in the task's
|
|
193
|
-
* rolls. Living here (not split across the middleware) keeps
|
|
194
|
-
* lifecycle in one layer.
|
|
226
|
+
* in the task's settle paths via a token-guarded release, so a later request can
|
|
227
|
+
* recapture when TTL rolls. Living here (not split across the middleware) keeps
|
|
228
|
+
* the add/clear lifecycle in one layer.
|
|
229
|
+
*
|
|
230
|
+
* The value is the owning task's token ({@link CaptureGuardToken}) rather than
|
|
231
|
+
* a bare set entry: workerd can kill a capture's waitUntil context before its
|
|
232
|
+
* finally runs (or the task can wedge past every deadline), stranding the key.
|
|
233
|
+
* scheduleShellCapture treats an entry older than
|
|
234
|
+
* SHELL_CAPTURE_TASK_HARD_CAP_MS as abandoned and reclaims it; the token guard
|
|
235
|
+
* keeps a late-settling stale task from releasing its replacement's entry.
|
|
195
236
|
*/
|
|
196
|
-
|
|
237
|
+
interface CaptureGuardToken {
|
|
238
|
+
startedAt: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const inFlightCaptures = new Map<string, CaptureGuardToken>();
|
|
242
|
+
|
|
243
|
+
/** Token-guarded release: only the entry's owning task may clear it. */
|
|
244
|
+
function releaseCaptureGuard(key: string, token: CaptureGuardToken): void {
|
|
245
|
+
if (inFlightCaptures.get(key) === token) {
|
|
246
|
+
inFlightCaptures.delete(key);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
197
249
|
|
|
198
250
|
/**
|
|
199
251
|
* Refused-capture backoff bounds. The window is EXPONENTIAL in the consecutive
|
|
@@ -855,6 +907,15 @@ export function gateFlightForCapture(
|
|
|
855
907
|
*/
|
|
856
908
|
export interface ShellCaptureDescriptor {
|
|
857
909
|
key: string;
|
|
910
|
+
/**
|
|
911
|
+
* The key's search portion (shellSearchSeed: `?`-prefixed sorted search,
|
|
912
|
+
* cache.searchParams filter applied, or ""). Seeds the capture render's SSR
|
|
913
|
+
* store so static-part `useSearchParams` reads bake markup consistent with
|
|
914
|
+
* the shell's own key; the resume pass derives the identical string from
|
|
915
|
+
* the HIT request. Computed next to the key so the two cannot drift.
|
|
916
|
+
* Omitted (build-time bare-pathname captures) = search-less, same as "".
|
|
917
|
+
*/
|
|
918
|
+
searchSeed?: string;
|
|
858
919
|
/**
|
|
859
920
|
* The RSC handler's build version (HandlerContext.version), stamped into the
|
|
860
921
|
* stored entry as ShellCacheEntry.buildVersion — the serve-side
|
|
@@ -918,9 +979,17 @@ export function scheduleShellCapture(
|
|
|
918
979
|
descriptor: ShellCaptureDescriptor,
|
|
919
980
|
): void {
|
|
920
981
|
const key = descriptor.key;
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
982
|
+
const inFlight = inFlightCaptures.get(key);
|
|
983
|
+
if (inFlight) {
|
|
984
|
+
if (Date.now() - inFlight.startedAt <= SHELL_CAPTURE_TASK_HARD_CAP_MS) {
|
|
985
|
+
publishCaptureDebugEvent(descriptor, { key, outcome: "skip-in-flight" });
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
// Older than the task hard cap: the owning task never settled (wedged
|
|
989
|
+
// render, or workerd killed its context before the release ran). Treat the
|
|
990
|
+
// key as abandoned and schedule a replacement — the set() below installs a
|
|
991
|
+
// new token, and the stale task's token-guarded release can no longer
|
|
992
|
+
// touch it.
|
|
924
993
|
}
|
|
925
994
|
// Refused/failed within the window → skip the doomed re-render (one probe per
|
|
926
995
|
// key per window per isolate). Expired entries self-evict inside the check.
|
|
@@ -942,7 +1011,8 @@ export function scheduleShellCapture(
|
|
|
942
1011
|
publishCaptureDebugEvent(descriptor, { key, outcome: "skip-inert-store" });
|
|
943
1012
|
return;
|
|
944
1013
|
}
|
|
945
|
-
|
|
1014
|
+
const guardToken: CaptureGuardToken = { startedAt: Date.now() };
|
|
1015
|
+
inFlightCaptures.set(key, guardToken);
|
|
946
1016
|
const captureTask = async (span: TraceSpan) => {
|
|
947
1017
|
try {
|
|
948
1018
|
const setupUrl = descriptor.navigationOnly
|
|
@@ -962,14 +1032,24 @@ export function scheduleShellCapture(
|
|
|
962
1032
|
) {
|
|
963
1033
|
return;
|
|
964
1034
|
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1035
|
+
// Hard-capped: SHELL_CAPTURE_MAX_WAIT_MS arms only inside
|
|
1036
|
+
// captureShellHTML, AFTER the capture's router.match() — a handler
|
|
1037
|
+
// wedged on a never-settling upstream await has no deadline in force
|
|
1038
|
+
// and would strand the stampede guard and the queue slot (autobarn
|
|
1039
|
+
// pilot). The cap rejects, riding the existing catch: backoff +
|
|
1040
|
+
// reportCacheError + token-guarded release. The abandoned attempt keeps
|
|
1041
|
+
// running until its context dies; nothing awaits it.
|
|
1042
|
+
const outcome = await raceTaskHardCap(
|
|
1043
|
+
runShellCapture(
|
|
1044
|
+
ctx,
|
|
1045
|
+
request,
|
|
1046
|
+
env,
|
|
1047
|
+
url,
|
|
1048
|
+
reqCtx,
|
|
1049
|
+
resolvedSsrModule,
|
|
1050
|
+
descriptor,
|
|
1051
|
+
),
|
|
1052
|
+
key,
|
|
973
1053
|
);
|
|
974
1054
|
span.setAttribute("rango.background.outcome", outcome);
|
|
975
1055
|
// Update the negative cache off the terminal outcome. A stored shell clears
|
|
@@ -998,7 +1078,7 @@ export function scheduleShellCapture(
|
|
|
998
1078
|
});
|
|
999
1079
|
reportCacheError(error, "cache-write", "[ShellCache] capture", reqCtx);
|
|
1000
1080
|
} finally {
|
|
1001
|
-
|
|
1081
|
+
releaseCaptureGuard(key, guardToken);
|
|
1002
1082
|
}
|
|
1003
1083
|
};
|
|
1004
1084
|
// Serialize capture EXECUTION per isolate (capture-queue.ts): concurrent
|
|
@@ -1049,7 +1129,7 @@ export function scheduleShellCapture(
|
|
|
1049
1129
|
);
|
|
1050
1130
|
} catch (error) {
|
|
1051
1131
|
if (error instanceof CaptureQueueFullError) {
|
|
1052
|
-
|
|
1132
|
+
releaseCaptureGuard(key, guardToken);
|
|
1053
1133
|
span.setAttribute("rango.background.outcome", "skip-capacity");
|
|
1054
1134
|
publishCaptureDebugEvent(descriptor, {
|
|
1055
1135
|
key,
|
|
@@ -1061,7 +1141,7 @@ export function scheduleShellCapture(
|
|
|
1061
1141
|
// Dropped unrun after waiting past the queue budget: no backoff (the
|
|
1062
1142
|
// route is not doomed, the isolate was busy) — a later request
|
|
1063
1143
|
// re-probes the key.
|
|
1064
|
-
|
|
1144
|
+
releaseCaptureGuard(key, guardToken);
|
|
1065
1145
|
span.setAttribute("rango.background.outcome", "skip-queue-timeout");
|
|
1066
1146
|
span.setAttribute(
|
|
1067
1147
|
"rango.background.queue_wait_ms",
|
|
@@ -1682,6 +1762,9 @@ async function captureAndStoreShell(
|
|
|
1682
1762
|
captureShellHTML(gate.stream, {
|
|
1683
1763
|
quiesce,
|
|
1684
1764
|
maxWaitMs: capture.captureTimeout ?? SHELL_CAPTURE_MAX_WAIT_MS,
|
|
1765
|
+
// The shell key's own search seeds the capture render's store —
|
|
1766
|
+
// static-part search reads bake what the key names.
|
|
1767
|
+
search: capture.searchSeed,
|
|
1685
1768
|
}),
|
|
1686
1769
|
);
|
|
1687
1770
|
} catch (error) {
|
package/src/rsc/shell-serve.ts
CHANGED
|
@@ -129,9 +129,22 @@ export function resolvePprConfig(
|
|
|
129
129
|
* and lookup makes every shell request a permanent miss.
|
|
130
130
|
*/
|
|
131
131
|
export function buildShellKey(url: URL, filter?: SearchParamsFilter): string {
|
|
132
|
+
return `${url.host}${url.pathname}${shellSearchSeed(url, filter)}:shell`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The shell key's search portion (`?`-prefixed sorted search with the
|
|
137
|
+
* cache.searchParams filter applied, or "") — ALSO the string the capture and
|
|
138
|
+
* resume SSR renders seed their store location with (SSRRenderOptions.search
|
|
139
|
+
* / ShellCaptureOptions.search / ShellResumeOptions.search). Search is part
|
|
140
|
+
* of shell identity, so static-part `useSearchParams` reads render exactly
|
|
141
|
+
* what the key names; deriving seed and key from this one helper is what
|
|
142
|
+
* keeps capture, resume, and lookup byte-agreed (drift = replay mismatch or
|
|
143
|
+
* permanent MISS).
|
|
144
|
+
*/
|
|
145
|
+
export function shellSearchSeed(url: URL, filter?: SearchParamsFilter): string {
|
|
132
146
|
const sorted = sortedSearchString(url.searchParams, filter);
|
|
133
|
-
|
|
134
|
-
return `${url.host}${url.pathname}${searchSuffix}:shell`;
|
|
147
|
+
return sorted ? `?${sorted}` : "";
|
|
135
148
|
}
|
|
136
149
|
|
|
137
150
|
/**
|
package/src/rsc/ssr-setup.ts
CHANGED
|
@@ -111,7 +111,16 @@ export function createSsrHtmlStage<TEnv>(
|
|
|
111
111
|
);
|
|
112
112
|
return {
|
|
113
113
|
render: () =>
|
|
114
|
-
|
|
114
|
+
// search: the LIVE request's query string, threaded out-of-band into
|
|
115
|
+
// the SSR pass so useSearchParams sees real values during document
|
|
116
|
+
// renders. Deliberately not payload metadata: cached/prerendered
|
|
117
|
+
// payloads replay captured metadata, and search is not route
|
|
118
|
+
// identity — it must always come from the request being served.
|
|
119
|
+
ssrModule.renderHTML(flight.stream, {
|
|
120
|
+
...options.render,
|
|
121
|
+
streamMode,
|
|
122
|
+
search: options.url.search,
|
|
123
|
+
}),
|
|
115
124
|
...(options.init && { init: options.init }),
|
|
116
125
|
};
|
|
117
126
|
};
|
package/src/rsc/types.ts
CHANGED
|
@@ -35,10 +35,27 @@ export interface RscPayload {
|
|
|
35
35
|
/** Merged route params from the matched route */
|
|
36
36
|
params?: Record<string, string>;
|
|
37
37
|
slots?: Record<string, SlotState>;
|
|
38
|
+
/**
|
|
39
|
+
* Intercept TARGET route names reachable from this location as a
|
|
40
|
+
* navigation origin (see MatchResult.interceptTargets). The browser-local
|
|
41
|
+
* clientUrls matcher declines optimistic presentation for these.
|
|
42
|
+
*/
|
|
43
|
+
interceptTargets?: string[];
|
|
38
44
|
/** Root layout component for browser-side re-renders (client component reference) */
|
|
39
45
|
rootLayout?: React.ComponentType<{ children: React.ReactNode }>;
|
|
40
46
|
/** Handle data accumulated across route segments (async generator that yields on each push) */
|
|
41
47
|
handles?: AsyncGenerator<HandleData, void, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Document-lane late handle channel: full-state updates for pushes landing
|
|
50
|
+
* AFTER the handler barrier (streaming loader bodies writing handles
|
|
51
|
+
* mid-body). `handles` above is drained to completion in blocking
|
|
52
|
+
* positions (SSR seed, pre-hydration), so late pushes need this separate
|
|
53
|
+
* generator, consumed non-blocking post-hydration (rsc-router.tsx).
|
|
54
|
+
* Empty/instantly-complete when no auxiliary-lane work is pending at the
|
|
55
|
+
* handler barrier. Full payloads only — partial payloads' `handles`
|
|
56
|
+
* generator streams to full settle already.
|
|
57
|
+
*/
|
|
58
|
+
handlesLate?: AsyncGenerator<HandleData, void, unknown>;
|
|
42
59
|
/** RSC version string for cache invalidation */
|
|
43
60
|
version?: string;
|
|
44
61
|
/** Cloudflare dev worker generation used for stale-document convergence. */
|
|
@@ -158,6 +175,18 @@ export interface SSRRenderOptions {
|
|
|
158
175
|
* - `"allReady"` — await `stream.allReady` before returning.
|
|
159
176
|
*/
|
|
160
177
|
streamMode?: import("../router/router-options.js").SSRStreamMode;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The live request's query string (`url.search`, `?`-prefixed or empty).
|
|
181
|
+
* Seeds the SSR navigation store so `useSearchParams` (and
|
|
182
|
+
* `useNavigation().location`) carry real values during document renders.
|
|
183
|
+
* Out-of-band by design — never payload metadata, which cached/prerendered
|
|
184
|
+
* payloads replay; search is not route identity. The build-time prerender
|
|
185
|
+
* pass passes none — build shells capture bare pathnames and serve
|
|
186
|
+
* search-less requests only (runtime ppr captures seed the shell key's
|
|
187
|
+
* search; see ShellCaptureOptions.search in the SSR entry).
|
|
188
|
+
*/
|
|
189
|
+
search?: string;
|
|
161
190
|
}
|
|
162
191
|
|
|
163
192
|
/**
|
|
@@ -179,7 +208,7 @@ export interface SSRModule {
|
|
|
179
208
|
*/
|
|
180
209
|
captureShellHTML?: (
|
|
181
210
|
rscStream: ReadableStream<Uint8Array>,
|
|
182
|
-
options: { quiesce: Promise<void>; maxWaitMs?: number },
|
|
211
|
+
options: { quiesce: Promise<void>; maxWaitMs?: number; search?: string },
|
|
183
212
|
) => Promise<{ prelude: Uint8Array; postponed: string | null } | null>;
|
|
184
213
|
|
|
185
214
|
/**
|
|
@@ -192,7 +221,7 @@ export interface SSRModule {
|
|
|
192
221
|
*/
|
|
193
222
|
resumeShellHTML?: (
|
|
194
223
|
rscStream: ReadableStream<Uint8Array>,
|
|
195
|
-
options: { postponed: string | null; nonce?: string },
|
|
224
|
+
options: { postponed: string | null; nonce?: string; search?: string },
|
|
196
225
|
) => Promise<ReadableStream<Uint8Array>>;
|
|
197
226
|
}
|
|
198
227
|
|