@rangojs/router 0.4.3 → 0.5.1
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/dist/types/browser/prefetch/cache.d.ts +31 -2
- package/dist/types/cache/cf/cf-cache-store.d.ts +2 -0
- package/dist/types/cache/types.d.ts +39 -6
- package/dist/types/route-definition/helpers-types.d.ts +5 -4
- package/dist/types/rsc/capture-queue.d.ts +19 -3
- package/dist/types/rsc/shell-build-manifest.d.ts +2 -2
- package/dist/types/rsc/shell-capture.d.ts +22 -2
- package/dist/types/rsc/shell-serve.d.ts +18 -12
- package/dist/types/static-handler.d.ts +15 -1
- package/dist/types/urls/path-helper-types.d.ts +6 -7
- package/dist/types.backup/__internal.d.ts +127 -0
- package/dist/types.backup/bin/rango.d.ts +1 -0
- package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
- package/dist/types.backup/browser/action-fence.d.ts +33 -0
- package/dist/types.backup/browser/app-shell.d.ts +34 -0
- package/dist/types.backup/browser/app-version.d.ts +6 -0
- package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
- package/dist/types.backup/browser/cookie-name.d.ts +66 -0
- package/dist/types.backup/browser/event-controller.d.ts +221 -0
- package/dist/types.backup/browser/history-state.d.ts +26 -0
- package/dist/types.backup/browser/index.d.ts +1 -0
- package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
- package/dist/types.backup/browser/logging.d.ts +33 -0
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
- package/dist/types.backup/browser/navigation-client.d.ts +17 -0
- package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types.backup/browser/navigation-store.d.ts +95 -0
- package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
- package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
- package/dist/types.backup/browser/partial-update.d.ts +61 -0
- package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
- package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
- package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
- package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types.backup/browser/rango-state.d.ts +52 -0
- package/dist/types.backup/browser/react/Link.d.ts +140 -0
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types.backup/browser/react/context.d.ts +54 -0
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types.backup/browser/react/index.d.ts +1 -0
- package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types.backup/browser/react/location-state.d.ts +29 -0
- package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
- package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
- package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types.backup/browser/react/use-action.d.ts +61 -0
- package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
- package/dist/types.backup/browser/react/use-href.d.ts +32 -0
- package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
- package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
- package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
- package/dist/types.backup/browser/react/use-params.d.ts +21 -0
- package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
- package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
- package/dist/types.backup/browser/react/use-router.d.ts +23 -0
- package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
- package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
- package/dist/types.backup/browser/response-adapter.d.ts +58 -0
- package/dist/types.backup/browser/rsc-router.d.ts +141 -0
- package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
- package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
- package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
- package/dist/types.backup/browser/types.d.ts +530 -0
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types.backup/build/generate-manifest.d.ts +100 -0
- package/dist/types.backup/build/generate-route-types.d.ts +8 -0
- package/dist/types.backup/build/index.d.ts +21 -0
- package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types.backup/build/route-trie.d.ts +89 -0
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
- package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
- package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
- package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
- package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
- package/dist/types.backup/cache/background-task.d.ts +21 -0
- package/dist/types.backup/cache/cache-error.d.ts +71 -0
- package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
- package/dist/types.backup/cache/cache-policy.d.ts +59 -0
- package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
- package/dist/types.backup/cache/cache-scope.d.ts +134 -0
- package/dist/types.backup/cache/cache-tag.d.ts +79 -0
- package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types.backup/cache/cf/index.d.ts +3 -0
- package/dist/types.backup/cache/document-cache.d.ts +69 -0
- package/dist/types.backup/cache/handle-capture.d.ts +23 -0
- package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
- package/dist/types.backup/cache/index.d.ts +7 -0
- package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
- package/dist/types.backup/cache/profile-registry.d.ts +40 -0
- package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
- package/dist/types.backup/cache/segment-codec.d.ts +78 -0
- package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
- package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
- package/dist/types.backup/cache/taint.d.ts +71 -0
- package/dist/types.backup/cache/types.d.ts +407 -0
- package/dist/types.backup/cache/vercel/index.d.ts +1 -0
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
- package/dist/types.backup/client.d.ts +184 -0
- package/dist/types.backup/client.rsc.d.ts +39 -0
- package/dist/types.backup/cloudflare/index.d.ts +7 -0
- package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
- package/dist/types.backup/component-utils.d.ts +46 -0
- package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
- package/dist/types.backup/context-var.d.ts +84 -0
- package/dist/types.backup/debug.d.ts +57 -0
- package/dist/types.backup/decode-loader-results.d.ts +5 -0
- package/dist/types.backup/default-error-boundary.d.ts +10 -0
- package/dist/types.backup/defer.d.ts +89 -0
- package/dist/types.backup/deps/browser.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
- package/dist/types.backup/deps/rsc.d.ts +1 -0
- package/dist/types.backup/deps/ssr.d.ts +1 -0
- package/dist/types.backup/encode-kv.d.ts +35 -0
- package/dist/types.backup/errors.d.ts +226 -0
- package/dist/types.backup/escape-script.d.ts +44 -0
- package/dist/types.backup/handle.d.ts +93 -0
- package/dist/types.backup/handles/MetaTags.d.ts +17 -0
- package/dist/types.backup/handles/Scripts.d.ts +38 -0
- package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
- package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
- package/dist/types.backup/handles/is-thenable.d.ts +12 -0
- package/dist/types.backup/handles/meta.d.ts +43 -0
- package/dist/types.backup/handles/script.d.ts +139 -0
- package/dist/types.backup/host/cookie-handler.d.ts +8 -0
- package/dist/types.backup/host/errors.d.ts +40 -0
- package/dist/types.backup/host/index.d.ts +33 -0
- package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
- package/dist/types.backup/host/router.d.ts +12 -0
- package/dist/types.backup/host/testing.d.ts +41 -0
- package/dist/types.backup/host/types.d.ts +148 -0
- package/dist/types.backup/host/utils.d.ts +20 -0
- package/dist/types.backup/href-client.d.ts +214 -0
- package/dist/types.backup/index.d.ts +112 -0
- package/dist/types.backup/index.rsc.d.ts +51 -0
- package/dist/types.backup/internal-debug.d.ts +1 -0
- package/dist/types.backup/loader-store.d.ts +193 -0
- package/dist/types.backup/loader.d.ts +18 -0
- package/dist/types.backup/loader.rsc.d.ts +18 -0
- package/dist/types.backup/missing-id-error.d.ts +1 -0
- package/dist/types.backup/outlet-context.d.ts +12 -0
- package/dist/types.backup/outlet-provider.d.ts +12 -0
- package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types.backup/prerender/param-hash.d.ts +6 -0
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types.backup/prerender/store.d.ts +62 -0
- package/dist/types.backup/prerender.d.ts +292 -0
- package/dist/types.backup/redirect-origin.d.ts +55 -0
- package/dist/types.backup/regex-escape.d.ts +6 -0
- package/dist/types.backup/render-error-thrower.d.ts +13 -0
- package/dist/types.backup/response-utils.d.ts +35 -0
- package/dist/types.backup/reverse.d.ts +206 -0
- package/dist/types.backup/root-error-boundary.d.ts +32 -0
- package/dist/types.backup/route-content-wrapper.d.ts +40 -0
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
- package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
- package/dist/types.backup/route-definition/index.d.ts +7 -0
- package/dist/types.backup/route-definition/redirect.d.ts +48 -0
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
- package/dist/types.backup/route-definition.d.ts +1 -0
- package/dist/types.backup/route-map-builder.d.ts +127 -0
- package/dist/types.backup/route-name.d.ts +27 -0
- package/dist/types.backup/route-types.d.ts +172 -0
- package/dist/types.backup/router/basename.d.ts +10 -0
- package/dist/types.backup/router/content-negotiation.d.ts +91 -0
- package/dist/types.backup/router/debug-manifest.d.ts +7 -0
- package/dist/types.backup/router/error-handling.d.ts +76 -0
- package/dist/types.backup/router/find-match.d.ts +19 -0
- package/dist/types.backup/router/handler-context.d.ts +41 -0
- package/dist/types.backup/router/instrument.d.ts +161 -0
- package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
- package/dist/types.backup/router/lazy-includes.d.ts +26 -0
- package/dist/types.backup/router/loader-resolution.d.ts +63 -0
- package/dist/types.backup/router/logging.d.ts +41 -0
- package/dist/types.backup/router/manifest.d.ts +8 -0
- package/dist/types.backup/router/match-api.d.ts +19 -0
- package/dist/types.backup/router/match-context.d.ts +184 -0
- package/dist/types.backup/router/match-handlers.d.ts +49 -0
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types.backup/router/match-pipelines.d.ts +103 -0
- package/dist/types.backup/router/match-result.d.ts +114 -0
- package/dist/types.backup/router/metrics.d.ts +6 -0
- package/dist/types.backup/router/middleware-types.d.ts +74 -0
- package/dist/types.backup/router/middleware.d.ts +116 -0
- package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
- package/dist/types.backup/router/params-util.d.ts +8 -0
- package/dist/types.backup/router/parse-pattern.d.ts +38 -0
- package/dist/types.backup/router/pattern-matching.d.ts +169 -0
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
- package/dist/types.backup/router/prerender-match.d.ts +50 -0
- package/dist/types.backup/router/preview-match.d.ts +22 -0
- package/dist/types.backup/router/request-classification.d.ts +104 -0
- package/dist/types.backup/router/revalidation.d.ts +57 -0
- package/dist/types.backup/router/route-snapshot.d.ts +112 -0
- package/dist/types.backup/router/router-context.d.ts +137 -0
- package/dist/types.backup/router/router-interfaces.d.ts +432 -0
- package/dist/types.backup/router/router-options.d.ts +738 -0
- package/dist/types.backup/router/router-registry.d.ts +15 -0
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
- package/dist/types.backup/router/segment-resolution.d.ts +3 -0
- package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
- package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
- package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
- package/dist/types.backup/router/telemetry.d.ts +215 -0
- package/dist/types.backup/router/timeout.d.ts +68 -0
- package/dist/types.backup/router/tracing.d.ts +125 -0
- package/dist/types.backup/router/trie-matching.d.ts +32 -0
- package/dist/types.backup/router/types.d.ts +98 -0
- package/dist/types.backup/router/url-params.d.ts +26 -0
- package/dist/types.backup/router.d.ts +7 -0
- package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
- package/dist/types.backup/rsc/full-payload.d.ts +22 -0
- package/dist/types.backup/rsc/handler-context.d.ts +31 -0
- package/dist/types.backup/rsc/handler.d.ts +9 -0
- package/dist/types.backup/rsc/helpers.d.ts +213 -0
- package/dist/types.backup/rsc/index.d.ts +17 -0
- package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
- package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
- package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
- package/dist/types.backup/rsc/nonce.d.ts +28 -0
- package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
- package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types.backup/rsc/response-error.d.ts +19 -0
- package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
- package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
- package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types.backup/rsc/server-action.d.ts +68 -0
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
- package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
- package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
- package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
- package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
- package/dist/types.backup/rsc/types.d.ts +290 -0
- package/dist/types.backup/runtime-env.d.ts +1 -0
- package/dist/types.backup/search-params.d.ts +125 -0
- package/dist/types.backup/segment-content-promise.d.ts +13 -0
- package/dist/types.backup/segment-fragments.d.ts +56 -0
- package/dist/types.backup/segment-loader-promise.d.ts +22 -0
- package/dist/types.backup/segment-system.d.ts +84 -0
- package/dist/types.backup/serialize.d.ts +164 -0
- package/dist/types.backup/server/context.d.ts +494 -0
- package/dist/types.backup/server/cookie-parse.d.ts +10 -0
- package/dist/types.backup/server/cookie-store.d.ts +107 -0
- package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types.backup/server/handle-store.d.ts +100 -0
- package/dist/types.backup/server/loader-registry.d.ts +32 -0
- package/dist/types.backup/server/request-context.d.ts +596 -0
- package/dist/types.backup/server/root-layout.d.ts +3 -0
- package/dist/types.backup/server.d.ts +15 -0
- package/dist/types.backup/ssr/index.d.ts +233 -0
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
- package/dist/types.backup/static-handler.d.ts +57 -0
- package/dist/types.backup/testing/cache-status.d.ts +63 -0
- package/dist/types.backup/testing/collect-handle.d.ts +20 -0
- package/dist/types.backup/testing/dispatch.d.ts +123 -0
- package/dist/types.backup/testing/dom.entry.d.ts +15 -0
- package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
- package/dist/types.backup/testing/e2e/index.d.ts +30 -0
- package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
- package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
- package/dist/types.backup/testing/e2e/server.d.ts +35 -0
- package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
- package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
- package/dist/types.backup/testing/flight-tree.d.ts +192 -0
- package/dist/types.backup/testing/flight.d.ts +115 -0
- package/dist/types.backup/testing/flight.entry.d.ts +27 -0
- package/dist/types.backup/testing/generated-routes.d.ts +66 -0
- package/dist/types.backup/testing/index.d.ts +52 -0
- package/dist/types.backup/testing/internal/context.d.ts +225 -0
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types.backup/testing/render-handler.d.ts +160 -0
- package/dist/types.backup/testing/render-route.d.ts +246 -0
- package/dist/types.backup/testing/run-loader.d.ts +186 -0
- package/dist/types.backup/testing/run-middleware.d.ts +132 -0
- package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types.backup/testing/vitest.d.ts +205 -0
- package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
- package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
- package/dist/types.backup/theme/constants.d.ts +39 -0
- package/dist/types.backup/theme/index.d.ts +29 -0
- package/dist/types.backup/theme/theme-context.d.ts +21 -0
- package/dist/types.backup/theme/theme-script.d.ts +26 -0
- package/dist/types.backup/theme/types.d.ts +162 -0
- package/dist/types.backup/theme/use-theme.d.ts +8 -0
- package/dist/types.backup/types/boundaries.d.ts +93 -0
- package/dist/types.backup/types/cache-types.d.ts +191 -0
- package/dist/types.backup/types/error-types.d.ts +114 -0
- package/dist/types.backup/types/global-namespace.d.ts +90 -0
- package/dist/types.backup/types/handler-context.d.ts +658 -0
- package/dist/types.backup/types/index.d.ts +11 -0
- package/dist/types.backup/types/loader-types.d.ts +182 -0
- package/dist/types.backup/types/request-scope.d.ts +93 -0
- package/dist/types.backup/types/route-config.d.ts +105 -0
- package/dist/types.backup/types/route-entry.d.ts +95 -0
- package/dist/types.backup/types/segments.d.ts +234 -0
- package/dist/types.backup/types.d.ts +1 -0
- package/dist/types.backup/urls/include-helper.d.ts +17 -0
- package/dist/types.backup/urls/include-provider.d.ts +27 -0
- package/dist/types.backup/urls/index.d.ts +6 -0
- package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
- package/dist/types.backup/urls/path-helper.d.ts +12 -0
- package/dist/types.backup/urls/pattern-types.d.ts +166 -0
- package/dist/types.backup/urls/response-types.d.ts +67 -0
- package/dist/types.backup/urls/type-extraction.d.ts +157 -0
- package/dist/types.backup/urls/urls-function.d.ts +24 -0
- package/dist/types.backup/urls.d.ts +1 -0
- package/dist/types.backup/use-loader.d.ts +150 -0
- package/dist/types.backup/vercel/index.d.ts +10 -0
- package/dist/types.backup/vercel/tracing.d.ts +70 -0
- package/dist/types.backup/vite/debug.d.ts +80 -0
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types.backup/vite/discovery/state.d.ts +162 -0
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types.backup/vite/index.d.ts +11 -0
- package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
- package/dist/types.backup/vite/plugin-types.d.ts +298 -0
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types.backup/vite/rango.d.ts +29 -0
- package/dist/types.backup/vite/router-discovery.d.ts +23 -0
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types.backup/vite/utils/banner.d.ts +2 -0
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/skills/parallel/SKILL.md +1 -1
- package/skills/ppr/SKILL.md +44 -3
- package/src/browser/prefetch/cache.ts +53 -9
- package/src/browser/prefetch/fetch.ts +83 -2
- package/src/cache/cf/cf-cache-store.ts +27 -8
- package/src/cache/types.ts +41 -6
- package/src/cache/vercel/vercel-cache-store.ts +24 -10
- package/src/route-definition/helpers-types.ts +5 -3
- package/src/rsc/capture-queue.ts +120 -47
- package/src/rsc/rsc-rendering.ts +11 -3
- package/src/rsc/shell-build-manifest.ts +20 -7
- package/src/rsc/shell-capture.ts +164 -12
- package/src/rsc/shell-serve.ts +27 -12
- package/src/static-handler.ts +18 -2
- package/src/urls/path-helper-types.ts +9 -10
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ResolvedSegment } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Determines the merging behavior for segment reconciliation.
|
|
4
|
+
*
|
|
5
|
+
* - 'action': From server-action-bridge's own merge. Always merges loaders,
|
|
6
|
+
* always preserves cached loading (even undefined), never clears cached
|
|
7
|
+
* segment loading.
|
|
8
|
+
* - 'navigation': From partial-update during normal navigation. Does NOT merge
|
|
9
|
+
* loaders, preserves cached loading only when defined, clears truthy loading
|
|
10
|
+
* on cached segments not in server diff.
|
|
11
|
+
* - 'stale-revalidation': From partial-update during stale revalidation or
|
|
12
|
+
* action-triggered refetch. Merges loaders, always preserves cached loading
|
|
13
|
+
* (same as action), clears truthy loading on cached segments not in server diff.
|
|
14
|
+
*/
|
|
15
|
+
export type ReconcileActor = "navigation" | "action" | "stale-revalidation";
|
|
16
|
+
export interface ReconcileInput {
|
|
17
|
+
actor: ReconcileActor;
|
|
18
|
+
/** All segment IDs the server expects the client to have (matched array) */
|
|
19
|
+
matched: string[];
|
|
20
|
+
/** Segment IDs that changed (diff array) */
|
|
21
|
+
diff: string[];
|
|
22
|
+
/** Segments returned from server (raw array, keyed internally by ID) */
|
|
23
|
+
serverSegments: ResolvedSegment[];
|
|
24
|
+
/** Cached segments from current page (raw array, keyed internally by ID) */
|
|
25
|
+
cachedSegments: ResolvedSegment[];
|
|
26
|
+
/** When true, diff segments not in matched are inserted after their parent
|
|
27
|
+
* layout. Used during navigation when consolidation fetch returns loader
|
|
28
|
+
* segments that aren't in the matched array. */
|
|
29
|
+
insertMissingDiff?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ReconcileResult {
|
|
32
|
+
/** All merged segments in matched order (for caching and committing) */
|
|
33
|
+
segments: ResolvedSegment[];
|
|
34
|
+
/** Main segments excluding intercepts (for rendering) */
|
|
35
|
+
mainSegments: ResolvedSegment[];
|
|
36
|
+
/** Intercept segments only (passed via render options) */
|
|
37
|
+
interceptSegments: ResolvedSegment[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Single source of truth for merging server segments with cached segments.
|
|
41
|
+
*
|
|
42
|
+
* Replaces the duplicated merge loops in server-action-bridge.ts and
|
|
43
|
+
* partial-update.ts. The actor parameter controls the subtle behavioral
|
|
44
|
+
* differences between action and navigation merging:
|
|
45
|
+
*
|
|
46
|
+
* Loading preservation:
|
|
47
|
+
* - action/stale-revalidation: Always preserves cached loading value when it
|
|
48
|
+
* differs from server (even when cached is undefined). This prevents tree
|
|
49
|
+
* structure changes that would remount components and destroy useActionState
|
|
50
|
+
* during action revalidation or action-triggered refetch.
|
|
51
|
+
* - navigation: Preserves cached loading only when the cached value is defined
|
|
52
|
+
* (not undefined). When cached is undefined, lets server value through
|
|
53
|
+
* because we're building a new tree.
|
|
54
|
+
*
|
|
55
|
+
* Loader merging:
|
|
56
|
+
* - action/stale-revalidation: Merges partial loader data when server returns
|
|
57
|
+
* fewer loaders than cached (revalidation only updated some loaders).
|
|
58
|
+
* - navigation: Does not merge (full navigation fetches complete data).
|
|
59
|
+
*
|
|
60
|
+
* Cached segment handling (segments in matched but not in server response):
|
|
61
|
+
* - action: Returns cached segment as-is (preserve tree structure).
|
|
62
|
+
* - navigation/stale-revalidation: Clears truthy loading to undefined
|
|
63
|
+
* (prevents showing stale skeletons), but preserves loading=false
|
|
64
|
+
* (suppressed boundary is structural).
|
|
65
|
+
*/
|
|
66
|
+
export declare function reconcileSegments(input: ReconcileInput): ReconcileResult;
|
|
67
|
+
/**
|
|
68
|
+
* Reconcile error segments with cached segments.
|
|
69
|
+
*
|
|
70
|
+
* For error responses, the server returns the error boundary segment.
|
|
71
|
+
* This function overlays error segments onto the full cached tree,
|
|
72
|
+
* preserving sibling layouts that aren't in the error parent chain.
|
|
73
|
+
*/
|
|
74
|
+
export declare function reconcileErrorSegments(cachedSegments: ResolvedSegment[], errorSegments: ResolvedSegment[]): ReconcileResult;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ResolvedSegment } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Assert that merging a server segment with a cached segment won't change
|
|
4
|
+
* the React tree structure. Logs a warning in development when a mismatch
|
|
5
|
+
* is detected.
|
|
6
|
+
*
|
|
7
|
+
* This catches the class of bugs where `loading()` with `{ ssr: false }`
|
|
8
|
+
* produces `loading=false` on SSR but `loading=<skeleton>` on actions,
|
|
9
|
+
* causing React to remount LoaderBoundary/RouteContentWrapper and destroy
|
|
10
|
+
* client state (useActionState, refs, etc.).
|
|
11
|
+
*
|
|
12
|
+
* @param cached - The currently cached segment
|
|
13
|
+
* @param incoming - The new segment from server
|
|
14
|
+
* @param context - Where this merge is happening (for the warning message)
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertSegmentStructure(cached: ResolvedSegment, incoming: ResolvedSegment, context: string): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ServerActionBridge, ServerActionBridgeConfig } from "./types.js";
|
|
2
|
+
import type { EventController } from "./event-controller.js";
|
|
3
|
+
/**
|
|
4
|
+
* Extended configuration for server action bridge with event controller
|
|
5
|
+
*/
|
|
6
|
+
export interface ServerActionBridgeConfigWithController extends ServerActionBridgeConfig {
|
|
7
|
+
eventController: EventController;
|
|
8
|
+
/** Callback to trigger SPA navigation (for action redirects) */
|
|
9
|
+
onNavigate?: (url: string, options?: {
|
|
10
|
+
state?: unknown;
|
|
11
|
+
replace?: boolean;
|
|
12
|
+
_skipCache?: boolean;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a server action bridge for handling RSC server actions
|
|
17
|
+
*
|
|
18
|
+
* The bridge registers a callback with the RSC runtime that handles:
|
|
19
|
+
* - Encoding action arguments
|
|
20
|
+
* - Sending action requests to the server
|
|
21
|
+
* - Processing responses and updating UI
|
|
22
|
+
* - Managing concurrent action requests via event controller
|
|
23
|
+
* - HMR resilience (refetching if segments are missing)
|
|
24
|
+
*
|
|
25
|
+
* @param config - Bridge configuration
|
|
26
|
+
* @returns ServerActionBridge instance
|
|
27
|
+
*/
|
|
28
|
+
export declare function createServerActionBridge(config: ServerActionBridgeConfigWithController): ServerActionBridge;
|
|
29
|
+
export { createServerActionBridge as default };
|
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import type { ReactNode, ComponentType } from "react";
|
|
2
|
+
import type { ResolvedSegment, SlotState } from "../types.js";
|
|
3
|
+
import type { ResolvedThemeConfig, Theme } from "../theme/types.js";
|
|
4
|
+
import type { RenderSegmentsOptions } from "../segment-system.js";
|
|
5
|
+
/**
|
|
6
|
+
* RSC payload received from server.
|
|
7
|
+
* The tree is reconstructed from metadata.segments by the browser bridges.
|
|
8
|
+
*/
|
|
9
|
+
export interface RscPayload<TMetadata = RscMetadata> {
|
|
10
|
+
metadata?: TMetadata;
|
|
11
|
+
returnValue?: ActionResult;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Handle data structure: handleName -> segmentId -> entries[]
|
|
15
|
+
*
|
|
16
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
17
|
+
*/
|
|
18
|
+
export type HandleData = Record<string, Record<string, unknown[]>>;
|
|
19
|
+
/**
|
|
20
|
+
* Metadata included in RSC responses
|
|
21
|
+
*
|
|
22
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
23
|
+
*/
|
|
24
|
+
export interface RscMetadata {
|
|
25
|
+
pathname: string;
|
|
26
|
+
segments: ResolvedSegment[];
|
|
27
|
+
/** Router instance ID — the current app's identity. A mismatch with the
|
|
28
|
+
* client's id (sent as _rsc_rid) is detected server-side and answered with
|
|
29
|
+
* X-RSC-Reload (full document load), so the client never swaps apps
|
|
30
|
+
* in-session; within a session this always equals the current app. */
|
|
31
|
+
routerId?: string;
|
|
32
|
+
isPartial?: boolean;
|
|
33
|
+
isError?: boolean;
|
|
34
|
+
matched?: string[];
|
|
35
|
+
diff?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* All segment ids re-resolved on the server, including null-component
|
|
38
|
+
* ones excluded from `segments`/`diff`. Drives client-side handle-bucket
|
|
39
|
+
* cleanup. Superset of `diff`. See MatchResult.resolvedIds.
|
|
40
|
+
*/
|
|
41
|
+
resolvedIds?: string[];
|
|
42
|
+
/** Merged route params from the matched route */
|
|
43
|
+
params?: Record<string, string>;
|
|
44
|
+
/**
|
|
45
|
+
* State of named slots for this route match
|
|
46
|
+
* Key is slot name (e.g., "@modal"), value is slot state
|
|
47
|
+
* Slots are used for intercepting routes during soft navigation
|
|
48
|
+
*/
|
|
49
|
+
slots?: Record<string, SlotState>;
|
|
50
|
+
/** Root layout component for browser-side re-renders */
|
|
51
|
+
rootLayout?: ComponentType<{
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}>;
|
|
54
|
+
/** Handle data accumulated across route segments (async generator that yields on each push) */
|
|
55
|
+
handles?: AsyncGenerator<HandleData, void, unknown>;
|
|
56
|
+
/** Cached handle data (for back/forward navigation from cache) */
|
|
57
|
+
cachedHandleData?: HandleData;
|
|
58
|
+
/**
|
|
59
|
+
* RSC version string from the server.
|
|
60
|
+
* Used to detect version mismatches after HMR/deployment.
|
|
61
|
+
*/
|
|
62
|
+
version?: string;
|
|
63
|
+
/**
|
|
64
|
+
* TTL in milliseconds for the client-side in-memory prefetch cache.
|
|
65
|
+
* Sent on initial render so the browser can configure its cache duration.
|
|
66
|
+
*/
|
|
67
|
+
prefetchCacheTTL?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Max entries in the client-side in-memory prefetch cache (FIFO eviction).
|
|
70
|
+
* Sent on initial render so the browser can configure its cache capacity.
|
|
71
|
+
*/
|
|
72
|
+
prefetchCacheSize?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Max concurrent speculative prefetch requests on the client.
|
|
75
|
+
* Sent on initial render so the browser can configure its prefetch queue.
|
|
76
|
+
*/
|
|
77
|
+
prefetchConcurrency?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Server-resolved rango state cookie name (`{prefix}_{routerId}`). The client
|
|
80
|
+
* reads it verbatim and binds the rango state cookie to it; composition
|
|
81
|
+
* happens only server-side.
|
|
82
|
+
*/
|
|
83
|
+
stateCookieName?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Theme configuration from router.
|
|
86
|
+
* Included when theme is enabled in router config.
|
|
87
|
+
*/
|
|
88
|
+
themeConfig?: ResolvedThemeConfig | null;
|
|
89
|
+
/**
|
|
90
|
+
* Initial theme from cookie (for SSR hydration).
|
|
91
|
+
* Included when theme is enabled in router config.
|
|
92
|
+
*/
|
|
93
|
+
initialTheme?: Theme;
|
|
94
|
+
/** URL prefix for all routes (from createRouter({ basename })). */
|
|
95
|
+
basename?: string;
|
|
96
|
+
/** Whether connection warmup is enabled */
|
|
97
|
+
warmupEnabled?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the client should hydrate inside React.StrictMode. Carried on the
|
|
100
|
+
* initial full-render payload only; the browser entry reads it once at
|
|
101
|
+
* hydration. Defaults to true on the client when omitted.
|
|
102
|
+
*/
|
|
103
|
+
strictMode?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Server-side redirect with optional state (for partial requests).
|
|
106
|
+
* `external: true` (from redirect(url, { external: true })) tells the client
|
|
107
|
+
* to hard-navigate to an off-host target instead of validating same-origin.
|
|
108
|
+
*/
|
|
109
|
+
redirect?: {
|
|
110
|
+
url: string;
|
|
111
|
+
external?: boolean;
|
|
112
|
+
};
|
|
113
|
+
/** Server-set location state to include in history.pushState */
|
|
114
|
+
locationState?: Record<string, unknown>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Result from server action execution
|
|
118
|
+
*
|
|
119
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
120
|
+
*/
|
|
121
|
+
export interface ActionResult {
|
|
122
|
+
ok: boolean;
|
|
123
|
+
data: unknown;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Location object representing current URL
|
|
127
|
+
* Uses URL for full URL parsing (origin, host, hostname, port, protocol, searchParams, etc.)
|
|
128
|
+
*/
|
|
129
|
+
export type NavigationLocation = URL;
|
|
130
|
+
/**
|
|
131
|
+
* Inflight server action being tracked
|
|
132
|
+
*
|
|
133
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
134
|
+
*/
|
|
135
|
+
export interface InflightAction {
|
|
136
|
+
/** Unique identifier for this action invocation */
|
|
137
|
+
id: string;
|
|
138
|
+
/** Server action function ID */
|
|
139
|
+
actionId: string;
|
|
140
|
+
/** Action arguments */
|
|
141
|
+
payload: unknown[];
|
|
142
|
+
/** Timestamp when action started */
|
|
143
|
+
startedAt: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Internal navigation state (includes inflight actions for store use)
|
|
147
|
+
*
|
|
148
|
+
* @internal This type is an implementation detail. Use PublicNavigationState instead.
|
|
149
|
+
*/
|
|
150
|
+
export interface NavigationState {
|
|
151
|
+
/** Navigation lifecycle state (idle or loading during navigation) */
|
|
152
|
+
state: "idle" | "loading";
|
|
153
|
+
/** Whether RSC data is currently streaming (initial load or navigation) */
|
|
154
|
+
isStreaming: boolean;
|
|
155
|
+
/** Current location */
|
|
156
|
+
location: NavigationLocation;
|
|
157
|
+
/** URL being navigated to (null when idle) */
|
|
158
|
+
pendingUrl: string | null;
|
|
159
|
+
/** List of inflight server actions (internal use only) */
|
|
160
|
+
inflightActions: InflightAction[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Public navigation state exposed via useNavigation hook
|
|
164
|
+
* Excludes internal properties like inflightActions
|
|
165
|
+
*/
|
|
166
|
+
export type PublicNavigationState = Omit<NavigationState, "inflightActions">;
|
|
167
|
+
/**
|
|
168
|
+
* Action lifecycle state
|
|
169
|
+
*/
|
|
170
|
+
export type ActionLifecycleState = "idle" | "loading" | "streaming";
|
|
171
|
+
/**
|
|
172
|
+
* State for a tracked server action
|
|
173
|
+
* Used by useAction hook to observe action lifecycle
|
|
174
|
+
*
|
|
175
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
176
|
+
*/
|
|
177
|
+
export interface TrackedActionState {
|
|
178
|
+
/** Current lifecycle state of the action */
|
|
179
|
+
state: ActionLifecycleState;
|
|
180
|
+
/** Server action function ID (e.g., "addToCart") */
|
|
181
|
+
actionId: string | null;
|
|
182
|
+
/** Action arguments (array for JSON, FormData for form submissions) */
|
|
183
|
+
payload: unknown[] | FormData | null;
|
|
184
|
+
/** Error if action failed */
|
|
185
|
+
error: unknown | null;
|
|
186
|
+
/** Result data from the action (preserved after completion) */
|
|
187
|
+
result: unknown | null;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The value returned by {@link useAction} when called without a selector.
|
|
191
|
+
*
|
|
192
|
+
* This is the stable, public name for the action-state shape; consumers can
|
|
193
|
+
* name it in their own signatures (e.g. a wrapper hook). It aliases the
|
|
194
|
+
* internal {@link TrackedActionState}.
|
|
195
|
+
*/
|
|
196
|
+
export type ActionState = TrackedActionState;
|
|
197
|
+
/**
|
|
198
|
+
* Listener for action state changes
|
|
199
|
+
*
|
|
200
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
201
|
+
*/
|
|
202
|
+
export type ActionStateListener = (state: TrackedActionState) => void;
|
|
203
|
+
/**
|
|
204
|
+
* Cache interface for storing segments
|
|
205
|
+
* Compatible with Map
|
|
206
|
+
*
|
|
207
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
208
|
+
*/
|
|
209
|
+
export interface SegmentCache {
|
|
210
|
+
get(key: string): ResolvedSegment | undefined;
|
|
211
|
+
set(key: string, value: ResolvedSegment): void;
|
|
212
|
+
has(key: string): boolean;
|
|
213
|
+
delete(key: string): boolean;
|
|
214
|
+
keys(): IterableIterator<string>;
|
|
215
|
+
readonly size: number;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Internal segment state managed by the store
|
|
219
|
+
*
|
|
220
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
221
|
+
*/
|
|
222
|
+
export interface SegmentState {
|
|
223
|
+
path: string;
|
|
224
|
+
currentUrl: string;
|
|
225
|
+
currentSegmentIds: string[];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Navigation update emitted when UI should re-render
|
|
229
|
+
*
|
|
230
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
231
|
+
*/
|
|
232
|
+
export interface NavigationUpdate {
|
|
233
|
+
root: ReactNode | Promise<ReactNode>;
|
|
234
|
+
metadata: RscMetadata;
|
|
235
|
+
/** Scroll behavior to apply after React commits this update */
|
|
236
|
+
scroll?: {
|
|
237
|
+
/** For back/forward: restore saved position */
|
|
238
|
+
restore?: boolean;
|
|
239
|
+
/** Set to false to disable scrolling entirely */
|
|
240
|
+
enabled?: boolean;
|
|
241
|
+
/** Function to check if streaming is in progress */
|
|
242
|
+
isStreaming?: () => boolean;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* State value for navigate/Link
|
|
247
|
+
* - LocationStateEntry[]: Type-safe state entries (recommended)
|
|
248
|
+
* - unknown: Plain state format (object or getter function)
|
|
249
|
+
*/
|
|
250
|
+
export type HistoryState = import("./react/location-state-shared.js").LocationStateEntry[] | unknown;
|
|
251
|
+
/**
|
|
252
|
+
* Options for navigation operations
|
|
253
|
+
*/
|
|
254
|
+
export interface NavigateOptions {
|
|
255
|
+
replace?: boolean;
|
|
256
|
+
scroll?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Whether to revalidate server data on navigation.
|
|
259
|
+
* Set to `false` to skip the RSC server fetch and only update the URL.
|
|
260
|
+
*
|
|
261
|
+
* Only takes effect when the pathname stays the same (search param / hash changes).
|
|
262
|
+
* If the pathname changes, this option is ignored and a full navigation occurs.
|
|
263
|
+
*
|
|
264
|
+
* All location-aware hooks (`useSearchParams`, `useNavigation`, etc.) still update.
|
|
265
|
+
* Server components do not re-render.
|
|
266
|
+
*
|
|
267
|
+
* @default true
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```tsx
|
|
271
|
+
* router.push("/products?color=blue", { revalidate: false });
|
|
272
|
+
* router.replace("/products?page=3", { revalidate: false });
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
revalidate?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* State to pass to history.pushState/replaceState
|
|
278
|
+
* Accessible via useLocationState() hook.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```tsx
|
|
282
|
+
* // Type-safe state (recommended)
|
|
283
|
+
* const ProductState = createLocationState<{ name: string }>();
|
|
284
|
+
* navigate("/product/123", { state: [ProductState({ name: "Widget" })] });
|
|
285
|
+
*
|
|
286
|
+
* // Type-safe just-in-time state (getter called at navigation time)
|
|
287
|
+
* navigate("/product/123", {
|
|
288
|
+
* state: [ProductState(() => ({ name: computeName() }))],
|
|
289
|
+
* });
|
|
290
|
+
*
|
|
291
|
+
* // Multiple states
|
|
292
|
+
* navigate("/checkout", { state: [ProductState(p), CartState(c)] });
|
|
293
|
+
*
|
|
294
|
+
* // Plain static state
|
|
295
|
+
* navigate("/product", { state: { from: "list" } });
|
|
296
|
+
*
|
|
297
|
+
* // Plain just-in-time state
|
|
298
|
+
* navigate("/product", { state: () => ({ from: window.location.pathname }) });
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
state?: HistoryState;
|
|
302
|
+
}
|
|
303
|
+
/** @internal Extended options used only within the navigation bridge */
|
|
304
|
+
export interface NavigateOptionsInternal extends NavigateOptions {
|
|
305
|
+
/** Skip segment cache (used by redirect-with-state to force re-render) */
|
|
306
|
+
_skipCache?: boolean;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Options for useRouter push/replace methods.
|
|
310
|
+
* Same as NavigateOptions but without `replace` (implicit in push vs replace).
|
|
311
|
+
*/
|
|
312
|
+
export type RouterNavigateOptions = Omit<NavigateOptions, "replace">;
|
|
313
|
+
/**
|
|
314
|
+
* Router instance returned by useRouter hook.
|
|
315
|
+
* Provides stable action methods that never cause re-renders.
|
|
316
|
+
*/
|
|
317
|
+
export interface RouterInstance {
|
|
318
|
+
/** Navigate to a URL, pushing a new entry to the history stack */
|
|
319
|
+
push(url: string, options?: RouterNavigateOptions): Promise<void>;
|
|
320
|
+
/** Navigate to a URL, replacing the current history entry */
|
|
321
|
+
replace(url: string, options?: RouterNavigateOptions): Promise<void>;
|
|
322
|
+
/** Refresh the current route (re-fetch server data, preserve client state) */
|
|
323
|
+
refresh(): Promise<void>;
|
|
324
|
+
/**
|
|
325
|
+
* Prefetch a URL for faster client-side transition.
|
|
326
|
+
*
|
|
327
|
+
* Pass `{ key: ":source" }` to source-scope the prefetch cache entry (parity
|
|
328
|
+
* with `<Link prefetchKey=":source">`) when the target's response can differ
|
|
329
|
+
* by source page.
|
|
330
|
+
*/
|
|
331
|
+
prefetch(url: string, options?: {
|
|
332
|
+
key?: ":source";
|
|
333
|
+
}): void;
|
|
334
|
+
/** Go back in browser history */
|
|
335
|
+
back(): void;
|
|
336
|
+
/** Go forward in browser history */
|
|
337
|
+
forward(): void;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* URLSearchParams without mutation methods.
|
|
341
|
+
* Matches Next.js convention for useSearchParams return type.
|
|
342
|
+
*/
|
|
343
|
+
export type ReadonlyURLSearchParams = Omit<URLSearchParams, "append" | "delete" | "set" | "sort">;
|
|
344
|
+
/**
|
|
345
|
+
* RSC runtime functions from @vitejs/plugin-rsc/browser
|
|
346
|
+
*
|
|
347
|
+
* These are injected as dependencies to avoid direct coupling
|
|
348
|
+
* to the RSC runtime implementation.
|
|
349
|
+
*/
|
|
350
|
+
export interface RscBrowserDependencies {
|
|
351
|
+
createFromFetch: <T>(response: Promise<Response>, options?: {
|
|
352
|
+
temporaryReferences?: any;
|
|
353
|
+
findSourceMapURL?: (filename: string, environmentName: string) => string | null;
|
|
354
|
+
}) => Promise<T>;
|
|
355
|
+
createFromReadableStream: <T>(stream: ReadableStream) => Promise<T>;
|
|
356
|
+
encodeReply: (args: any[], options?: {
|
|
357
|
+
temporaryReferences?: any;
|
|
358
|
+
}) => Promise<FormData | string>;
|
|
359
|
+
setServerCallback: (callback: (id: string, args: any[]) => Promise<any>) => void;
|
|
360
|
+
createTemporaryReferenceSet: () => any;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Update subscriber callback for UI updates
|
|
364
|
+
*/
|
|
365
|
+
export type UpdateSubscriber = (update: NavigationUpdate) => void;
|
|
366
|
+
/**
|
|
367
|
+
* State change listener for useNavigation hook subscriptions
|
|
368
|
+
*/
|
|
369
|
+
export type StateListener = () => void;
|
|
370
|
+
/**
|
|
371
|
+
* Navigation store interface
|
|
372
|
+
*
|
|
373
|
+
* Manages both:
|
|
374
|
+
* - NavigationState: Public state exposed via useNavigation hook
|
|
375
|
+
* - SegmentState: Internal segment management for partial updates
|
|
376
|
+
*/
|
|
377
|
+
export interface NavigationStore {
|
|
378
|
+
getState(): NavigationState;
|
|
379
|
+
setState(partial: Partial<NavigationState>): void;
|
|
380
|
+
subscribe(listener: StateListener): () => void;
|
|
381
|
+
addInflightAction(action: InflightAction): void;
|
|
382
|
+
removeInflightAction(id: string): void;
|
|
383
|
+
isActionInProgress(): boolean;
|
|
384
|
+
setActionInProgress(value: boolean): void;
|
|
385
|
+
getSegmentState(): SegmentState;
|
|
386
|
+
setPath(path: string): void;
|
|
387
|
+
setCurrentUrl(url: string): void;
|
|
388
|
+
setSegmentIds(ids: string[]): void;
|
|
389
|
+
getHistoryKey(): string;
|
|
390
|
+
setHistoryKey(key: string): void;
|
|
391
|
+
/** Monotonic token of the most recently committed navigation. */
|
|
392
|
+
getNavInstance(): number;
|
|
393
|
+
/** Nav-instance token recorded on a cache entry (undefined if absent). */
|
|
394
|
+
getCacheEntryInstance(historyKey: string): number | undefined;
|
|
395
|
+
cacheSegmentsForHistory(historyKey: string, segments: ResolvedSegment[], handleData?: HandleData): void;
|
|
396
|
+
getCachedSegments(historyKey: string): {
|
|
397
|
+
segments: ResolvedSegment[];
|
|
398
|
+
stale: boolean;
|
|
399
|
+
handleData?: HandleData;
|
|
400
|
+
routerId?: string;
|
|
401
|
+
/**
|
|
402
|
+
* True when the entry's handle data is incomplete (a deferred Meta was
|
|
403
|
+
* still pending at navigate-away). A popstate return must revalidate with
|
|
404
|
+
* a FULL re-render so the server re-streams handles.
|
|
405
|
+
*/
|
|
406
|
+
handlesPending?: boolean;
|
|
407
|
+
} | undefined;
|
|
408
|
+
hasHistoryCache(historyKey: string): boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Update only the handleData (and optionally the stale / handlesPending flags)
|
|
411
|
+
* of an existing cache entry. When a flag is omitted the entry's current value
|
|
412
|
+
* is preserved. `stale=true` marks a single entry stale so a popstate return
|
|
413
|
+
* revalidates it; `handlesPending=true` additionally forces that revalidation
|
|
414
|
+
* to be a full re-render (so a deferred Meta re-streams).
|
|
415
|
+
*/
|
|
416
|
+
updateCacheHandleData(historyKey: string, handleData: HandleData, stale?: boolean, handlesPending?: boolean): void;
|
|
417
|
+
/**
|
|
418
|
+
* Owner-guarded variant of updateCacheHandleData: writes only when the entry
|
|
419
|
+
* is still owned by `ownerInstance`. Folds the caller's separate ownership
|
|
420
|
+
* probe and write into one historyCache scan for the per-yield streaming path.
|
|
421
|
+
*/
|
|
422
|
+
updateCacheHandleDataIfOwned(historyKey: string, handleData: HandleData, ownerInstance: number, stale?: boolean, handlesPending?: boolean): void;
|
|
423
|
+
markCacheAsStale(): void;
|
|
424
|
+
markHistoryCacheStale(): void;
|
|
425
|
+
markCacheAsStaleAndBroadcast(): void;
|
|
426
|
+
clearHistoryCache(): void;
|
|
427
|
+
setCrossTabRefreshCallback(callback: () => void): void;
|
|
428
|
+
getInterceptSourceUrl(): string | null;
|
|
429
|
+
setInterceptSourceUrl(url: string | null): void;
|
|
430
|
+
getRouterId?(): string | undefined;
|
|
431
|
+
setRouterId?(id: string): void;
|
|
432
|
+
onUpdate(callback: UpdateSubscriber): () => void;
|
|
433
|
+
emitUpdate(update: NavigationUpdate): void;
|
|
434
|
+
getActionState(actionId: string): TrackedActionState;
|
|
435
|
+
setActionState(actionId: string, state: Partial<TrackedActionState>): void;
|
|
436
|
+
subscribeToAction(actionId: string, listener: ActionStateListener): () => void;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Options for partial navigation fetch
|
|
440
|
+
*/
|
|
441
|
+
export interface FetchPartialOptions {
|
|
442
|
+
targetUrl: string;
|
|
443
|
+
segmentIds: string[];
|
|
444
|
+
previousUrl: string;
|
|
445
|
+
signal?: AbortSignal;
|
|
446
|
+
/** If true, this is a stale cache revalidation request - server should force revalidators */
|
|
447
|
+
staleRevalidation?: boolean;
|
|
448
|
+
interceptSourceUrl?: string;
|
|
449
|
+
/** RSC version for cache invalidation detection */
|
|
450
|
+
version?: string;
|
|
451
|
+
/** Current router ID — server detects app switch and returns full response */
|
|
452
|
+
routerId?: string;
|
|
453
|
+
/** If true, this is an HMR refetch - server should invalidate manifest cache */
|
|
454
|
+
hmr?: boolean;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Result of a partial fetch including stream completion tracking
|
|
458
|
+
*/
|
|
459
|
+
export interface FetchPartialResult {
|
|
460
|
+
payload: RscPayload;
|
|
461
|
+
/** Promise that resolves when the response stream is fully consumed */
|
|
462
|
+
streamComplete: Promise<void>;
|
|
463
|
+
/**
|
|
464
|
+
* True only when this payload came from a prefetch-cache hit whose stream had
|
|
465
|
+
* ALREADY fully drained at fetch time (the route was fully prefetched). The
|
|
466
|
+
* commit then runs in a startTransition so loading()/Suspense content — already
|
|
467
|
+
* resolved — swaps in directly without flashing a fallback. A partially-warmed
|
|
468
|
+
* (still-streaming) prefetch hit and a cold fetch leave this false so their
|
|
469
|
+
* fallbacks stream as usual.
|
|
470
|
+
*/
|
|
471
|
+
fullyPrefetched?: boolean;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Navigation client for fetching RSC payloads
|
|
475
|
+
*/
|
|
476
|
+
export interface NavigationClient {
|
|
477
|
+
fetchPartial(options: FetchPartialOptions): Promise<FetchPartialResult>;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Options for link interception
|
|
481
|
+
*/
|
|
482
|
+
export interface LinkInterceptorOptions {
|
|
483
|
+
shouldIntercept?: (link: HTMLAnchorElement) => boolean;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Server action bridge for handling server actions
|
|
487
|
+
*/
|
|
488
|
+
export interface ServerActionBridge {
|
|
489
|
+
register(): void;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Configuration for server action bridge
|
|
493
|
+
*/
|
|
494
|
+
export interface ServerActionBridgeConfig {
|
|
495
|
+
store: NavigationStore;
|
|
496
|
+
client: NavigationClient;
|
|
497
|
+
deps: RscBrowserDependencies;
|
|
498
|
+
onUpdate: UpdateSubscriber;
|
|
499
|
+
renderSegments: (segments: ResolvedSegment[], options?: RenderSegmentsOptions) => Promise<ReactNode> | ReactNode;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Navigation bridge for handling client-side navigation
|
|
503
|
+
*/
|
|
504
|
+
export interface NavigationBridge {
|
|
505
|
+
navigate(url: string, options?: NavigateOptions): Promise<void>;
|
|
506
|
+
refresh(): Promise<void>;
|
|
507
|
+
handlePopstate(): Promise<void>;
|
|
508
|
+
registerLinkInterception(): () => void;
|
|
509
|
+
/** Current RSC version (live, reflects the latest updateVersion). */
|
|
510
|
+
getVersion(): string | undefined;
|
|
511
|
+
/** Update the RSC version (e.g. after HMR). Clears prefetch cache. */
|
|
512
|
+
updateVersion(newVersion: string): void;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Configuration for navigation bridge
|
|
516
|
+
*/
|
|
517
|
+
export interface NavigationBridgeConfig {
|
|
518
|
+
store: NavigationStore;
|
|
519
|
+
client: NavigationClient;
|
|
520
|
+
onUpdate: UpdateSubscriber;
|
|
521
|
+
renderSegments: (segments: ResolvedSegment[], options?: RenderSegmentsOptions) => Promise<ReactNode> | ReactNode;
|
|
522
|
+
}
|
|
523
|
+
export type { ResolvedSegment };
|
|
524
|
+
/**
|
|
525
|
+
* Token for tracking an active stream.
|
|
526
|
+
* Call end() when the stream completes.
|
|
527
|
+
*/
|
|
528
|
+
export interface StreamingToken {
|
|
529
|
+
end(): void;
|
|
530
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate that a client-consumed redirect URL (from headers or Flight payload)
|
|
3
|
+
* targets the same origin as the current page. Prevents open-redirect attacks
|
|
4
|
+
* via crafted responses.
|
|
5
|
+
*
|
|
6
|
+
* Thin wrapper over the shared {@link resolveSameOriginRedirect} rule (also used
|
|
7
|
+
* by the server guard in `rsc/redirect-guard.ts`) so client and server enforce
|
|
8
|
+
* the identical same-origin contract. Adds the client-side `console.error` on a
|
|
9
|
+
* block; the resolver itself stays pure.
|
|
10
|
+
*
|
|
11
|
+
* @returns The canonical (normalized) URL string on success, or null if blocked.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateRedirectOrigin(url: string, currentOrigin: string): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Validate an explicit off-origin redirect (`redirect(url, { external: true })`)
|
|
16
|
+
* the client is about to hard-navigate to via `window.location.assign()`.
|
|
17
|
+
*
|
|
18
|
+
* Thin wrapper over the shared {@link resolveExternalRedirect} rule (also used by
|
|
19
|
+
* the server guard in `rsc/redirect-guard.ts`) so client and server enforce the
|
|
20
|
+
* identical contract: `external` allows an off-origin target but only an
|
|
21
|
+
* http(s) scheme. This stops a forged or mistaken external payload carrying a
|
|
22
|
+
* `javascript:`/`data:` URL from turning `location.assign` into a scriptable
|
|
23
|
+
* navigation. Adds the client-side `console.error` on a block; the resolver
|
|
24
|
+
* itself stays pure.
|
|
25
|
+
*
|
|
26
|
+
* @returns The normalized URL string on success, or null if blocked.
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateExternalRedirect(url: string, currentOrigin: string): string | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report every `"use client"` client-reference key reachable from a single
|
|
3
|
+
* error/notFound boundary registration (handler function or element tree).
|
|
4
|
+
*/
|
|
5
|
+
export declare function collectFallbackClientRefs(boundary: unknown, report: (refKey: string) => void): void;
|