@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,221 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { NavigationLocation, NavigateOptions, TrackedActionState, InflightAction, RscMetadata, HandleData, StreamingToken } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Phase of a navigation operation
|
|
5
|
+
*/
|
|
6
|
+
export type NavigationPhase = "fetching" | "streaming";
|
|
7
|
+
/**
|
|
8
|
+
* Phase of an action operation
|
|
9
|
+
*/
|
|
10
|
+
export type ActionPhase = "fetching" | "streaming" | "settling";
|
|
11
|
+
/**
|
|
12
|
+
* Entry tracking an in-flight navigation
|
|
13
|
+
*/
|
|
14
|
+
export interface NavigationEntry {
|
|
15
|
+
url: string;
|
|
16
|
+
abort: AbortController;
|
|
17
|
+
phase: NavigationPhase;
|
|
18
|
+
startedAt: number;
|
|
19
|
+
options?: NavigateOptions & {
|
|
20
|
+
skipLoadingState?: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Entry tracking an in-flight action
|
|
25
|
+
*/
|
|
26
|
+
export interface ActionEntry {
|
|
27
|
+
/** Unique instance ID for this action invocation */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Server action function ID (normalized name like "addToCart") */
|
|
30
|
+
actionId: string;
|
|
31
|
+
/** Abort controller for this action */
|
|
32
|
+
abort: AbortController;
|
|
33
|
+
/** Current phase of the action */
|
|
34
|
+
phase: ActionPhase;
|
|
35
|
+
/** Action arguments */
|
|
36
|
+
payload: unknown[];
|
|
37
|
+
/** Result from action (set on completion) */
|
|
38
|
+
result?: unknown;
|
|
39
|
+
/** Error from action (set on failure) */
|
|
40
|
+
error?: unknown;
|
|
41
|
+
/** Segment IDs that were revalidated by this action */
|
|
42
|
+
revalidatedSegments: string[];
|
|
43
|
+
/** Timestamp when action started */
|
|
44
|
+
startedAt: number;
|
|
45
|
+
/** Whether action processing is complete (may still be streaming) */
|
|
46
|
+
completed?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Derived navigation state (computed from source of truth)
|
|
50
|
+
*/
|
|
51
|
+
export interface DerivedNavigationState {
|
|
52
|
+
/** Navigation lifecycle state */
|
|
53
|
+
state: "idle" | "loading";
|
|
54
|
+
/** Whether any operation is streaming */
|
|
55
|
+
isStreaming: boolean;
|
|
56
|
+
/** Whether a navigation is active (fetching or streaming, before commit) */
|
|
57
|
+
isNavigating: boolean;
|
|
58
|
+
/** Current committed location */
|
|
59
|
+
location: NavigationLocation;
|
|
60
|
+
/** URL being navigated to (null if idle) */
|
|
61
|
+
pendingUrl: string | null;
|
|
62
|
+
/** List of inflight actions (for compatibility) */
|
|
63
|
+
inflightActions: InflightAction[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Callback for UI updates when root should re-render
|
|
67
|
+
*/
|
|
68
|
+
export type UpdateCallback = (update: {
|
|
69
|
+
root: ReactNode | Promise<ReactNode>;
|
|
70
|
+
metadata: RscMetadata;
|
|
71
|
+
}) => void;
|
|
72
|
+
/**
|
|
73
|
+
* State change listener
|
|
74
|
+
*/
|
|
75
|
+
export type StateListener = () => void;
|
|
76
|
+
/**
|
|
77
|
+
* Action state listener
|
|
78
|
+
*/
|
|
79
|
+
export type ActionStateListener = (state: TrackedActionState) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Handle state listener
|
|
82
|
+
*/
|
|
83
|
+
export type HandleListener = () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Internal handle state stored in controller.
|
|
86
|
+
*
|
|
87
|
+
* Two segment lists are exposed because they serve different consumers:
|
|
88
|
+
*
|
|
89
|
+
* - `segmentOrder` drives handle collection (collectHandleData). Includes
|
|
90
|
+
* parallel slot ids and reorders them after their parent so later-wins
|
|
91
|
+
* collect functions (e.g. Meta) get the right precedence.
|
|
92
|
+
* - `routeSegmentIds` is the layouts-and-routes-only list documented by
|
|
93
|
+
* `useSegments().segmentIds`. Parallels and loader sub-ids are stripped;
|
|
94
|
+
* raw matched order is preserved.
|
|
95
|
+
*
|
|
96
|
+
* Both are derived from the same `matched` input on each setHandleData call
|
|
97
|
+
* so they stay in sync.
|
|
98
|
+
*/
|
|
99
|
+
export interface HandleState {
|
|
100
|
+
data: HandleData;
|
|
101
|
+
segmentOrder: string[];
|
|
102
|
+
routeSegmentIds: string[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Result from starting a navigation
|
|
106
|
+
* Implements Disposable for use with `using` keyword
|
|
107
|
+
*/
|
|
108
|
+
export interface NavigationHandle extends Disposable {
|
|
109
|
+
/** Abort controller for this navigation */
|
|
110
|
+
abort: AbortController;
|
|
111
|
+
/** Signal for this navigation */
|
|
112
|
+
signal: AbortSignal;
|
|
113
|
+
/** Start streaming and get a token to end it later */
|
|
114
|
+
startStreaming(): StreamingToken;
|
|
115
|
+
/** Complete the navigation successfully */
|
|
116
|
+
complete(location: NavigationLocation): void;
|
|
117
|
+
/** Whether navigation was completed successfully */
|
|
118
|
+
readonly completed: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Result from starting an action
|
|
122
|
+
* Implements Disposable for use with `using` keyword
|
|
123
|
+
*/
|
|
124
|
+
export interface ActionHandle extends Disposable {
|
|
125
|
+
/** Unique instance ID */
|
|
126
|
+
id: string;
|
|
127
|
+
/** Abort controller for this action */
|
|
128
|
+
abort: AbortController;
|
|
129
|
+
/** Signal for this action */
|
|
130
|
+
signal: AbortSignal;
|
|
131
|
+
/** Start streaming and get a token to end it later */
|
|
132
|
+
startStreaming(): StreamingToken;
|
|
133
|
+
/** Record segments that were revalidated */
|
|
134
|
+
recordRevalidatedSegments(segmentIds: string[]): void;
|
|
135
|
+
/**
|
|
136
|
+
* Claim the subset of a location-state payload this action may write. A key
|
|
137
|
+
* is claimed only if no later-initiated action in the SAME cohort has already
|
|
138
|
+
* claimed it, so same-key concurrent writes resolve to the last-initiated
|
|
139
|
+
* action while distinct keys from every action survive. Recording the claim
|
|
140
|
+
* stops a later-settling earlier action from overwriting it. Arbitration is
|
|
141
|
+
* scoped to the action's cohort (its originating history entry, captured at
|
|
142
|
+
* startAction), so an action on one entry cannot suppress an action on
|
|
143
|
+
* another that happens to write the same slot.
|
|
144
|
+
*
|
|
145
|
+
* Contract: this guarantees the FINAL value is the last-initiated action's,
|
|
146
|
+
* not that the loser is never momentarily visible. When an earlier-initiated
|
|
147
|
+
* action settles first, its value is merged and observable until the
|
|
148
|
+
* later-initiated winner's response lands and overwrites it.
|
|
149
|
+
*/
|
|
150
|
+
claimLocationState(state: Record<string, unknown>): Record<string, unknown>;
|
|
151
|
+
/** Complete the action with result */
|
|
152
|
+
complete(result?: unknown): void;
|
|
153
|
+
/** Fail the action with error */
|
|
154
|
+
fail(error: unknown): void;
|
|
155
|
+
/** Whether action was completed (success or failure) */
|
|
156
|
+
readonly settled: boolean;
|
|
157
|
+
/** Check if any concurrent actions were started */
|
|
158
|
+
hadConcurrentActions: boolean;
|
|
159
|
+
/** Get raw set of segments revalidated by concurrent actions */
|
|
160
|
+
getRevalidatedSegments(): Set<string>;
|
|
161
|
+
/** Clear consolidation tracking */
|
|
162
|
+
clearConsolidation(): void;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Event controller interface
|
|
166
|
+
*/
|
|
167
|
+
export interface EventController {
|
|
168
|
+
startNavigation(url: string, options?: NavigateOptions & {
|
|
169
|
+
skipLoadingState?: boolean;
|
|
170
|
+
}): NavigationHandle;
|
|
171
|
+
abortNavigation(): void;
|
|
172
|
+
startAction(actionId: string, args: unknown[],
|
|
173
|
+
/** Originating history entry key; scopes location-state arbitration. */
|
|
174
|
+
cohort?: string): ActionHandle;
|
|
175
|
+
abortAllActions(): void;
|
|
176
|
+
getState(): DerivedNavigationState;
|
|
177
|
+
getActionState(actionId: string): TrackedActionState;
|
|
178
|
+
getLocation(): NavigationLocation;
|
|
179
|
+
setLocation(location: NavigationLocation): void;
|
|
180
|
+
subscribe(listener: StateListener): () => void;
|
|
181
|
+
subscribeToAction(actionId: string, listener: ActionStateListener): () => void;
|
|
182
|
+
subscribeToHandles(listener: HandleListener): () => void;
|
|
183
|
+
setHandleData(data: HandleData, matched?: string[], isPartial?: boolean,
|
|
184
|
+
/**
|
|
185
|
+
* Segment ids that were re-resolved on the server this request (the
|
|
186
|
+
* partial response's `diff`). On a partial update, any existing bucket
|
|
187
|
+
* keyed under one of these ids that has no incoming entry is treated as
|
|
188
|
+
* stale and cleared. Without this, a parallel slot that revalidates but
|
|
189
|
+
* pushes nothing leaves its previous bucket in place forever.
|
|
190
|
+
*/
|
|
191
|
+
resolvedIds?: string[]): void;
|
|
192
|
+
getHandleState(): HandleState;
|
|
193
|
+
/**
|
|
194
|
+
* Update ONLY `routeSegmentIds` (what `useSegments` reads) from `matched`,
|
|
195
|
+
* leaving `data` and `segmentOrder` (what `useHandle` collects over) untouched.
|
|
196
|
+
* Used while a deferred handle is resolving: the route has changed (so
|
|
197
|
+
* `useSegments` must reflect the new segment ids) but `useHandle` still holds
|
|
198
|
+
* its previous value until the deferred snapshot is applied.
|
|
199
|
+
*/
|
|
200
|
+
setRouteSegmentIds(matched: string[]): void;
|
|
201
|
+
setParams(params: Record<string, string>): void;
|
|
202
|
+
getParams(): Record<string, string>;
|
|
203
|
+
getCurrentNavigation(): NavigationEntry | null;
|
|
204
|
+
getInflightActions(): Map<string, ActionEntry>;
|
|
205
|
+
/** Whether any concurrent actions have occurred (shared across all handles) */
|
|
206
|
+
hadAnyConcurrentActions(): boolean;
|
|
207
|
+
}
|
|
208
|
+
export interface EventControllerConfig {
|
|
209
|
+
initialLocation?: NavigationLocation;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Create an event controller for managing navigation and action state
|
|
213
|
+
*
|
|
214
|
+
* The controller uses a reactive model where:
|
|
215
|
+
* - Source of truth: currentNavigation, inflightActions, location
|
|
216
|
+
* - Derived state: navState, isStreaming computed from source
|
|
217
|
+
*
|
|
218
|
+
* Navigation uses switchMap semantics (new nav cancels previous).
|
|
219
|
+
* Actions use mergeMap semantics (all run concurrently, consolidate at end).
|
|
220
|
+
*/
|
|
221
|
+
export declare function createEventController(config?: EventControllerConfig): EventController;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve navigation state - handles both LocationStateEntry[] and plain formats
|
|
3
|
+
*/
|
|
4
|
+
export declare function resolveNavigationState(state: unknown): unknown;
|
|
5
|
+
/**
|
|
6
|
+
* Build history state object from user state
|
|
7
|
+
* - Typed state: spread directly into history.state
|
|
8
|
+
* - Plain state: store in history.state.state
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildHistoryState(userState: unknown, routerState?: {
|
|
11
|
+
intercept?: boolean;
|
|
12
|
+
sourceUrl?: string;
|
|
13
|
+
}, serverState?: Record<string, unknown>): Record<string, unknown> | null;
|
|
14
|
+
/**
|
|
15
|
+
* Stamp an `idx` on the next history entry's state and call push/replaceState.
|
|
16
|
+
* Push increments the current idx; replace keeps it. Initial entry idx is 0.
|
|
17
|
+
* Used by useRouter().back() to detect "first entry in this session" without
|
|
18
|
+
* relying on the Navigation API.
|
|
19
|
+
*/
|
|
20
|
+
export declare function pushHistoryWithIdx(state: Record<string, unknown> | null, url: string, replace: boolean): void;
|
|
21
|
+
/**
|
|
22
|
+
* Merge server-set location state into the current history entry.
|
|
23
|
+
* Replaces the current history state and dispatches notification event
|
|
24
|
+
* so useLocationState hooks re-read from history.state.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mergeLocationState(locationState: Record<string, unknown>): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { initBrowserApp, Rango, type InitBrowserAppOptions, } from "./rsc-router.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ResolvedSegment } from "./types.js";
|
|
2
|
+
import type { SlotState } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Check if a segment is an intercept segment.
|
|
5
|
+
* Intercept segments have namespace starting with "intercept:" — both the
|
|
6
|
+
* parallel container (@modal) and its content children receive this namespace
|
|
7
|
+
* from intercept-resolution.ts. Regular parallel segments like @sidebar do not.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isInterceptSegment(s: ResolvedSegment): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Split an array of segments into main and intercept groups.
|
|
12
|
+
* Intercept segments are separated for explicit injection into the render tree
|
|
13
|
+
* via the interceptSegments render option.
|
|
14
|
+
*/
|
|
15
|
+
export declare function splitInterceptSegments(segments: ResolvedSegment[]): {
|
|
16
|
+
main: ResolvedSegment[];
|
|
17
|
+
intercept: ResolvedSegment[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Check if any slot is currently active (has content to render).
|
|
21
|
+
* Active slots indicate an intercept response where a parallel segment
|
|
22
|
+
* (e.g., @modal) has matched and should be rendered.
|
|
23
|
+
*/
|
|
24
|
+
export declare function hasActiveIntercept(slots?: Record<string, SlotState>): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Check if cached segments contain any intercept segments.
|
|
27
|
+
* Intercept caches shouldn't be used for cached SWR rendering since
|
|
28
|
+
* whether interception happens depends on the current page context.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isInterceptOnlyCache(segments: ResolvedSegment[]): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client seat of `invalidateClientCache()` (the `default` export condition).
|
|
3
|
+
*
|
|
4
|
+
* Makes the current client behave as if a server action had just completed:
|
|
5
|
+
* the history cache is marked stale (SWR), the prefetch map is flushed, the
|
|
6
|
+
* state rotates, and sibling tabs are broadcast to — the same
|
|
7
|
+
* `markCacheAsStaleAndBroadcast()` path the server-action bridge uses. This is
|
|
8
|
+
* the gentler mark-stale (not hard-clear) behavior, so Back renders the cached
|
|
9
|
+
* entry instantly and revalidates.
|
|
10
|
+
*/
|
|
11
|
+
export declare function invalidateClientCache(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Client no-op for `keepClientCache()`. It is a server action directive (the
|
|
14
|
+
* `react-server` condition sets a response header the action bridge reads);
|
|
15
|
+
* there is nothing to suppress from the client side.
|
|
16
|
+
*/
|
|
17
|
+
export declare function keepClientCache(): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { LinkInterceptorOptions, NavigateOptions } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Check if an anchor points to the same page with only a hash change.
|
|
4
|
+
* Used by both Link component and link-interceptor to let the browser
|
|
5
|
+
* handle anchor scrolling natively.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isHashOnlyNavigation(anchor: HTMLAnchorElement): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Default link interception predicate
|
|
10
|
+
*
|
|
11
|
+
* Returns true if the link should be intercepted for SPA navigation.
|
|
12
|
+
* Filters out:
|
|
13
|
+
* - Cross-origin links
|
|
14
|
+
* - Links with download attribute
|
|
15
|
+
* - Links with target other than _self
|
|
16
|
+
* - Links with data-no-intercept attribute
|
|
17
|
+
*
|
|
18
|
+
* @param link - The anchor element to check
|
|
19
|
+
* @returns true if the link should be intercepted
|
|
20
|
+
*/
|
|
21
|
+
export declare function defaultShouldIntercept(link: HTMLAnchorElement): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Set up link interception for SPA navigation
|
|
24
|
+
*
|
|
25
|
+
* Attaches a global click handler to intercept clicks on anchor elements
|
|
26
|
+
* and call the onNavigate callback instead of performing a full page load.
|
|
27
|
+
*
|
|
28
|
+
* @param onNavigate - Callback when a link should navigate via SPA
|
|
29
|
+
* @param options - Configuration options
|
|
30
|
+
* @returns Cleanup function to remove the event listener
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const cleanup = setupLinkInterception((url) => {
|
|
35
|
+
* window.history.pushState({}, "", url);
|
|
36
|
+
* fetchPartialUpdate(url);
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Later, to clean up:
|
|
40
|
+
* cleanup();
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function setupLinkInterception(onNavigate: (url: string, options?: NavigateOptions) => void, options?: LinkInterceptorOptions): () => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module-level debug flag for guarding call sites whose debug arguments do
|
|
3
|
+
* non-trivial work (joins, maps, spreads, object literals). Because the Vite
|
|
4
|
+
* transform folds INTERNAL_RANGO_DEBUG to a literal, an `if (IS_BROWSER_DEBUG)`
|
|
5
|
+
* guard is minifier-DCE-able — the whole block drops from the production bundle.
|
|
6
|
+
* Prefer this over isBrowserDebugEnabled() at hot call sites: a const guard folds
|
|
7
|
+
* where a function call may not.
|
|
8
|
+
*/
|
|
9
|
+
export declare const IS_BROWSER_DEBUG: boolean;
|
|
10
|
+
interface BrowserLogContext {
|
|
11
|
+
requestId: string;
|
|
12
|
+
txId: string;
|
|
13
|
+
operation: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function isBrowserDebugEnabled(): boolean;
|
|
16
|
+
export declare function startBrowserTransaction(operation: string): BrowserLogContext;
|
|
17
|
+
export declare function browserDebugLog(ctx: BrowserLogContext, message: string, details?: Record<string, unknown>): void;
|
|
18
|
+
/**
|
|
19
|
+
* Simple gated console.log for browser-side debug output.
|
|
20
|
+
* Unlike browserDebugLog, this doesn't require a transaction context -
|
|
21
|
+
* use it for standalone debug messages in partial-update, navigation-bridge, etc.
|
|
22
|
+
*/
|
|
23
|
+
export declare function debugLog(msg: string, ...args: unknown[]): void;
|
|
24
|
+
/**
|
|
25
|
+
* Boot-sequence debug log: one line per initial-document step (flight decode,
|
|
26
|
+
* handle stream, bridge wiring, initial tree build, hydration commit), each
|
|
27
|
+
* stamped with performance.now() so the gap BEFORE hydrateRoot is visible.
|
|
28
|
+
* The initial document path was otherwise silent — FE debug only started
|
|
29
|
+
* talking at the first soft navigation, so a boot stall (e.g. an await that
|
|
30
|
+
* holds initBrowserApp, and with it hydrateRoot) was invisible.
|
|
31
|
+
*/
|
|
32
|
+
export declare function bootLog(step: string, details?: Record<string, unknown>): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ResolvedSegment } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Merge partial loader data from server with cached loader data.
|
|
4
|
+
*
|
|
5
|
+
* During partial revalidation (stale or action), the server may return only
|
|
6
|
+
* some loaders that pass the revalidation check. The component still needs
|
|
7
|
+
* all loader data, so we merge fresh data with cached data.
|
|
8
|
+
*
|
|
9
|
+
* @param fromServer - Segment returned from server with partial loaders
|
|
10
|
+
* @param fromCache - Cached segment with full loader data
|
|
11
|
+
* @returns Merged segment with complete loader data
|
|
12
|
+
*/
|
|
13
|
+
export declare function mergeSegmentLoaders(fromServer: ResolvedSegment, fromCache: ResolvedSegment): ResolvedSegment;
|
|
14
|
+
/**
|
|
15
|
+
* Check if segments need loader merging during partial revalidation.
|
|
16
|
+
*
|
|
17
|
+
* Returns true when:
|
|
18
|
+
* - Server returned fewer loaders than cached (partial revalidation)
|
|
19
|
+
* - Both segments have loader data promises
|
|
20
|
+
*/
|
|
21
|
+
export declare function needsLoaderMerge(fromServer: ResolvedSegment, fromCache: ResolvedSegment | undefined): fromCache is ResolvedSegment;
|
|
22
|
+
/**
|
|
23
|
+
* Insert diff segments that aren't in the matched array into allSegments.
|
|
24
|
+
*
|
|
25
|
+
* During consolidation fetch for concurrent actions, loader segments may be
|
|
26
|
+
* excluded from the request. The server returns them in the diff but not in
|
|
27
|
+
* the matched array. This function inserts them at the correct position
|
|
28
|
+
* (after their parent layout segment).
|
|
29
|
+
*
|
|
30
|
+
* Loader segment IDs follow the pattern: {parentLayoutId}D{index}.{loaderId}
|
|
31
|
+
* Example: M9L0L1D0.actionCounter has parent layout M9L0L1
|
|
32
|
+
*
|
|
33
|
+
* @param allSegments - Mutable array of segments to insert into
|
|
34
|
+
* @param diff - Array of segment IDs that changed (from server response)
|
|
35
|
+
* @param matchedIdSet - Set of segment IDs from matched array
|
|
36
|
+
* @param newSegmentMap - Map of segment ID to segment data from server
|
|
37
|
+
*/
|
|
38
|
+
export declare function insertMissingDiffSegments(allSegments: ResolvedSegment[], diff: string[] | undefined, matchedIdSet: Set<string>, newSegmentMap: Map<string, ResolvedSegment>): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { NavigationBridge, NavigationBridgeConfig } from "./types.js";
|
|
2
|
+
import { createNavigationTransaction } from "./navigation-transaction.js";
|
|
3
|
+
import type { EventController } from "./event-controller.js";
|
|
4
|
+
export { createNavigationTransaction };
|
|
5
|
+
/**
|
|
6
|
+
* Extended configuration for navigation bridge with event controller
|
|
7
|
+
*/
|
|
8
|
+
export interface NavigationBridgeConfigWithController extends NavigationBridgeConfig {
|
|
9
|
+
eventController: EventController;
|
|
10
|
+
/** RSC version from initial payload metadata. */
|
|
11
|
+
version?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a navigation bridge for handling client-side navigation
|
|
15
|
+
*
|
|
16
|
+
* The bridge coordinates all navigation operations:
|
|
17
|
+
* - Link click interception
|
|
18
|
+
* - Browser back/forward (popstate)
|
|
19
|
+
* - Programmatic navigation
|
|
20
|
+
*
|
|
21
|
+
* Uses the event controller for reactive state management.
|
|
22
|
+
*
|
|
23
|
+
* @param config - Bridge configuration
|
|
24
|
+
* @returns NavigationBridge instance
|
|
25
|
+
*/
|
|
26
|
+
export declare function createNavigationBridge(config: NavigationBridgeConfigWithController): NavigationBridge;
|
|
27
|
+
export { createNavigationBridge as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NavigationClient, RscBrowserDependencies } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a navigation client for fetching RSC payloads
|
|
4
|
+
*
|
|
5
|
+
* The client handles building URLs with RSC parameters and
|
|
6
|
+
* deserializing the response using the RSC runtime.
|
|
7
|
+
*
|
|
8
|
+
* Checks the in-memory prefetch cache before making a network request.
|
|
9
|
+
* Tries the source-scoped key first (populated when the server tagged
|
|
10
|
+
* the response as source-sensitive via `X-RSC-Prefetch-Scope: source`)
|
|
11
|
+
* and falls back to the Rango-state-keyed wildcard slot used for the
|
|
12
|
+
* common source-agnostic case.
|
|
13
|
+
*
|
|
14
|
+
* @param deps - RSC browser dependencies (createFromFetch)
|
|
15
|
+
* @returns NavigationClient instance
|
|
16
|
+
*/
|
|
17
|
+
export declare function createNavigationClient(deps: Pick<RscBrowserDependencies, "createFromFetch">): NavigationClient;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A module-level handle to the active navigation store.
|
|
3
|
+
*
|
|
4
|
+
* The boot path (`rsc-router.tsx`) calls `createNavigationStore()` directly;
|
|
5
|
+
* there is no global store singleton. This handle is the live reference for
|
|
6
|
+
* code that needs the store but does not
|
|
7
|
+
* receive it by argument: the jar-divergence observer (below) and the client
|
|
8
|
+
* seat of `invalidateClientCache()` (added later).
|
|
9
|
+
*
|
|
10
|
+
* Dependency-light on purpose: it imports only `setRangoStateObserver` and the
|
|
11
|
+
* store type, so pulling it into the default root entry does not drag the
|
|
12
|
+
* navigation store into bundles that previously lacked it.
|
|
13
|
+
*/
|
|
14
|
+
import type { NavigationStore } from "./types.js";
|
|
15
|
+
/**
|
|
16
|
+
* Register the active navigation store at boot, and wire the jar-divergence
|
|
17
|
+
* observer: when a per-request cookie read detects an EXTERNAL rotation (a
|
|
18
|
+
* sibling tab, a server `Set-Cookie`, or a cookie clear), mark this tab's
|
|
19
|
+
* history cache stale. The history cache is not state-keyed, so the value
|
|
20
|
+
* rotation alone does not reach it. No broadcast, no prefetch clear, no
|
|
21
|
+
* re-rotation — the value already changed externally.
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerNavigationStore(store: NavigationStore): void;
|
|
24
|
+
/** The active navigation store, or null before boot has registered it. */
|
|
25
|
+
export declare function getRegisteredStore(): NavigationStore | null;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { NavigationStore, ResolvedSegment, HandleData } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Clone the handleData CONTAINERS (the handle-name map and each segment map) so
|
|
4
|
+
* a cache entry is decoupled from the live map that eventController mutates — it
|
|
5
|
+
* adds/deletes segment keys and REPLACES bucket arrays in place. The bucket
|
|
6
|
+
* arrays themselves are shared by reference, NOT copied: a bucket array is only
|
|
7
|
+
* ever replaced wholesale (eventController.setHandleData reassigns it,
|
|
8
|
+
* resolveDeferredHandleValues builds a fresh one) and collect functions read it
|
|
9
|
+
* without mutating, so sharing is safe and skips an O(elements) copy on every
|
|
10
|
+
* cache write — the per-yield streaming hot path. This also preserves any
|
|
11
|
+
* non-serializable bucket contents (React elements, functions, etc.).
|
|
12
|
+
*/
|
|
13
|
+
export declare function cloneHandleData(handleData: HandleData): HandleData;
|
|
14
|
+
/**
|
|
15
|
+
* Options for generating a history key
|
|
16
|
+
*/
|
|
17
|
+
export interface HistoryKeyOptions {
|
|
18
|
+
/** If true, append :intercept suffix to differentiate intercept entries */
|
|
19
|
+
intercept?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate a cache key from a URL.
|
|
23
|
+
* Uses pathname + search (query params) directly as the key.
|
|
24
|
+
* Hash fragments (#) are excluded since they don't affect server data.
|
|
25
|
+
*
|
|
26
|
+
* For intercept routes, append `:intercept` suffix to cache them separately
|
|
27
|
+
* from non-intercept versions of the same URL.
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateHistoryKey(url?: string, options?: HistoryKeyOptions): string;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration for creating a navigation store
|
|
32
|
+
*/
|
|
33
|
+
export interface NavigationStoreConfig {
|
|
34
|
+
initialLocation?: {
|
|
35
|
+
href: string;
|
|
36
|
+
};
|
|
37
|
+
initialSegmentIds?: string[];
|
|
38
|
+
initialHistoryKey?: string;
|
|
39
|
+
initialSegments?: ResolvedSegment[];
|
|
40
|
+
/**
|
|
41
|
+
* Maximum number of history entries to cache (default: 20)
|
|
42
|
+
* Older entries are evicted when limit is reached
|
|
43
|
+
*/
|
|
44
|
+
cacheSize?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Enable cross-tab cache invalidation via BroadcastChannel (default: true)
|
|
47
|
+
* When cache is cleared (via server actions or invalidateClientCache()),
|
|
48
|
+
* other tabs will also clear their cache
|
|
49
|
+
*/
|
|
50
|
+
crossTabSync?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Auto-refresh when another tab mutates data on the same path (default: true)
|
|
53
|
+
* Triggered when cache is cleared via server actions or invalidateClientCache()
|
|
54
|
+
* Requires crossTabSync to be enabled
|
|
55
|
+
*/
|
|
56
|
+
crossTabAutoRefresh?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Callback to invoke when cross-tab refresh is triggered
|
|
59
|
+
* Called when another tab invalidates the cache for a related route
|
|
60
|
+
*/
|
|
61
|
+
onCrossTabRefresh?: () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a navigation store for managing browser-side navigation state
|
|
65
|
+
*
|
|
66
|
+
* The store manages two types of state:
|
|
67
|
+
* - NavigationState: Public state exposed via useNavigation hook
|
|
68
|
+
* - SegmentState: Internal segment management for partial RSC updates
|
|
69
|
+
*
|
|
70
|
+
* @param config - Initial configuration
|
|
71
|
+
* @returns NavigationStore instance
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const store = createNavigationStore({
|
|
76
|
+
* initialLocation: window.location,
|
|
77
|
+
* initialSegmentIds: [],
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* // Subscribe to state changes (for useNavigation hook)
|
|
81
|
+
* const unsubscribe = store.subscribe(() => {
|
|
82
|
+
* const state = store.getState();
|
|
83
|
+
* console.log('Navigation state:', state);
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* // Update state
|
|
87
|
+
* store.setState({ state: 'loading' });
|
|
88
|
+
*
|
|
89
|
+
* // Subscribe to UI updates (for re-rendering)
|
|
90
|
+
* store.onUpdate((update) => {
|
|
91
|
+
* console.log('New root:', update.root);
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function createNavigationStore(config?: NavigationStoreConfig): NavigationStore;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { NavigateOptions, NavigationStore, ResolvedSegment, StreamingToken } from "./types.js";
|
|
2
|
+
import type { EventController, NavigationHandle } from "./event-controller.js";
|
|
3
|
+
export { resolveNavigationState } from "./history-state.js";
|
|
4
|
+
/**
|
|
5
|
+
* Options for committing a navigation transaction
|
|
6
|
+
*/
|
|
7
|
+
interface CommitOptions {
|
|
8
|
+
url: string;
|
|
9
|
+
segmentIds: string[];
|
|
10
|
+
segments: ResolvedSegment[];
|
|
11
|
+
replace?: boolean;
|
|
12
|
+
scroll?: boolean;
|
|
13
|
+
/** User-provided state to store in history.state */
|
|
14
|
+
state?: unknown;
|
|
15
|
+
/** If true, only update store without changing URL/history (for server actions) */
|
|
16
|
+
storeOnly?: boolean;
|
|
17
|
+
/** If true, this is an intercept route - store in history.state for popstate handling */
|
|
18
|
+
intercept?: boolean;
|
|
19
|
+
/** Source URL where the intercept was triggered from (stored in history.state) */
|
|
20
|
+
interceptSourceUrl?: string;
|
|
21
|
+
/** If true, only update cache without touching store or history (for background stale revalidation) */
|
|
22
|
+
cacheOnly?: boolean;
|
|
23
|
+
/** Server-set location state to merge into history.pushState */
|
|
24
|
+
serverState?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Options that can override the pre-configured commit settings
|
|
28
|
+
*/
|
|
29
|
+
interface BoundCommitOverrides {
|
|
30
|
+
/** Override scroll behavior (e.g., disable for intercepts) */
|
|
31
|
+
scroll?: boolean;
|
|
32
|
+
/** Override replace behavior (e.g., force replace for intercepts) */
|
|
33
|
+
replace?: boolean;
|
|
34
|
+
/** Override user-provided state */
|
|
35
|
+
state?: unknown;
|
|
36
|
+
/** Mark this as an intercept route */
|
|
37
|
+
intercept?: boolean;
|
|
38
|
+
/** Source URL where intercept was triggered from */
|
|
39
|
+
interceptSourceUrl?: string;
|
|
40
|
+
/** If true, only update cache (for stale revalidation) */
|
|
41
|
+
cacheOnly?: boolean;
|
|
42
|
+
/** Server-set location state to merge into history.pushState */
|
|
43
|
+
serverState?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Bound transaction with pre-configured commit options (without segmentIds/segments)
|
|
47
|
+
*/
|
|
48
|
+
export interface BoundTransaction {
|
|
49
|
+
readonly currentUrl: string;
|
|
50
|
+
/** Start streaming and get a token to end it when the stream completes */
|
|
51
|
+
startStreaming(): StreamingToken;
|
|
52
|
+
/** Commit the navigation. Returns the effective scroll option for the caller to handle. */
|
|
53
|
+
commit(segmentIds: string[], segments: ResolvedSegment[], overrides?: BoundCommitOverrides): {
|
|
54
|
+
scroll?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Navigation transaction for managing state during navigation
|
|
59
|
+
* Uses the event controller handle for lifecycle management
|
|
60
|
+
*/
|
|
61
|
+
interface NavigationTransaction extends Disposable {
|
|
62
|
+
commit(options: CommitOptions): {
|
|
63
|
+
scroll?: boolean;
|
|
64
|
+
};
|
|
65
|
+
with(options: Omit<CommitOptions, "segmentIds" | "segments">): BoundTransaction;
|
|
66
|
+
/** The navigation handle from the event controller */
|
|
67
|
+
handle: NavigationHandle;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Creates a navigation transaction that coordinates with the event controller.
|
|
71
|
+
* Handles loading state transitions and cleanup on completion/abort.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createNavigationTransaction(store: NavigationStore, eventController: EventController, url: string, options?: NavigateOptions & {
|
|
74
|
+
skipLoadingState?: boolean;
|
|
75
|
+
}): NavigationTransaction;
|