@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
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client seat of `invalidateClientCache()` (the `default` export condition).
|
|
3
|
-
*
|
|
4
|
-
* Makes the current client behave as if a server action had just completed:
|
|
5
|
-
* the history cache is marked stale (SWR), the prefetch map is flushed, the
|
|
6
|
-
* state rotates, and sibling tabs are broadcast to — the same
|
|
7
|
-
* `markCacheAsStaleAndBroadcast()` path the server-action bridge uses. This is
|
|
8
|
-
* the gentler mark-stale (not hard-clear) behavior, so Back renders the cached
|
|
9
|
-
* entry instantly and revalidates.
|
|
10
|
-
*/
|
|
11
|
-
export declare function invalidateClientCache(): void;
|
|
12
|
-
/**
|
|
13
|
-
* Client no-op for `keepClientCache()`. It is a server action directive (the
|
|
14
|
-
* `react-server` condition sets a response header the action bridge reads);
|
|
15
|
-
* there is nothing to suppress from the client side.
|
|
16
|
-
*/
|
|
17
|
-
export declare function keepClientCache(): void;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { LinkInterceptorOptions, NavigateOptions } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Check if an anchor points to the same page with only a hash change.
|
|
4
|
-
* Used by both Link component and link-interceptor to let the browser
|
|
5
|
-
* handle anchor scrolling natively.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isHashOnlyNavigation(anchor: HTMLAnchorElement): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Default link interception predicate
|
|
10
|
-
*
|
|
11
|
-
* Returns true if the link should be intercepted for SPA navigation.
|
|
12
|
-
* Filters out:
|
|
13
|
-
* - Cross-origin links
|
|
14
|
-
* - Links with download attribute
|
|
15
|
-
* - Links with target other than _self
|
|
16
|
-
* - Links with data-no-intercept attribute
|
|
17
|
-
*
|
|
18
|
-
* @param link - The anchor element to check
|
|
19
|
-
* @returns true if the link should be intercepted
|
|
20
|
-
*/
|
|
21
|
-
export declare function defaultShouldIntercept(link: HTMLAnchorElement): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Set up link interception for SPA navigation
|
|
24
|
-
*
|
|
25
|
-
* Attaches a global click handler to intercept clicks on anchor elements
|
|
26
|
-
* and call the onNavigate callback instead of performing a full page load.
|
|
27
|
-
*
|
|
28
|
-
* @param onNavigate - Callback when a link should navigate via SPA
|
|
29
|
-
* @param options - Configuration options
|
|
30
|
-
* @returns Cleanup function to remove the event listener
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const cleanup = setupLinkInterception((url) => {
|
|
35
|
-
* window.history.pushState({}, "", url);
|
|
36
|
-
* fetchPartialUpdate(url);
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
|
-
* // Later, to clean up:
|
|
40
|
-
* cleanup();
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export declare function setupLinkInterception(onNavigate: (url: string, options?: NavigateOptions) => void, options?: LinkInterceptorOptions): () => void;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module-level debug flag for guarding call sites whose debug arguments do
|
|
3
|
-
* non-trivial work (joins, maps, spreads, object literals). Because the Vite
|
|
4
|
-
* transform folds INTERNAL_RANGO_DEBUG to a literal, an `if (IS_BROWSER_DEBUG)`
|
|
5
|
-
* guard is minifier-DCE-able — the whole block drops from the production bundle.
|
|
6
|
-
* Prefer this over isBrowserDebugEnabled() at hot call sites: a const guard folds
|
|
7
|
-
* where a function call may not.
|
|
8
|
-
*/
|
|
9
|
-
export declare const IS_BROWSER_DEBUG: boolean;
|
|
10
|
-
interface BrowserLogContext {
|
|
11
|
-
requestId: string;
|
|
12
|
-
txId: string;
|
|
13
|
-
operation: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function isBrowserDebugEnabled(): boolean;
|
|
16
|
-
export declare function startBrowserTransaction(operation: string): BrowserLogContext;
|
|
17
|
-
export declare function browserDebugLog(ctx: BrowserLogContext, message: string, details?: Record<string, unknown>): void;
|
|
18
|
-
/**
|
|
19
|
-
* Simple gated console.log for browser-side debug output.
|
|
20
|
-
* Unlike browserDebugLog, this doesn't require a transaction context -
|
|
21
|
-
* use it for standalone debug messages in partial-update, navigation-bridge, etc.
|
|
22
|
-
*/
|
|
23
|
-
export declare function debugLog(msg: string, ...args: unknown[]): void;
|
|
24
|
-
/**
|
|
25
|
-
* Boot-sequence debug log: one line per initial-document step (flight decode,
|
|
26
|
-
* handle stream, bridge wiring, initial tree build, hydration commit), each
|
|
27
|
-
* stamped with performance.now() so the gap BEFORE hydrateRoot is visible.
|
|
28
|
-
* The initial document path was otherwise silent — FE debug only started
|
|
29
|
-
* talking at the first soft navigation, so a boot stall (e.g. an await that
|
|
30
|
-
* holds initBrowserApp, and with it hydrateRoot) was invisible.
|
|
31
|
-
*/
|
|
32
|
-
export declare function bootLog(step: string, details?: Record<string, unknown>): void;
|
|
33
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ResolvedSegment } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Merge partial loader data from server with cached loader data.
|
|
4
|
-
*
|
|
5
|
-
* During partial revalidation (stale or action), the server may return only
|
|
6
|
-
* some loaders that pass the revalidation check. The component still needs
|
|
7
|
-
* all loader data, so we merge fresh data with cached data.
|
|
8
|
-
*
|
|
9
|
-
* @param fromServer - Segment returned from server with partial loaders
|
|
10
|
-
* @param fromCache - Cached segment with full loader data
|
|
11
|
-
* @returns Merged segment with complete loader data
|
|
12
|
-
*/
|
|
13
|
-
export declare function mergeSegmentLoaders(fromServer: ResolvedSegment, fromCache: ResolvedSegment): ResolvedSegment;
|
|
14
|
-
/**
|
|
15
|
-
* Check if segments need loader merging during partial revalidation.
|
|
16
|
-
*
|
|
17
|
-
* Returns true when:
|
|
18
|
-
* - Server returned fewer loaders than cached (partial revalidation)
|
|
19
|
-
* - Both segments have loader data promises
|
|
20
|
-
*/
|
|
21
|
-
export declare function needsLoaderMerge(fromServer: ResolvedSegment, fromCache: ResolvedSegment | undefined): fromCache is ResolvedSegment;
|
|
22
|
-
/**
|
|
23
|
-
* Insert diff segments that aren't in the matched array into allSegments.
|
|
24
|
-
*
|
|
25
|
-
* During consolidation fetch for concurrent actions, loader segments may be
|
|
26
|
-
* excluded from the request. The server returns them in the diff but not in
|
|
27
|
-
* the matched array. This function inserts them at the correct position
|
|
28
|
-
* (after their parent layout segment).
|
|
29
|
-
*
|
|
30
|
-
* Loader segment IDs follow the pattern: {parentLayoutId}D{index}.{loaderId}
|
|
31
|
-
* Example: M9L0L1D0.actionCounter has parent layout M9L0L1
|
|
32
|
-
*
|
|
33
|
-
* @param allSegments - Mutable array of segments to insert into
|
|
34
|
-
* @param diff - Array of segment IDs that changed (from server response)
|
|
35
|
-
* @param matchedIdSet - Set of segment IDs from matched array
|
|
36
|
-
* @param newSegmentMap - Map of segment ID to segment data from server
|
|
37
|
-
*/
|
|
38
|
-
export declare function insertMissingDiffSegments(allSegments: ResolvedSegment[], diff: string[] | undefined, matchedIdSet: Set<string>, newSegmentMap: Map<string, ResolvedSegment>): void;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { NavigationBridge, NavigationBridgeConfig } from "./types.js";
|
|
2
|
-
import { createNavigationTransaction } from "./navigation-transaction.js";
|
|
3
|
-
import type { EventController } from "./event-controller.js";
|
|
4
|
-
export { createNavigationTransaction };
|
|
5
|
-
/**
|
|
6
|
-
* Extended configuration for navigation bridge with event controller
|
|
7
|
-
*/
|
|
8
|
-
export interface NavigationBridgeConfigWithController extends NavigationBridgeConfig {
|
|
9
|
-
eventController: EventController;
|
|
10
|
-
/** RSC version from initial payload metadata. */
|
|
11
|
-
version?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Create a navigation bridge for handling client-side navigation
|
|
15
|
-
*
|
|
16
|
-
* The bridge coordinates all navigation operations:
|
|
17
|
-
* - Link click interception
|
|
18
|
-
* - Browser back/forward (popstate)
|
|
19
|
-
* - Programmatic navigation
|
|
20
|
-
*
|
|
21
|
-
* Uses the event controller for reactive state management.
|
|
22
|
-
*
|
|
23
|
-
* @param config - Bridge configuration
|
|
24
|
-
* @returns NavigationBridge instance
|
|
25
|
-
*/
|
|
26
|
-
export declare function createNavigationBridge(config: NavigationBridgeConfigWithController): NavigationBridge;
|
|
27
|
-
export { createNavigationBridge as default };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { NavigationClient, RscBrowserDependencies } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Create a navigation client for fetching RSC payloads
|
|
4
|
-
*
|
|
5
|
-
* The client handles building URLs with RSC parameters and
|
|
6
|
-
* deserializing the response using the RSC runtime.
|
|
7
|
-
*
|
|
8
|
-
* Checks the in-memory prefetch cache before making a network request.
|
|
9
|
-
* Tries the source-scoped key first (populated when the server tagged
|
|
10
|
-
* the response as source-sensitive via `X-RSC-Prefetch-Scope: source`)
|
|
11
|
-
* and falls back to the Rango-state-keyed wildcard slot used for the
|
|
12
|
-
* common source-agnostic case.
|
|
13
|
-
*
|
|
14
|
-
* @param deps - RSC browser dependencies (createFromFetch)
|
|
15
|
-
* @returns NavigationClient instance
|
|
16
|
-
*/
|
|
17
|
-
export declare function createNavigationClient(deps: Pick<RscBrowserDependencies, "createFromFetch">): NavigationClient;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A module-level handle to the active navigation store.
|
|
3
|
-
*
|
|
4
|
-
* The boot path (`rsc-router.tsx`) calls `createNavigationStore()` directly;
|
|
5
|
-
* there is no global store singleton. This handle is the live reference for
|
|
6
|
-
* code that needs the store but does not
|
|
7
|
-
* receive it by argument: the jar-divergence observer (below) and the client
|
|
8
|
-
* seat of `invalidateClientCache()` (added later).
|
|
9
|
-
*
|
|
10
|
-
* Dependency-light on purpose: it imports only `setRangoStateObserver` and the
|
|
11
|
-
* store type, so pulling it into the default root entry does not drag the
|
|
12
|
-
* navigation store into bundles that previously lacked it.
|
|
13
|
-
*/
|
|
14
|
-
import type { NavigationStore } from "./types.js";
|
|
15
|
-
/**
|
|
16
|
-
* Register the active navigation store at boot, and wire the jar-divergence
|
|
17
|
-
* observer: when a per-request cookie read detects an EXTERNAL rotation (a
|
|
18
|
-
* sibling tab, a server `Set-Cookie`, or a cookie clear), mark this tab's
|
|
19
|
-
* history cache stale. The history cache is not state-keyed, so the value
|
|
20
|
-
* rotation alone does not reach it. No broadcast, no prefetch clear, no
|
|
21
|
-
* re-rotation — the value already changed externally.
|
|
22
|
-
*/
|
|
23
|
-
export declare function registerNavigationStore(store: NavigationStore): void;
|
|
24
|
-
/** The active navigation store, or null before boot has registered it. */
|
|
25
|
-
export declare function getRegisteredStore(): NavigationStore | null;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { NavigationStore, ResolvedSegment, HandleData } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Clone the handleData CONTAINERS (the handle-name map and each segment map) so
|
|
4
|
-
* a cache entry is decoupled from the live map that eventController mutates — it
|
|
5
|
-
* adds/deletes segment keys and REPLACES bucket arrays in place. The bucket
|
|
6
|
-
* arrays themselves are shared by reference, NOT copied: a bucket array is only
|
|
7
|
-
* ever replaced wholesale (eventController.setHandleData reassigns it,
|
|
8
|
-
* resolveDeferredHandleValues builds a fresh one) and collect functions read it
|
|
9
|
-
* without mutating, so sharing is safe and skips an O(elements) copy on every
|
|
10
|
-
* cache write — the per-yield streaming hot path. This also preserves any
|
|
11
|
-
* non-serializable bucket contents (React elements, functions, etc.).
|
|
12
|
-
*/
|
|
13
|
-
export declare function cloneHandleData(handleData: HandleData): HandleData;
|
|
14
|
-
/**
|
|
15
|
-
* Options for generating a history key
|
|
16
|
-
*/
|
|
17
|
-
export interface HistoryKeyOptions {
|
|
18
|
-
/** If true, append :intercept suffix to differentiate intercept entries */
|
|
19
|
-
intercept?: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Generate a cache key from a URL.
|
|
23
|
-
* Uses pathname + search (query params) directly as the key.
|
|
24
|
-
* Hash fragments (#) are excluded since they don't affect server data.
|
|
25
|
-
*
|
|
26
|
-
* For intercept routes, append `:intercept` suffix to cache them separately
|
|
27
|
-
* from non-intercept versions of the same URL.
|
|
28
|
-
*/
|
|
29
|
-
export declare function generateHistoryKey(url?: string, options?: HistoryKeyOptions): string;
|
|
30
|
-
/**
|
|
31
|
-
* Configuration for creating a navigation store
|
|
32
|
-
*/
|
|
33
|
-
export interface NavigationStoreConfig {
|
|
34
|
-
initialLocation?: {
|
|
35
|
-
href: string;
|
|
36
|
-
};
|
|
37
|
-
initialSegmentIds?: string[];
|
|
38
|
-
initialHistoryKey?: string;
|
|
39
|
-
initialSegments?: ResolvedSegment[];
|
|
40
|
-
/**
|
|
41
|
-
* Maximum number of history entries to cache (default: 20)
|
|
42
|
-
* Older entries are evicted when limit is reached
|
|
43
|
-
*/
|
|
44
|
-
cacheSize?: number;
|
|
45
|
-
/**
|
|
46
|
-
* Enable cross-tab cache invalidation via BroadcastChannel (default: true)
|
|
47
|
-
* When cache is cleared (via server actions or invalidateClientCache()),
|
|
48
|
-
* other tabs will also clear their cache
|
|
49
|
-
*/
|
|
50
|
-
crossTabSync?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Auto-refresh when another tab mutates data on the same path (default: true)
|
|
53
|
-
* Triggered when cache is cleared via server actions or invalidateClientCache()
|
|
54
|
-
* Requires crossTabSync to be enabled
|
|
55
|
-
*/
|
|
56
|
-
crossTabAutoRefresh?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Callback to invoke when cross-tab refresh is triggered
|
|
59
|
-
* Called when another tab invalidates the cache for a related route
|
|
60
|
-
*/
|
|
61
|
-
onCrossTabRefresh?: () => void;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Create a navigation store for managing browser-side navigation state
|
|
65
|
-
*
|
|
66
|
-
* The store manages two types of state:
|
|
67
|
-
* - NavigationState: Public state exposed via useNavigation hook
|
|
68
|
-
* - SegmentState: Internal segment management for partial RSC updates
|
|
69
|
-
*
|
|
70
|
-
* @param config - Initial configuration
|
|
71
|
-
* @returns NavigationStore instance
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* const store = createNavigationStore({
|
|
76
|
-
* initialLocation: window.location,
|
|
77
|
-
* initialSegmentIds: [],
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* // Subscribe to state changes (for useNavigation hook)
|
|
81
|
-
* const unsubscribe = store.subscribe(() => {
|
|
82
|
-
* const state = store.getState();
|
|
83
|
-
* console.log('Navigation state:', state);
|
|
84
|
-
* });
|
|
85
|
-
*
|
|
86
|
-
* // Update state
|
|
87
|
-
* store.setState({ state: 'loading' });
|
|
88
|
-
*
|
|
89
|
-
* // Subscribe to UI updates (for re-rendering)
|
|
90
|
-
* store.onUpdate((update) => {
|
|
91
|
-
* console.log('New root:', update.root);
|
|
92
|
-
* });
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare function createNavigationStore(config?: NavigationStoreConfig): NavigationStore;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { NavigateOptions, NavigationStore, ResolvedSegment, StreamingToken } from "./types.js";
|
|
2
|
-
import type { EventController, NavigationHandle } from "./event-controller.js";
|
|
3
|
-
export { resolveNavigationState } from "./history-state.js";
|
|
4
|
-
/**
|
|
5
|
-
* Options for committing a navigation transaction
|
|
6
|
-
*/
|
|
7
|
-
interface CommitOptions {
|
|
8
|
-
url: string;
|
|
9
|
-
segmentIds: string[];
|
|
10
|
-
segments: ResolvedSegment[];
|
|
11
|
-
replace?: boolean;
|
|
12
|
-
scroll?: boolean;
|
|
13
|
-
/** User-provided state to store in history.state */
|
|
14
|
-
state?: unknown;
|
|
15
|
-
/** If true, only update store without changing URL/history (for server actions) */
|
|
16
|
-
storeOnly?: boolean;
|
|
17
|
-
/** If true, this is an intercept route - store in history.state for popstate handling */
|
|
18
|
-
intercept?: boolean;
|
|
19
|
-
/** Source URL where the intercept was triggered from (stored in history.state) */
|
|
20
|
-
interceptSourceUrl?: string;
|
|
21
|
-
/** If true, only update cache without touching store or history (for background stale revalidation) */
|
|
22
|
-
cacheOnly?: boolean;
|
|
23
|
-
/** Server-set location state to merge into history.pushState */
|
|
24
|
-
serverState?: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Options that can override the pre-configured commit settings
|
|
28
|
-
*/
|
|
29
|
-
interface BoundCommitOverrides {
|
|
30
|
-
/** Override scroll behavior (e.g., disable for intercepts) */
|
|
31
|
-
scroll?: boolean;
|
|
32
|
-
/** Override replace behavior (e.g., force replace for intercepts) */
|
|
33
|
-
replace?: boolean;
|
|
34
|
-
/** Override user-provided state */
|
|
35
|
-
state?: unknown;
|
|
36
|
-
/** Mark this as an intercept route */
|
|
37
|
-
intercept?: boolean;
|
|
38
|
-
/** Source URL where intercept was triggered from */
|
|
39
|
-
interceptSourceUrl?: string;
|
|
40
|
-
/** If true, only update cache (for stale revalidation) */
|
|
41
|
-
cacheOnly?: boolean;
|
|
42
|
-
/** Server-set location state to merge into history.pushState */
|
|
43
|
-
serverState?: Record<string, unknown>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Bound transaction with pre-configured commit options (without segmentIds/segments)
|
|
47
|
-
*/
|
|
48
|
-
export interface BoundTransaction {
|
|
49
|
-
readonly currentUrl: string;
|
|
50
|
-
/** Start streaming and get a token to end it when the stream completes */
|
|
51
|
-
startStreaming(): StreamingToken;
|
|
52
|
-
/** Commit the navigation. Returns the effective scroll option for the caller to handle. */
|
|
53
|
-
commit(segmentIds: string[], segments: ResolvedSegment[], overrides?: BoundCommitOverrides): {
|
|
54
|
-
scroll?: boolean;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Navigation transaction for managing state during navigation
|
|
59
|
-
* Uses the event controller handle for lifecycle management
|
|
60
|
-
*/
|
|
61
|
-
interface NavigationTransaction extends Disposable {
|
|
62
|
-
commit(options: CommitOptions): {
|
|
63
|
-
scroll?: boolean;
|
|
64
|
-
};
|
|
65
|
-
with(options: Omit<CommitOptions, "segmentIds" | "segments">): BoundTransaction;
|
|
66
|
-
/** The navigation handle from the event controller */
|
|
67
|
-
handle: NavigationHandle;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Creates a navigation transaction that coordinates with the event controller.
|
|
71
|
-
* Handles loading state transitions and cleanup on completion/abort.
|
|
72
|
-
*/
|
|
73
|
-
export declare function createNavigationTransaction(store: NavigationStore, eventController: EventController, url: string, options?: NavigateOptions & {
|
|
74
|
-
skipLoadingState?: boolean;
|
|
75
|
-
}): NavigationTransaction;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { NetworkError } from "../errors.js";
|
|
2
|
-
import type { UpdateSubscriber } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Convert an unknown error to a NetworkError, or return null if not network-related.
|
|
5
|
-
*
|
|
6
|
-
* Pure function: extracts the "is this a network error?" decision from
|
|
7
|
-
* navigation-bridge and server-action-bridge so it can be unit tested.
|
|
8
|
-
*/
|
|
9
|
-
export declare function toNetworkError(error: unknown, context: {
|
|
10
|
-
url: string;
|
|
11
|
-
operation: "action" | "navigation" | "revalidation";
|
|
12
|
-
}): NetworkError | null;
|
|
13
|
-
/**
|
|
14
|
-
* Emit a NetworkError to the nearest error boundary (offline, failed fetch).
|
|
15
|
-
*/
|
|
16
|
-
export declare function emitNetworkError(onUpdate: UpdateSubscriber, error: NetworkError, pathname: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Emit a navigation processing error to the nearest error boundary. Used when a
|
|
19
|
-
* navigation response cannot be processed (an undecodable Flight body, or any
|
|
20
|
-
* unanticipated failure while building the response) -- for both fresh and
|
|
21
|
-
* prefetched responses, since both funnel through the navigation catch. Without
|
|
22
|
-
* this, such a failure becomes an uncaught rejection that silently aborts the
|
|
23
|
-
* navigation instead of surfacing the route's error boundary.
|
|
24
|
-
*/
|
|
25
|
-
export declare function emitNavigationError(onUpdate: UpdateSubscriber, error: unknown, pathname: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Check if an error is safe to suppress in background operations.
|
|
28
|
-
*
|
|
29
|
-
* Background revalidation (SWR, navigated-away refetch) should silently
|
|
30
|
-
* swallow AbortErrors and network errors since the user has already moved
|
|
31
|
-
* on and showing an error would be disruptive.
|
|
32
|
-
*
|
|
33
|
-
* Pure function, easily unit tested.
|
|
34
|
-
*/
|
|
35
|
-
export declare function isBackgroundSuppressible(error: unknown): boolean;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { NavigationStore, NavigationClient, UpdateSubscriber, ResolvedSegment } from "./types.js";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
import type { RenderSegmentsOptions } from "../segment-system.js";
|
|
4
|
-
import type { BoundTransaction } from "./navigation-transaction.js";
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for creating a partial updater
|
|
7
|
-
*/
|
|
8
|
-
export interface PartialUpdateConfig {
|
|
9
|
-
store: NavigationStore;
|
|
10
|
-
client: NavigationClient;
|
|
11
|
-
onUpdate: UpdateSubscriber;
|
|
12
|
-
renderSegments: (segments: ResolvedSegment[], options?: RenderSegmentsOptions) => Promise<ReactNode> | ReactNode;
|
|
13
|
-
/** RSC version getter — returns the current version (may change after HMR) */
|
|
14
|
-
getVersion?: () => string | undefined;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Options that can override the pre-configured commit settings
|
|
18
|
-
*/
|
|
19
|
-
export interface CommitOverrides {
|
|
20
|
-
/** Override scroll behavior (e.g., disable for intercepts) */
|
|
21
|
-
scroll?: boolean;
|
|
22
|
-
/** Override replace behavior (e.g., force replace for intercepts) */
|
|
23
|
-
replace?: boolean;
|
|
24
|
-
/** Mark this as an intercept route */
|
|
25
|
-
intercept?: boolean;
|
|
26
|
-
/** Source URL where intercept was triggered from */
|
|
27
|
-
interceptSourceUrl?: string;
|
|
28
|
-
/** Server-set location state to merge into history.pushState */
|
|
29
|
-
serverState?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Discriminated update mode for partial updates.
|
|
33
|
-
*/
|
|
34
|
-
export type UpdateMode = {
|
|
35
|
-
type: "navigate";
|
|
36
|
-
/** Cached segments for the target URL. When provided, these are used to build
|
|
37
|
-
* the segment map instead of the current page's segments. This ensures consistency
|
|
38
|
-
* when we send cached segment IDs to the server - if the server returns empty diff,
|
|
39
|
-
* we use the same segments we told the server we have. */
|
|
40
|
-
targetCacheSegments?: ResolvedSegment[];
|
|
41
|
-
/** Cached handle data for the target URL. When server returns empty diff and we're
|
|
42
|
-
* rendering from cache, this is passed to the UI to restore breadcrumbs etc. */
|
|
43
|
-
targetCacheHandleData?: Record<string, Record<string, unknown[]>>;
|
|
44
|
-
/** Source URL for intercept restore (popstate cache miss) */
|
|
45
|
-
interceptSourceUrl?: string;
|
|
46
|
-
} | {
|
|
47
|
-
type: "leave-intercept";
|
|
48
|
-
interceptSourceUrl?: string;
|
|
49
|
-
} | {
|
|
50
|
-
type: "stale-revalidation";
|
|
51
|
-
interceptSourceUrl?: string;
|
|
52
|
-
} | {
|
|
53
|
-
type: "action";
|
|
54
|
-
interceptSourceUrl?: string;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Type for the fetchPartialUpdate function
|
|
58
|
-
*/
|
|
59
|
-
export type PartialUpdater = (targetUrl: string, segmentIds: string[] | undefined, isRetry: boolean, signal: AbortSignal | undefined, tx: BoundTransaction, mode?: UpdateMode) => Promise<void>;
|
|
60
|
-
export declare function createPartialUpdater(config: PartialUpdateConfig): PartialUpdater;
|
|
61
|
-
export { createPartialUpdater as default };
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prefetch Cache
|
|
3
|
-
*
|
|
4
|
-
* In-memory cache storing eagerly-decoded prefetch payloads for instant,
|
|
5
|
-
* already-warm cache hits on subsequent navigation. A prefetch fetches the
|
|
6
|
-
* RSC partial AND decodes it (createFromFetch) up front — decoding the Flight
|
|
7
|
-
* stream resolves the route's client references, so the route's JS chunks are
|
|
8
|
-
* imported during prefetch rather than on click. The decoded payload is reused
|
|
9
|
-
* verbatim by navigation, so a prefetched click loads no new code. Two key
|
|
10
|
-
* scopes are in play:
|
|
11
|
-
* - Wildcard (default): built by `buildPrefetchKey(rangoState, target)` —
|
|
12
|
-
* shape `rangoState\0/target?...`. Shared across all source pages and
|
|
13
|
-
* invalidated automatically when Rango state bumps (deploy or
|
|
14
|
-
* server-action invalidation).
|
|
15
|
-
* - Source-scoped: built by `buildSourceKey(rangoState, sourceHref, target)`
|
|
16
|
-
* — shape `rangoState\0sourceHref\0/target?...`. Embeds the Rango state
|
|
17
|
-
* (so rotation invalidates source-scoped entries too) plus the source
|
|
18
|
-
* href (so each originating page gets its own slot). Populated when the
|
|
19
|
-
* server tags a response with `X-RSC-Prefetch-Scope: source` (intercept
|
|
20
|
-
* modals etc.), OR when a Link opts in with `prefetchKey=":source"` — in
|
|
21
|
-
* both cases so source-sensitive responses cannot bleed into navigations
|
|
22
|
-
* from other pages.
|
|
23
|
-
*
|
|
24
|
-
* Also tracks in-flight prefetch promises. Each promise resolves to the
|
|
25
|
-
* decoded prefetch entry (or null), letting navigation adopt a
|
|
26
|
-
* still-downloading prefetch without issuing a duplicate request. A
|
|
27
|
-
* single promise can be registered under multiple alias keys (see
|
|
28
|
-
* `setInflightPromiseWithAliases`) so same-source navigations adopt via
|
|
29
|
-
* their source key while cross-source ones fall through to the wildcard
|
|
30
|
-
* alias — with consume/clear atomically removing every alias.
|
|
31
|
-
*
|
|
32
|
-
* Replaces the previous browser HTTP cache approach which was unreliable
|
|
33
|
-
* due to response draining race conditions and browser inconsistencies.
|
|
34
|
-
*
|
|
35
|
-
* State here lives in module-level singletons (cache, inflight, generation,
|
|
36
|
-
* cacheTTL, etc.) rather than a per-instance factory. This is correct because
|
|
37
|
-
* exactly one router is live per document — an SPA navigation crossing a
|
|
38
|
-
* host-router boundary forces a full document reload — so the singletons are
|
|
39
|
-
* effectively per-document. Unit tests reset them via clearPrefetchCache().
|
|
40
|
-
*/
|
|
41
|
-
import type { RscPayload } from "../types.js";
|
|
42
|
-
/**
|
|
43
|
-
* A prefetch that has been fetched AND eagerly decoded. Storing the decoded
|
|
44
|
-
* payload (not the raw Response) is what makes a prefetched navigation "warm":
|
|
45
|
-
* decoding the Flight stream during prefetch pulls the route's client chunks,
|
|
46
|
-
* so the click reuses ready elements and loads no new JS.
|
|
47
|
-
*/
|
|
48
|
-
export interface DecodedPrefetch {
|
|
49
|
-
/** The eagerly-decoded RSC payload. Reused verbatim by navigation. */
|
|
50
|
-
payload: Promise<RscPayload>;
|
|
51
|
-
/**
|
|
52
|
-
* Resolves when the underlying RSC stream finishes draining. Navigation
|
|
53
|
-
* forwards this as its streamComplete so scroll/revalidation gating is
|
|
54
|
-
* unchanged from the fresh-fetch path.
|
|
55
|
-
*/
|
|
56
|
-
streamComplete: Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Prefetch scope as tagged by the server via `X-RSC-Prefetch-Scope`.
|
|
59
|
-
* `"source"` means the response is source-page-sensitive and must not be
|
|
60
|
-
* reused by a navigation from a different page — navigation enforces this
|
|
61
|
-
* when it adopted an inflight entry through the wildcard key.
|
|
62
|
-
*/
|
|
63
|
-
scope: "source" | "wildcard";
|
|
64
|
-
/**
|
|
65
|
-
* Synchronously-readable flag, flipped to true when `streamComplete` resolves
|
|
66
|
-
* (the entire RSC stream has drained). Navigation reads this at click time to
|
|
67
|
-
* tell a FULLY warmed prefetch (payload commits without suspending → safe to
|
|
68
|
-
* commit in a startTransition, no fallback flash) from a partially-warmed one
|
|
69
|
-
* (still streaming → stream its fallbacks like a cold load). Starts false.
|
|
70
|
-
*/
|
|
71
|
-
complete: boolean;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Initialize the prefetch cache with the configured TTL and max size.
|
|
75
|
-
* Called once at app startup with the values from server metadata. Each
|
|
76
|
-
* argument is applied only when provided, so a caller can set just the TTL.
|
|
77
|
-
* A TTL of 0 disables the in-memory cache and all prefetching. A size below 1
|
|
78
|
-
* is ignored (the default is kept) — disabling prefetch is the TTL's job.
|
|
79
|
-
*/
|
|
80
|
-
export declare function initPrefetchCache(ttlMs?: number, maxSize?: number): void;
|
|
81
|
-
/**
|
|
82
|
-
* Check if the prefetch cache is disabled (TTL <= 0).
|
|
83
|
-
* When disabled, no prefetch requests should be issued.
|
|
84
|
-
*/
|
|
85
|
-
export declare function isPrefetchCacheDisabled(): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Build a cache key by combining a scope prefix with the target URL.
|
|
88
|
-
*
|
|
89
|
-
* Low-level primitive — callers that want a specific scope should use
|
|
90
|
-
* one of:
|
|
91
|
-
* - Wildcard (source-agnostic): prefix is the Rango state value from
|
|
92
|
-
* `getRangoState()`. Shared across all source pages. Invalidated
|
|
93
|
-
* automatically when Rango state bumps (deploy or server-action).
|
|
94
|
-
* Key shape: `rangoState\0/target?...`.
|
|
95
|
-
* - Source-scoped: use `buildSourceKey()`. Key shape:
|
|
96
|
-
* `rangoState\0sourceHref\0/target?...` — embeds the Rango state so
|
|
97
|
-
* rotation invalidates source-scoped entries alongside wildcard ones,
|
|
98
|
-
* plus the source page href so the key is unique per originating page.
|
|
99
|
-
* Populated either when the server tags a response with
|
|
100
|
-
* `X-RSC-Prefetch-Scope: source` (intercept modals, etc.) or when a
|
|
101
|
-
* Link opts in via `prefetchKey=":source"`.
|
|
102
|
-
*
|
|
103
|
-
* The `_rsc_segments` query param that travels in the target URL means
|
|
104
|
-
* clients with different mounted segment trees naturally get different
|
|
105
|
-
* keys — so segment-level diffs remain consistent across both scopes.
|
|
106
|
-
*/
|
|
107
|
-
export declare function buildPrefetchKey(prefix: string, targetUrl: URL): string;
|
|
108
|
-
/**
|
|
109
|
-
* Build a source-scoped cache key. Key shape:
|
|
110
|
-
* `rangoState\0sourceHref\0/target?...`.
|
|
111
|
-
*
|
|
112
|
-
* - `rangoState` is included so state rotation invalidates source-scoped
|
|
113
|
-
* entries alongside wildcard ones.
|
|
114
|
-
* - `sourceHref` makes the key unique per originating page.
|
|
115
|
-
*/
|
|
116
|
-
export declare function buildSourceKey(rangoState: string, sourceHref: string, targetUrl: URL): string;
|
|
117
|
-
/**
|
|
118
|
-
* Check if a prefetch is already cached, in-flight, or queued for the given key.
|
|
119
|
-
*/
|
|
120
|
-
export declare function hasPrefetch(key: string): boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Consume a cached, eagerly-decoded prefetch. Returns null if not found or
|
|
123
|
-
* expired. One-time consumption: the entry is deleted after retrieval.
|
|
124
|
-
* Returns null when caching is disabled (TTL <= 0).
|
|
125
|
-
*
|
|
126
|
-
* Does NOT check in-flight prefetches — use consumeInflightPrefetch()
|
|
127
|
-
* for that (returns a Promise instead of a resolved entry).
|
|
128
|
-
*/
|
|
129
|
-
export declare function consumePrefetch(key: string): DecodedPrefetch | null;
|
|
130
|
-
/**
|
|
131
|
-
* Consume an in-flight prefetch promise. Returns null if no prefetch is
|
|
132
|
-
* in-flight for this key. The returned Promise resolves to the decoded
|
|
133
|
-
* prefetch entry (or null if the fetch failed/was aborted, or carried a
|
|
134
|
-
* control header the navigation must re-fetch to honor).
|
|
135
|
-
*
|
|
136
|
-
* One-time consumption: the promise entry is removed (along with any
|
|
137
|
-
* sibling aliases registered via `setInflightPromiseWithAliases`) so a
|
|
138
|
-
* second call on any alias returns null — only one caller can adopt the
|
|
139
|
-
* shared Response stream. The `inflight` set entry is intentionally
|
|
140
|
-
* kept so that `hasPrefetch()` continues to return true while the
|
|
141
|
-
* underlying fetch is still downloading — this prevents
|
|
142
|
-
* `prefetchDirect()` or other callers from starting a duplicate request
|
|
143
|
-
* during the handoff window. The inflight flag is cleaned up naturally
|
|
144
|
-
* by `clearPrefetchInflight()` in the fetch's `.finally()`.
|
|
145
|
-
*/
|
|
146
|
-
export declare function consumeInflightPrefetch(key: string): Promise<DecodedPrefetch | null> | null;
|
|
147
|
-
/**
|
|
148
|
-
* Store an eagerly-decoded prefetch in the in-memory cache.
|
|
149
|
-
*
|
|
150
|
-
* Skips storage if the generation has changed since the fetch started
|
|
151
|
-
* (a server action invalidated the cache mid-flight).
|
|
152
|
-
*/
|
|
153
|
-
export declare function storePrefetch(key: string, entry: DecodedPrefetch, fetchGeneration: number): void;
|
|
154
|
-
/**
|
|
155
|
-
* Remove a single stored prefetch entry. Used to evict an entry whose body
|
|
156
|
-
* stream stalled after headers arrived (its payload / streamComplete never
|
|
157
|
-
* settle), so future prefetches and navigation refetch instead of dedupe-ing
|
|
158
|
-
* against — and awaiting — a stuck entry.
|
|
159
|
-
*
|
|
160
|
-
* Identity-guarded: only evicts when the entry CURRENTLY stored under `key` is
|
|
161
|
-
* the exact `entry` we published. A generation check alone is insufficient —
|
|
162
|
-
* after this entry is consumed (consumePrefetch) and a fresh prefetch
|
|
163
|
-
* republishes under the SAME key in the SAME generation, a gen-only guard would
|
|
164
|
-
* delete that valid newer entry. Reference identity drops only our own stalled
|
|
165
|
-
* entry.
|
|
166
|
-
*/
|
|
167
|
-
export declare function removePrefetch(key: string, entry: DecodedPrefetch): void;
|
|
168
|
-
/**
|
|
169
|
-
* Capture the current generation. The returned value is passed to
|
|
170
|
-
* storePrefetch so it can detect stale completions.
|
|
171
|
-
*/
|
|
172
|
-
export declare function currentGeneration(): number;
|
|
173
|
-
export declare function markPrefetchInflight(key: string): void;
|
|
174
|
-
export declare function setInflightPromise(key: string, promise: Promise<DecodedPrefetch | null>): void;
|
|
175
|
-
/**
|
|
176
|
-
* Store the same in-flight Promise under multiple keys, recording them
|
|
177
|
-
* as sibling aliases. Consuming or clearing any one alias atomically
|
|
178
|
-
* removes every entry, guaranteeing the shared Response stream has a
|
|
179
|
-
* single consumer even when navigation looks up either key.
|
|
180
|
-
*/
|
|
181
|
-
export declare function setInflightPromiseWithAliases(keys: string[], promise: Promise<DecodedPrefetch | null>): void;
|
|
182
|
-
export declare function clearPrefetchInflight(key: string): void;
|
|
183
|
-
export declare function clearPrefetchCache(): void;
|