@rangojs/router 0.1.1 → 0.4.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 +2 -1
- package/dist/types/browser/prefetch/default-strategy.d.ts +22 -0
- package/dist/types/browser/prefetch/runtime.d.ts +0 -1
- package/dist/types/browser/react/Link.d.ts +8 -11
- package/dist/types/browser/types.d.ts +5 -0
- package/dist/types/cache/document-cache.d.ts +3 -1
- package/dist/types/cache/types.d.ts +10 -3
- package/dist/types/route-definition/helpers-types.d.ts +6 -6
- package/dist/types/router/match-handlers.d.ts +2 -3
- package/dist/types/router/prefetch-default.d.ts +28 -0
- package/dist/types/router/router-interfaces.d.ts +7 -0
- package/dist/types/router/router-options.d.ts +30 -0
- package/dist/types/router/segment-resolution/view-transition-default.d.ts +3 -4
- package/dist/types/router/transition-when.d.ts +13 -0
- package/dist/types/rsc/capture-queue.d.ts +6 -0
- package/dist/types/rsc/shell-capture.d.ts +15 -7
- package/dist/types/rsc/shell-serve.d.ts +6 -3
- package/dist/types/rsc/transition-gate.d.ts +10 -14
- package/dist/types/rsc/types.d.ts +2 -0
- package/dist/types/server/request-context.d.ts +5 -1
- package/dist/types/testing/e2e/index.d.ts +3 -3
- package/dist/types/testing/e2e/page-helpers.d.ts +24 -0
- package/dist/types/testing/index.d.ts +2 -2
- package/dist/types/testing/run-transition-when.d.ts +6 -5
- package/dist/types/testing/shell-status.d.ts +23 -3
- package/dist/types/types/segments.d.ts +27 -22
- package/dist/types/urls/path-helper-types.d.ts +4 -3
- 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 +5 -2
- package/package.json +20 -21
- package/skills/cache-guide/SKILL.md +6 -3
- package/skills/catalog.json +7 -1
- package/skills/comparison/references/framework-comparison.md +2 -1
- package/skills/deployment-caching/SKILL.md +176 -0
- package/skills/document-cache/SKILL.md +30 -3
- package/skills/ppr/SKILL.md +81 -34
- package/skills/prerender/SKILL.md +15 -8
- package/skills/rango/SKILL.md +20 -17
- package/skills/router-setup/SKILL.md +4 -0
- package/skills/testing/SKILL.md +1 -1
- package/skills/testing/cache-prerender.md +5 -1
- package/skills/vercel/SKILL.md +22 -1
- package/skills/view-transitions/SKILL.md +12 -8
- package/src/browser/prefetch/default-strategy.ts +34 -0
- package/src/browser/prefetch/loader.ts +6 -12
- package/src/browser/prefetch/runtime.ts +0 -1
- package/src/browser/react/Link.tsx +22 -21
- package/src/browser/rsc-router.tsx +8 -0
- package/src/browser/types.ts +5 -0
- package/src/cache/cache-scope.ts +6 -1
- package/src/cache/cf/cf-cache-store.ts +4 -0
- package/src/cache/document-cache.ts +4 -2
- package/src/cache/types.ts +10 -3
- package/src/cache/vercel/vercel-cache-store.ts +6 -1
- package/src/route-definition/helpers-types.ts +6 -6
- package/src/router/match-handlers.ts +44 -6
- package/src/router/match-middleware/cache-lookup.ts +10 -3
- package/src/router/prefetch-default.ts +59 -0
- package/src/router/router-interfaces.ts +8 -0
- package/src/router/router-options.ts +31 -0
- package/src/router/segment-resolution/view-transition-default.ts +9 -5
- package/src/router/transition-when.ts +76 -0
- package/src/router.ts +7 -0
- package/src/rsc/capture-queue.ts +24 -1
- package/src/rsc/full-payload.ts +1 -0
- package/src/rsc/handler.ts +1 -0
- package/src/rsc/progressive-enhancement.ts +9 -14
- package/src/rsc/rsc-rendering.ts +261 -48
- package/src/rsc/shell-capture.ts +94 -50
- package/src/rsc/shell-serve.ts +9 -4
- package/src/rsc/transition-gate.ts +37 -40
- package/src/rsc/types.ts +2 -0
- package/src/server/request-context.ts +6 -0
- package/src/testing/e2e/index.ts +11 -0
- package/src/testing/e2e/page-helpers.ts +47 -0
- package/src/testing/e2e/parity.ts +13 -0
- package/src/testing/index.ts +9 -1
- package/src/testing/run-transition-when.ts +42 -9
- package/src/testing/shell-status.ts +92 -3
- package/src/types/segments.ts +27 -22
- package/src/urls/path-helper-types.ts +4 -3
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for route system items
|
|
3
|
+
* These are extracted separately to avoid circular dependencies
|
|
4
|
+
* and to prevent bundling server-only code in client bundles
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Brand for UrlPatterns nominal typing (see pattern-types.ts). The route-item
|
|
8
|
+
* types below are discriminated by their `type` literal, so they carry no brand.
|
|
9
|
+
*/
|
|
10
|
+
export declare const UrlPatternsBrand: unique symbol;
|
|
11
|
+
export type LayoutItem = {
|
|
12
|
+
name: string;
|
|
13
|
+
type: "layout";
|
|
14
|
+
uses?: AllUseItems[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Phantom inference fields attached to wrapper items (layout/cache/transition)
|
|
18
|
+
* so the urls() type extractor can read their child routes/responses. The fields
|
|
19
|
+
* never exist at runtime.
|
|
20
|
+
*/
|
|
21
|
+
type WithChildren<TBase, TChildRoutes extends Record<string, any> = Record<string, string>, TChildResponses extends Record<string, unknown> = Record<string, unknown>> = TBase & {
|
|
22
|
+
readonly __childRoutes?: TChildRoutes;
|
|
23
|
+
readonly __childResponses?: TChildResponses;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Typed layout item that carries child routes as phantom type
|
|
27
|
+
* Used for type inference in urls() API
|
|
28
|
+
*/
|
|
29
|
+
export type TypedLayoutItem<TChildRoutes extends Record<string, any> = Record<string, string>, TChildResponses extends Record<string, unknown> = Record<string, unknown>> = WithChildren<LayoutItem, TChildRoutes, TChildResponses>;
|
|
30
|
+
export type RouteItem = {
|
|
31
|
+
name: string;
|
|
32
|
+
type: "route";
|
|
33
|
+
uses?: AllUseItems[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Typed route item that carries route name and pattern as phantom types
|
|
37
|
+
* Used for type inference in urls() API
|
|
38
|
+
*/
|
|
39
|
+
export type TypedRouteItem<TName extends string = string, TPattern extends string = string, TData = unknown, TSearch = {}> = RouteItem & {
|
|
40
|
+
readonly __name?: TName;
|
|
41
|
+
readonly __pattern?: TPattern;
|
|
42
|
+
readonly __data?: TData;
|
|
43
|
+
readonly __search?: TSearch;
|
|
44
|
+
};
|
|
45
|
+
export type ParallelItem = {
|
|
46
|
+
name: string;
|
|
47
|
+
type: "parallel";
|
|
48
|
+
uses?: ParallelUseItem[];
|
|
49
|
+
};
|
|
50
|
+
export type InterceptItem = {
|
|
51
|
+
name: string;
|
|
52
|
+
type: "intercept";
|
|
53
|
+
uses?: InterceptUseItem[];
|
|
54
|
+
};
|
|
55
|
+
export type LoaderItem = {
|
|
56
|
+
name: string;
|
|
57
|
+
type: "loader";
|
|
58
|
+
uses?: LoaderUseItem[];
|
|
59
|
+
};
|
|
60
|
+
export type MiddlewareItem = {
|
|
61
|
+
name: string;
|
|
62
|
+
type: "middleware";
|
|
63
|
+
uses?: AllUseItems[];
|
|
64
|
+
};
|
|
65
|
+
export type RevalidateItem = {
|
|
66
|
+
name: string;
|
|
67
|
+
type: "revalidate";
|
|
68
|
+
uses?: AllUseItems[];
|
|
69
|
+
};
|
|
70
|
+
export type LoadingItem = {
|
|
71
|
+
name: string;
|
|
72
|
+
type: "loading";
|
|
73
|
+
};
|
|
74
|
+
export type ErrorBoundaryItem = {
|
|
75
|
+
name: string;
|
|
76
|
+
type: "errorBoundary";
|
|
77
|
+
uses?: AllUseItems[];
|
|
78
|
+
};
|
|
79
|
+
export type NotFoundBoundaryItem = {
|
|
80
|
+
name: string;
|
|
81
|
+
type: "notFoundBoundary";
|
|
82
|
+
uses?: AllUseItems[];
|
|
83
|
+
};
|
|
84
|
+
export type CacheItem = {
|
|
85
|
+
name: string;
|
|
86
|
+
type: "cache";
|
|
87
|
+
uses?: AllUseItems[];
|
|
88
|
+
};
|
|
89
|
+
export type TransitionItem = {
|
|
90
|
+
name: string;
|
|
91
|
+
type: "transition";
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Typed transition item that carries child routes as phantom type
|
|
95
|
+
* Used for type inference when transition() wraps child routes
|
|
96
|
+
*/
|
|
97
|
+
export type TypedTransitionItem<TChildRoutes extends Record<string, any> = Record<string, string>, TChildResponses extends Record<string, unknown> = Record<string, unknown>> = WithChildren<TransitionItem, TChildRoutes, TChildResponses>;
|
|
98
|
+
/**
|
|
99
|
+
* Typed cache item that carries child routes as phantom type
|
|
100
|
+
* Used for type inference in urls() API
|
|
101
|
+
*/
|
|
102
|
+
export type TypedCacheItem<TChildRoutes extends Record<string, any> = Record<string, string>, TChildResponses extends Record<string, unknown> = Record<string, unknown>> = WithChildren<CacheItem, TChildRoutes, TChildResponses>;
|
|
103
|
+
/**
|
|
104
|
+
* Include item for URL pattern composition (used by urls() API)
|
|
105
|
+
*/
|
|
106
|
+
export type IncludeItem = {
|
|
107
|
+
type: "include";
|
|
108
|
+
name: string;
|
|
109
|
+
prefix: string;
|
|
110
|
+
patterns: unknown;
|
|
111
|
+
options?: {
|
|
112
|
+
name?: string;
|
|
113
|
+
lazy?: boolean;
|
|
114
|
+
};
|
|
115
|
+
/** Whether this include should be lazily evaluated on first request */
|
|
116
|
+
lazy?: boolean;
|
|
117
|
+
/** Captured context for deferred lazy evaluation */
|
|
118
|
+
_lazyContext?: {
|
|
119
|
+
urlPrefix: string;
|
|
120
|
+
namePrefix: string | undefined;
|
|
121
|
+
parent: unknown;
|
|
122
|
+
/** Counter snapshot from pattern extraction for consistent shortCode indices */
|
|
123
|
+
counters?: Record<string, number>;
|
|
124
|
+
/** Cache profiles for DSL-time cache("profileName") resolution */
|
|
125
|
+
cacheProfiles?: Record<string, import("./cache/profile-registry.js").CacheProfile>;
|
|
126
|
+
/** Root scope flag for dot-local reverse resolution */
|
|
127
|
+
rootScoped?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Positional include scope token composed from the parent scope plus this
|
|
130
|
+
* include's sibling index (`${parentScope}I${idx}`). Applied to direct-
|
|
131
|
+
* descendant shortCodes during lazy evaluation so routes inside the
|
|
132
|
+
* include cannot collide with siblings declared outside it.
|
|
133
|
+
*/
|
|
134
|
+
includeScope?: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Typed include item that carries nested routes as phantom type
|
|
139
|
+
* Used for type inference in urls() API
|
|
140
|
+
*/
|
|
141
|
+
export type TypedIncludeItem<TRoutes extends Record<string, any> = Record<string, string>, TNamePrefix extends string = string, TUrlPrefix extends string = string, TResponses extends Record<string, unknown> = Record<string, unknown>> = IncludeItem & {
|
|
142
|
+
readonly __routes?: TRoutes;
|
|
143
|
+
readonly __namePrefix?: TNamePrefix;
|
|
144
|
+
readonly __urlPrefix?: TUrlPrefix;
|
|
145
|
+
readonly __responses?: TResponses;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Union types for use() callbacks
|
|
149
|
+
*/
|
|
150
|
+
export type AllUseItems = LayoutItem | RouteItem | MiddlewareItem | RevalidateItem | ParallelItem | InterceptItem | LoaderItem | LoadingItem | ErrorBoundaryItem | NotFoundBoundaryItem | CacheItem | TransitionItem | IncludeItem;
|
|
151
|
+
/** Items that can be used inside a layout callback */
|
|
152
|
+
export type LayoutUseItem = AllUseItems;
|
|
153
|
+
export type RouteUseItem = LayoutItem | ParallelItem | InterceptItem | MiddlewareItem | RevalidateItem | LoaderItem | LoadingItem | ErrorBoundaryItem | NotFoundBoundaryItem | CacheItem | TransitionItem;
|
|
154
|
+
/** Items that can be used inside a response route (path.json(), etc.) */
|
|
155
|
+
export type ResponseRouteUseItem = MiddlewareItem | CacheItem;
|
|
156
|
+
export type ParallelUseItem = RevalidateItem | LoaderItem | LoadingItem | ErrorBoundaryItem | NotFoundBoundaryItem | TransitionItem;
|
|
157
|
+
export type InterceptUseItem = MiddlewareItem | RevalidateItem | LoaderItem | LoadingItem | ErrorBoundaryItem | NotFoundBoundaryItem | LayoutItem | RouteItem | TransitionItem;
|
|
158
|
+
export type LoaderUseItem = RevalidateItem | CacheItem;
|
|
159
|
+
/**
|
|
160
|
+
* Allow composition factories in use() callbacks.
|
|
161
|
+
* Factories return T[], which placed inside a use() callback array
|
|
162
|
+
* creates nested arrays like (T | T[])[]. These are flattened at
|
|
163
|
+
* runtime via .flat(3).
|
|
164
|
+
*/
|
|
165
|
+
export type UseItems<T> = (T | readonly T[])[];
|
|
166
|
+
/**
|
|
167
|
+
* Union of all items that handler.use() may return.
|
|
168
|
+
* A handler doesn't know its mount site at definition time, so the type
|
|
169
|
+
* is intentionally broad — validation happens per-mount-site at runtime.
|
|
170
|
+
*/
|
|
171
|
+
export type HandlerUseItem = RouteUseItem | LayoutUseItem | ParallelUseItem | InterceptUseItem;
|
|
172
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a router basename to its canonical form: a single leading slash,
|
|
3
|
+
* no trailing slash, and `undefined` for an empty or bare-"/" value.
|
|
4
|
+
*
|
|
5
|
+
* This is the single source of truth used by both createRouter() (so the RSC
|
|
6
|
+
* handler stores a canonical basename on the request context) and the testing
|
|
7
|
+
* primitives (so a consumer can pass the same un-normalized string their
|
|
8
|
+
* createRouter() accepts and observe the same redirect() prefixing).
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeBasename(basename?: string): string | undefined;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Negotiation Utilities
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for HTTP Accept header parsing and response type matching.
|
|
5
|
+
* Used by previewMatch and classifyRequest for content negotiation between
|
|
6
|
+
* RSC routes and response routes (JSON, text, image, stream, etc.).
|
|
7
|
+
*/
|
|
8
|
+
import type { EntryData } from "../server/context.js";
|
|
9
|
+
import type { CollectedMiddleware } from "./middleware-types.js";
|
|
10
|
+
import type { RouteSnapshot } from "./route-snapshot.js";
|
|
11
|
+
export declare const RESPONSE_TYPE_MIME: Record<string, string>;
|
|
12
|
+
export declare const MIME_RESPONSE_TYPE: Record<string, string>;
|
|
13
|
+
export type NamedRouteEntry = string | {
|
|
14
|
+
path: string;
|
|
15
|
+
search?: Record<string, string>;
|
|
16
|
+
};
|
|
17
|
+
export declare function flattenNamedRoutes(routeNames?: Record<string, NamedRouteEntry>): Record<string, string>;
|
|
18
|
+
export interface AcceptEntry {
|
|
19
|
+
mime: string;
|
|
20
|
+
q: number;
|
|
21
|
+
order: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse an Accept header into a sorted array of MIME entries.
|
|
25
|
+
* Respects q-values (default 1.0) and uses client order as tiebreaker
|
|
26
|
+
* when q-values are equal (matching Express/Hono behavior).
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseAcceptTypes(accept: string): AcceptEntry[];
|
|
29
|
+
export declare const RSC_RESPONSE_TYPE = "__rsc__";
|
|
30
|
+
/** RSC wire-format MIME type; explicit-opt-in flight transport. */
|
|
31
|
+
export declare const RSC_WIRE_MIME = "text/x-component";
|
|
32
|
+
/**
|
|
33
|
+
* Rank the RSC route's two representations against a parsed Accept list:
|
|
34
|
+
* true when the flight wire format outranks the HTML document. Wildcard
|
|
35
|
+
* entries count for the HTML side — they express "anything", and the
|
|
36
|
+
* canonical representation of anything is the document. Co-located with
|
|
37
|
+
* RSC_MIMES so the candidate registration and the representation choice
|
|
38
|
+
* cannot drift.
|
|
39
|
+
*/
|
|
40
|
+
export declare function prefersFlightRepresentation(acceptEntries: AcceptEntry[]): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Pick the best negotiate variant by walking the client's sorted Accept list.
|
|
43
|
+
* For each accepted MIME type (in q-value/order priority), check if any
|
|
44
|
+
* candidate serves that type. Wildcards match the first candidate.
|
|
45
|
+
* Falls back to the first candidate if nothing matches.
|
|
46
|
+
*/
|
|
47
|
+
export declare function pickNegotiateVariant<T extends {
|
|
48
|
+
routeKey: string;
|
|
49
|
+
responseType: string;
|
|
50
|
+
}>(acceptEntries: AcceptEntry[], candidates: T[]): T;
|
|
51
|
+
/**
|
|
52
|
+
* Re-key params from the primary leaf's names to a winning variant's names.
|
|
53
|
+
*
|
|
54
|
+
* The trie match builds `params` positionally under the primary leaf's pa, so
|
|
55
|
+
* `/widgets/:id` matched as the primary yields `{ id }` even when the winning
|
|
56
|
+
* `/widgets/:file` response variant expects `{ file }`. Both share the same trie
|
|
57
|
+
* terminal, so they bind the same number of positional named params; we zip the
|
|
58
|
+
* variant's pa against the named values in insertion order (which is the
|
|
59
|
+
* primary's pa order). The wildcard key (`*`) is positional-independent and left
|
|
60
|
+
* untouched.
|
|
61
|
+
*
|
|
62
|
+
* Mutates `params` in place. No-op when `variantPa` is absent, when names already
|
|
63
|
+
* match (the common case), or when the positional count diverges (defensive:
|
|
64
|
+
* never corrupt params by zipping mismatched lengths).
|
|
65
|
+
*/
|
|
66
|
+
export declare function rekeyParamsForVariant(params: Record<string, string>, variantPa: string[] | undefined): void;
|
|
67
|
+
/**
|
|
68
|
+
* Result of content negotiation for a route with negotiate variants.
|
|
69
|
+
*/
|
|
70
|
+
export interface NegotiationResult {
|
|
71
|
+
/** The winning response type */
|
|
72
|
+
responseType: string;
|
|
73
|
+
/** Handler function for the winning variant */
|
|
74
|
+
handler: Function;
|
|
75
|
+
/** Manifest entry for the winning variant (may differ from primary) */
|
|
76
|
+
manifestEntry: EntryData;
|
|
77
|
+
/** Route middleware for the winning variant */
|
|
78
|
+
routeMiddleware: CollectedMiddleware[];
|
|
79
|
+
/** True when negotiation selected a variant; false for a plain response route. */
|
|
80
|
+
negotiated: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Perform content negotiation for a route with negotiate variants.
|
|
84
|
+
*
|
|
85
|
+
* Returns a NegotiationResult when a response route wins negotiation.
|
|
86
|
+
* Returns null when RSC wins or no negotiation is needed.
|
|
87
|
+
*
|
|
88
|
+
* Shared by previewMatch and classifyRequest to avoid duplicating
|
|
89
|
+
* the candidate-building and variant-loading logic.
|
|
90
|
+
*/
|
|
91
|
+
export declare function negotiateRoute(request: Request, pathname: string, snapshot: RouteSnapshot): Promise<NegotiationResult | null>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SerializedManifest } from "../debug.js";
|
|
2
|
+
import type { RouteEntry } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Build a serialized manifest from all route entries for debug inspection.
|
|
5
|
+
* Used by the `debugManifest()` method on the router instance.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildDebugManifest<TEnv = any>(routesEntries: RouteEntry<TEnv>[]): Promise<SerializedManifest>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Error Handling Utilities
|
|
3
|
+
*
|
|
4
|
+
* Error boundary and not-found boundary handling for Rango.
|
|
5
|
+
* Also includes the shared invokeOnError utility for error callback invocation.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
|
+
import type { EntryData } from "../server/context";
|
|
9
|
+
import type { ResolvedSegment, ErrorInfo, ErrorBoundaryHandler, NotFoundInfo, NotFoundBoundaryHandler, ErrorPhase, OnErrorCallback } from "../types";
|
|
10
|
+
/**
|
|
11
|
+
* Context required to invoke the onError callback.
|
|
12
|
+
* This is a subset of OnErrorContext that callers must provide.
|
|
13
|
+
*/
|
|
14
|
+
export interface InvokeOnErrorContext<TEnv = any> {
|
|
15
|
+
request: Request;
|
|
16
|
+
url: URL;
|
|
17
|
+
routeKey?: string;
|
|
18
|
+
params?: Record<string, string>;
|
|
19
|
+
segmentId?: string;
|
|
20
|
+
segmentType?: "layout" | "route" | "parallel" | "loader" | "middleware";
|
|
21
|
+
loaderName?: string;
|
|
22
|
+
middlewareId?: string;
|
|
23
|
+
actionId?: string;
|
|
24
|
+
env?: TEnv;
|
|
25
|
+
isPartial?: boolean;
|
|
26
|
+
handledByBoundary?: boolean;
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
/** Request start time from performance.now() for duration calculation */
|
|
29
|
+
requestStartTime?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Invoke the onError callback with comprehensive context.
|
|
33
|
+
* Catches any errors in the callback itself to prevent masking the original error.
|
|
34
|
+
*
|
|
35
|
+
* This is a shared utility used by both the router and RSC handler to ensure
|
|
36
|
+
* consistent error callback behavior across the codebase.
|
|
37
|
+
*
|
|
38
|
+
* @param onError - The onError callback to invoke (may be undefined)
|
|
39
|
+
* @param error - The error that occurred
|
|
40
|
+
* @param phase - The phase where the error occurred
|
|
41
|
+
* @param context - Additional context about the error
|
|
42
|
+
* @param logPrefix - Prefix for console.error messages (e.g., "Router" or "RSC")
|
|
43
|
+
*/
|
|
44
|
+
export declare function invokeOnError<TEnv = any>(onError: OnErrorCallback<TEnv> | undefined, error: unknown, phase: ErrorPhase, context: InvokeOnErrorContext<TEnv>, logPrefix?: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Find the nearest error boundary by walking up the entry chain
|
|
47
|
+
* Also checks sibling layouts (orphan layouts) for error boundaries
|
|
48
|
+
* Returns the first fallback found, or the default error boundary if configured
|
|
49
|
+
*/
|
|
50
|
+
export declare function findNearestErrorBoundary(entry: EntryData | null, defaultErrorBoundary?: ReactNode | ErrorBoundaryHandler): ReactNode | ErrorBoundaryHandler | null;
|
|
51
|
+
/**
|
|
52
|
+
* Find the nearest notFound boundary by walking up the entry chain
|
|
53
|
+
* Returns the first fallback found, or the default notFound boundary if configured
|
|
54
|
+
*/
|
|
55
|
+
export declare function findNearestNotFoundBoundary(entry: EntryData | null, defaultNotFoundBoundary?: ReactNode | NotFoundBoundaryHandler): ReactNode | NotFoundBoundaryHandler | null;
|
|
56
|
+
/**
|
|
57
|
+
* Create ErrorInfo from an error object
|
|
58
|
+
* Sanitizes error details in production
|
|
59
|
+
*/
|
|
60
|
+
export declare function createErrorInfo(error: unknown, segmentId: string, segmentType: ErrorInfo["segmentType"]): ErrorInfo;
|
|
61
|
+
/**
|
|
62
|
+
* Create an error segment with the fallback component
|
|
63
|
+
* Renders the fallback with error info and reset function
|
|
64
|
+
*/
|
|
65
|
+
export declare function createErrorSegment(errorInfo: ErrorInfo, fallback: ReactNode | ErrorBoundaryHandler, entry: EntryData, params: Record<string, string>): ResolvedSegment;
|
|
66
|
+
/**
|
|
67
|
+
* Create NotFoundInfo from a DataNotFoundError
|
|
68
|
+
*/
|
|
69
|
+
export declare function createNotFoundInfo(error: {
|
|
70
|
+
message: string;
|
|
71
|
+
}, segmentId: string, segmentType: NotFoundInfo["segmentType"], pathname?: string): NotFoundInfo;
|
|
72
|
+
/**
|
|
73
|
+
* Create a notFound segment with the fallback component
|
|
74
|
+
* Renders the fallback with not found info
|
|
75
|
+
*/
|
|
76
|
+
export declare function createNotFoundSegment(notFoundInfo: NotFoundInfo, fallback: ReactNode | NotFoundBoundaryHandler, entry: EntryData, params: Record<string, string>): ResolvedSegment;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type RouteMatchResult } from "./pattern-matching.js";
|
|
2
|
+
import type { MetricsStore } from "../server/context";
|
|
3
|
+
import type { RouteEntry } from "../types";
|
|
4
|
+
export interface FindMatchDeps<TEnv = any> {
|
|
5
|
+
routesEntries: RouteEntry<TEnv>[];
|
|
6
|
+
evaluateLazyEntry: (entry: RouteEntry<TEnv>) => void | Promise<void>;
|
|
7
|
+
routerId: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Create a findMatch function bound to router state.
|
|
11
|
+
* Includes single-entry cache to avoid redundant matching within the same request.
|
|
12
|
+
*
|
|
13
|
+
* Async because a lazy include may be backed by an async provider
|
|
14
|
+
* (`() => import("./routes")`) that must be resolved before its routes can be
|
|
15
|
+
* matched. The hot path is unaffected: `await` only suspends on the first
|
|
16
|
+
* request to a not-yet-loaded dynamic include; eager routes resolve in the same
|
|
17
|
+
* microtask. Every caller already runs inside an async match pipeline.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createFindMatch<TEnv = any>(deps: FindMatchDeps<TEnv>): (pathname: string, ms?: MetricsStore) => Promise<RouteMatchResult<TEnv> | null>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Handler Context
|
|
3
|
+
*
|
|
4
|
+
* Creates the handler context object passed to route handlers, middleware, and loaders.
|
|
5
|
+
*/
|
|
6
|
+
import type { InternalHandlerContext } from "../types";
|
|
7
|
+
/**
|
|
8
|
+
* Strip internal _rsc* query params from a URL.
|
|
9
|
+
* Returns a new URL with only user-facing params.
|
|
10
|
+
*/
|
|
11
|
+
export declare function stripInternalParams(url: URL): URL;
|
|
12
|
+
/**
|
|
13
|
+
* Create a reverse function for URL generation from route names.
|
|
14
|
+
* Used by both HandlerContext and MiddlewareContext.
|
|
15
|
+
*
|
|
16
|
+
* When currentParams is provided, those params are used as defaults for URL
|
|
17
|
+
* generation. This enables auto-filling mount params from include() prefixes:
|
|
18
|
+
* inner handlers can call ctx.reverse(".sibling") without explicitly passing
|
|
19
|
+
* params that are already known from the current URL match.
|
|
20
|
+
* Explicitly passed hrefParams take priority over currentParams.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createReverseFunction(routeMap: Record<string, string>, currentRoutePrefix?: string, currentParams?: Record<string, string>, rootScoped?: boolean): (name: string, hrefParams?: Record<string, string>, search?: Record<string, unknown>) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Create HandlerContext with typed env/var/get/set
|
|
25
|
+
*/
|
|
26
|
+
export declare function createHandlerContext<TEnv>(params: Record<string, string>, request: Request, searchParams: URLSearchParams, pathname: string, url: URL, bindings?: TEnv, routeMap?: Record<string, string>, routeName?: string, responseType?: string, isPassthroughRoute?: boolean): InternalHandlerContext<any, TEnv>;
|
|
27
|
+
/**
|
|
28
|
+
* Create a PrerenderContext for Prerender() handlers at build time.
|
|
29
|
+
*
|
|
30
|
+
* Returns an InternalHandlerContext where params, pathname, url, searchParams,
|
|
31
|
+
* search, reverse, and use(handle) work. Request-time properties
|
|
32
|
+
* (request, env, headers, cookies, get, set, res) throw with a clear error.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createPrerenderContext<TEnv>(params: Record<string, string>, pathname: string, routeMap: Record<string, string>, routeName?: string, buildVars?: Record<string, any>, isPassthroughRoute?: boolean, buildEnv?: TEnv, devMode?: boolean): InternalHandlerContext<any, TEnv>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a StaticContext for Static() handlers at build time.
|
|
37
|
+
*
|
|
38
|
+
* Returns an InternalHandlerContext where only reverse and use(handle) work.
|
|
39
|
+
* Static handlers have no URL, no params, no pathname — everything else throws.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createStaticContext<TEnv>(routeMap: Record<string, string>, routeName?: string, buildEnv?: TEnv, devMode?: boolean): InternalHandlerContext<any, TEnv>;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase + event instrumentation — the single internal API for observing router
|
|
3
|
+
* work.
|
|
4
|
+
*
|
|
5
|
+
* The router exposes the same work on three surfaces, and the rule is: each
|
|
6
|
+
* surface has exactly one owner here, so they cannot drift.
|
|
7
|
+
*
|
|
8
|
+
* - observePhase(): a span of work. Co-emits the `debugPerformance` perf
|
|
9
|
+
* metric (metrics store -> [RSC Perf] timeline + Server-Timing) AND the
|
|
10
|
+
* platform span (tracing runner -> Cloudflare custom spans / OTel). From one
|
|
11
|
+
* wrap site, so the span set is always a subset of the perf phases and the
|
|
12
|
+
* two can't disagree. Phases that meter their own perf metric with a finer
|
|
13
|
+
* decomposition (request, middleware) pass `metric: false` and get the span
|
|
14
|
+
* only — still co-located, still one owner per surface.
|
|
15
|
+
* - observeEvent(): a discrete fact (TelemetrySink): cache decisions,
|
|
16
|
+
* revalidation decisions, handler errors, timeouts, origin rejections.
|
|
17
|
+
* Event-shaped, not phase-shaped — derived from the same call sites but a
|
|
18
|
+
* separate surface from spans.
|
|
19
|
+
*
|
|
20
|
+
* Why phases, not events, are the parent abstraction: Cloudflare's span API is
|
|
21
|
+
* callback-bound (enterSpan wraps the actual work), so the callback boundary is
|
|
22
|
+
* the source of truth — async-context nesting (a loader's KV/D1/fetch spans
|
|
23
|
+
* landing under rango.loader) cannot be faithfully reconstructed from
|
|
24
|
+
* after-the-fact start/end events. Spans drive; events are emitted alongside.
|
|
25
|
+
*
|
|
26
|
+
* Phase identity lives in the PHASES registry below, so the raw `rango.*` span
|
|
27
|
+
* names, perf-metric labels, and span attributes have a single definition each.
|
|
28
|
+
*
|
|
29
|
+
* When neither perf surface nor tracing is active on the request, observePhase
|
|
30
|
+
* is a direct call — no wrapper, no timestamp, no allocation.
|
|
31
|
+
*/
|
|
32
|
+
import { type TelemetryEvent } from "./telemetry.js";
|
|
33
|
+
import { type TracePhase, type TraceSpan } from "./tracing.js";
|
|
34
|
+
/**
|
|
35
|
+
* Perf-metric boundary for a phase, or `false` for span-only. `false` means the
|
|
36
|
+
* caller records its own perf metric with a finer decomposition than a single
|
|
37
|
+
* wrap (request: a grand total incl. pre-context bootstrap; middleware: pre/post
|
|
38
|
+
* own-time), so observePhase opens the span but records no metric of its own.
|
|
39
|
+
*/
|
|
40
|
+
export type PhaseMetric = {
|
|
41
|
+
label: string | (() => string);
|
|
42
|
+
depth?: number;
|
|
43
|
+
} | false;
|
|
44
|
+
/** Describes one observable phase across the perf and span surfaces. */
|
|
45
|
+
export interface PhaseSpec {
|
|
46
|
+
/** Perf timeline label + Server-Timing name, or false for span-only. */
|
|
47
|
+
metric: PhaseMetric;
|
|
48
|
+
/** Span phase gate (per-phase toggle in the tracing config). */
|
|
49
|
+
tracePhase: TracePhase;
|
|
50
|
+
/** Span name (rango.*). */
|
|
51
|
+
spanName: string;
|
|
52
|
+
/** Span attributes set automatically when the span opens. */
|
|
53
|
+
attributes?: Record<string, string | number | boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Span attributes resolved AFTER the wrapped work runs (so they can read state
|
|
56
|
+
* that only exists once the work is underway, e.g. the matched route name).
|
|
57
|
+
* Applied for streaming phases once fn has constructed its value. Return
|
|
58
|
+
* undefined to add nothing.
|
|
59
|
+
*/
|
|
60
|
+
lazyAttributes?: () => Record<string, string | number | boolean> | undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The router's observable phases. One definition per phase keeps the `rango.*`
|
|
64
|
+
* span names, perf-metric labels, and identifying attributes from spreading
|
|
65
|
+
* across call sites.
|
|
66
|
+
*/
|
|
67
|
+
export declare const PHASES: {
|
|
68
|
+
/** Whole request pipeline. Span only — handler:total is metered directly. */
|
|
69
|
+
readonly request: PhaseSpec;
|
|
70
|
+
/** One middleware (incl. its downstream onion). Span only — the perf metric
|
|
71
|
+
* is the middleware's exclusive pre/post own-time, recorded directly.
|
|
72
|
+
* `metricLabel` is that metric's label (e.g. "middleware:auth@*"); it doubles
|
|
73
|
+
* as the rango.middleware_name span attribute. */
|
|
74
|
+
readonly middleware: (metricLabel: string) => PhaseSpec;
|
|
75
|
+
/** The server-action execution (decode args + run the action body), before
|
|
76
|
+
* the revalidation render. The metric label carries the action id (the
|
|
77
|
+
* _rsc_action / action $$id) so the perf timeline shows WHICH action ran, not
|
|
78
|
+
* just "an action"; the span also gets it as rango.action_id. */
|
|
79
|
+
readonly action: (id: string) => PhaseSpec;
|
|
80
|
+
/**
|
|
81
|
+
* One loader execution. `depth` is the perf-timeline indentation: 2 (default)
|
|
82
|
+
* for render-time loaders that nest under the render phase; 1 for a standalone
|
|
83
|
+
* fetchable `_rsc_loader` request, which has no render parent.
|
|
84
|
+
*/
|
|
85
|
+
readonly loader: (id: string, depth?: number) => PhaseSpec;
|
|
86
|
+
/** One segment route/layout handler execution (the component/handler that
|
|
87
|
+
* produces a segment). Span only — the perf metric (handler:<id>) is owned by
|
|
88
|
+
* the legacy track() at the same call site, so observePhase here adds the
|
|
89
|
+
* rango.handler span without double-recording. `id` is the HANDLER id (the
|
|
90
|
+
* entry.id used in the handler:<id> perf row), carried as rango.handler_id —
|
|
91
|
+
* NOT the emitted segment's id (shortCode), which differs; the *_id naming
|
|
92
|
+
* mirrors rango.loader_id / rango.action_id. */
|
|
93
|
+
readonly handler: (id: string) => PhaseSpec;
|
|
94
|
+
/** Whole render phase: match + serialize + SSR. The metric label is resolved
|
|
95
|
+
* lazily at record time (after match has set the route name) so the perf
|
|
96
|
+
* timeline shows WHICH route rendered: `render:total:<routeName>`, falling back
|
|
97
|
+
* to `render:total` when there is no named route (unmatched / auto-generated). */
|
|
98
|
+
readonly render: PhaseSpec;
|
|
99
|
+
/** SSR HTML render from the RSC stream. Colon-delimited like the other ssr:*
|
|
100
|
+
* setup metrics (ssr:module-load / ssr:stream-mode). */
|
|
101
|
+
readonly ssr: PhaseSpec;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Instrument one unit of work: open its span AND (unless `metric: false`) record
|
|
105
|
+
* its perf metric, from a single wrap site. fn is invoked exactly once with the
|
|
106
|
+
* span (a no-op span when tracing is off); its return value is returned
|
|
107
|
+
* unchanged and thrown errors / rejected promises propagate unchanged. When fn
|
|
108
|
+
* returns a promise both the metric duration and the span end when it settles.
|
|
109
|
+
*
|
|
110
|
+
* This is the ONLY phase primitive: every phase (request/middleware/action/
|
|
111
|
+
* loader/handler/render/ssr) is construction-bound — the span and metric settle
|
|
112
|
+
* when fn's own work completes (for the streaming phases, when the RSC/HTML
|
|
113
|
+
* stream is constructed, NOT when the body drains). Instrumentation is strictly
|
|
114
|
+
* best-effort: it never wraps or buffers the response and adds no work on the
|
|
115
|
+
* streaming path, so it cannot regress response latency or streaming. A loader
|
|
116
|
+
* that resolves while the body streams therefore keeps a rango.loader span that
|
|
117
|
+
* may extend past its render parent — overlapping spans are valid; the loader
|
|
118
|
+
* really did take that long.
|
|
119
|
+
*
|
|
120
|
+
* Reads the metrics store + tracing off the RequestContext ALS, which is active
|
|
121
|
+
* for the WHOLE request — contrast observeEvent, which reads the RouterContext
|
|
122
|
+
* ALS (entered later, during match).
|
|
123
|
+
*/
|
|
124
|
+
export declare function observePhase<T>(spec: PhaseSpec, fn: (span: TraceSpan) => T): T;
|
|
125
|
+
/**
|
|
126
|
+
* Open a rango.handler span around one segment route/layout handler call. The
|
|
127
|
+
* segment-resolution hot path runs this PER SEGMENT, so it gates on the SPAN
|
|
128
|
+
* surface alone and calls the handler directly otherwise — building neither the
|
|
129
|
+
* PhaseSpec (PHASES.handler allocates) nor the wrapper closure on the off path.
|
|
130
|
+
* The handler:<id> perf metric is owned by the track() at the call site, so the
|
|
131
|
+
* span is the only surface this adds (metric:false); a debugPerformance-only
|
|
132
|
+
* request (no tracing) or a disabled handler phase (spans:{handler:false}) has
|
|
133
|
+
* nothing to record here and short-circuits.
|
|
134
|
+
*/
|
|
135
|
+
export declare function observeHandler<C, R>(id: string, handler: (ctx: C) => R, ctx: C): R;
|
|
136
|
+
/**
|
|
137
|
+
* Emit one discrete telemetry event (the event-shaped counterpart to
|
|
138
|
+
* observePhase). Resolves the sink from the active router context and stamps the
|
|
139
|
+
* request id when the event omits it. No-op (and total — never throws) when no
|
|
140
|
+
* sink is configured.
|
|
141
|
+
*
|
|
142
|
+
* This is the canonical emitter for SYNCHRONOUS facts that fire inside the
|
|
143
|
+
* request's ALS scope (revalidation decisions, cache-lookup decisions). A few
|
|
144
|
+
* emitters deliberately stay on the lower-level resolveSink + safeEmit because
|
|
145
|
+
* observeEvent's lazy, per-call getRouterContext() read does not fit them — keep
|
|
146
|
+
* this the complete list:
|
|
147
|
+
* - router.ts wrapLoaderPromise (loader.start/end/error) and
|
|
148
|
+
* segment-resolution/streamed-handler-telemetry.ts (streamed handler.error)
|
|
149
|
+
* capture the sink + request id EAGERLY and emit from a fire-and-forget
|
|
150
|
+
* continuation that runs after the ALS scope may have unwound.
|
|
151
|
+
* - router/match-handlers.ts resolves the sink ONCE for the hot match-pipeline
|
|
152
|
+
* loop (request.start/end/error, cache.decision, ...).
|
|
153
|
+
* - segment-resolution/helpers.ts emits via a caller-provided report.telemetry
|
|
154
|
+
* sink rather than the ALS router context.
|
|
155
|
+
* - rsc/handler.ts handleTimeoutResponse (request.timeout), the origin guard
|
|
156
|
+
* (request.origin-rejected), and handleStore.onError (late-handle
|
|
157
|
+
* handler.error) emit via router.telemetry directly — they run outside the
|
|
158
|
+
* RouterContext ALS (only match()/matchPartial() enter it), so a
|
|
159
|
+
* getRouterContext() read there throws and the event would vanish.
|
|
160
|
+
*/
|
|
161
|
+
export declare function observeEvent(event: TelemetryEvent): void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intercept Resolution
|
|
3
|
+
*
|
|
4
|
+
* Extracted from createRouter closure. Contains intercept detection and resolution
|
|
5
|
+
* functions for soft navigation (modals).
|
|
6
|
+
*/
|
|
7
|
+
import type { EntryData, InterceptEntry, InterceptSelectorContext } from "../server/context";
|
|
8
|
+
import type { HandlerContext, ResolvedSegment } from "../types";
|
|
9
|
+
import type { SegmentResolutionDeps } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Check if an intercept's when conditions are satisfied.
|
|
12
|
+
* All when() functions must return true for the intercept to activate.
|
|
13
|
+
* If no when() conditions are defined, the intercept always activates.
|
|
14
|
+
*
|
|
15
|
+
* During action revalidation, when() is NOT evaluated.
|
|
16
|
+
*/
|
|
17
|
+
export declare function evaluateInterceptWhen(intercept: InterceptEntry, selectorContext: InterceptSelectorContext | null, isAction: boolean): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Find an intercept for the target route by walking up the entry chain.
|
|
20
|
+
* Returns the first (innermost) matching intercept along with the entry that defines it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findInterceptForRoute(targetRouteKey: string, fromEntry: EntryData | null, selectorContext?: InterceptSelectorContext | null, isAction?: boolean): {
|
|
23
|
+
intercept: InterceptEntry;
|
|
24
|
+
entry: EntryData;
|
|
25
|
+
} | null;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve an intercept entry and emit segment with the slot name.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveInterceptEntry<TEnv>(interceptEntry: InterceptEntry, parentEntry: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, revalidationContext?: {
|
|
30
|
+
clientSegmentIds: Set<string>;
|
|
31
|
+
prevParams: Record<string, string>;
|
|
32
|
+
request: Request;
|
|
33
|
+
prevUrl: URL;
|
|
34
|
+
nextUrl: URL;
|
|
35
|
+
routeKey: string;
|
|
36
|
+
actionContext?: {
|
|
37
|
+
actionId?: string;
|
|
38
|
+
actionUrl?: URL;
|
|
39
|
+
actionResult?: any;
|
|
40
|
+
formData?: FormData;
|
|
41
|
+
};
|
|
42
|
+
stale?: boolean;
|
|
43
|
+
}, options?: {
|
|
44
|
+
/**
|
|
45
|
+
* Skip the intercept's middleware execution. Set ONLY by the post-response
|
|
46
|
+
* background re-render paths (proactive caching, stale background
|
|
47
|
+
* revalidation), whose sole purpose is to re-render the segment tree to
|
|
48
|
+
* populate the cache. The foreground request already ran the intercept
|
|
49
|
+
* middleware before the response was sent — it validated auth, set cookies,
|
|
50
|
+
* and wrote context vars into the request context's shared `_variables`,
|
|
51
|
+
* which the background render reuses. Re-running middleware here would fire
|
|
52
|
+
* its side effects a SECOND time, and a middleware that short-circuits with
|
|
53
|
+
* a Response would `throw` and silently abort the cache write. Never set on
|
|
54
|
+
* the foreground path.
|
|
55
|
+
*/
|
|
56
|
+
skipMiddleware?: boolean;
|
|
57
|
+
}): Promise<ResolvedSegment[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Resolve only the loaders for a cached intercept segment.
|
|
60
|
+
* Used on intercept cache hit to get fresh loader data while keeping cached component/layout.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveInterceptLoadersOnly<TEnv>(interceptEntry: InterceptEntry, parentEntry: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, revalidationContext: {
|
|
63
|
+
clientSegmentIds: Set<string>;
|
|
64
|
+
prevParams: Record<string, string>;
|
|
65
|
+
request: Request;
|
|
66
|
+
prevUrl: URL;
|
|
67
|
+
nextUrl: URL;
|
|
68
|
+
routeKey: string;
|
|
69
|
+
actionContext?: {
|
|
70
|
+
actionId?: string;
|
|
71
|
+
actionUrl?: URL;
|
|
72
|
+
actionResult?: any;
|
|
73
|
+
formData?: FormData;
|
|
74
|
+
};
|
|
75
|
+
stale?: boolean;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
loaderDataPromise: Promise<any[]> | any[];
|
|
78
|
+
loaderIds: string[];
|
|
79
|
+
} | null>;
|