@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
package/src/rsc/shell-capture.ts
CHANGED
|
@@ -20,7 +20,10 @@ import React from "react";
|
|
|
20
20
|
import { bufferToBase64 } from "../cache/cf/cf-base64.js";
|
|
21
21
|
import { reportCacheError } from "../cache/cache-error.js";
|
|
22
22
|
import { runBackground } from "../cache/background-task.js";
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
CaptureQueueFullError,
|
|
25
|
+
enqueueSerializedCapture,
|
|
26
|
+
} from "./capture-queue.js";
|
|
24
27
|
import { SHELL_CAPTURE_MAX_WAIT_MS } from "./shell-capture-constants.js";
|
|
25
28
|
import { INTERNAL_RANGO_DEBUG } from "../internal-debug.js";
|
|
26
29
|
import { observePhase, PHASES } from "../router/instrument.js";
|
|
@@ -57,6 +60,7 @@ import type { SSRModule } from "./types.js";
|
|
|
57
60
|
import { buildFullPayload } from "./full-payload.js";
|
|
58
61
|
import { resolveDeferredHandleValues } from "../handles/deferred-resolution.js";
|
|
59
62
|
import { renderRscFlightStage } from "./render-pipeline.js";
|
|
63
|
+
import { stripInternalParams } from "../router/handler-context.js";
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* Task-quantized quiesce: the number of consecutive macrotask hops with zero new
|
|
@@ -344,39 +348,6 @@ function warnCaptureRefusedOnce(key: string, reason: string): void {
|
|
|
344
348
|
);
|
|
345
349
|
}
|
|
346
350
|
|
|
347
|
-
/** Keys already warned about untagged bake-lane data baked into the shell. */
|
|
348
|
-
const warnedUntaggedShellBakes = new Set<string>();
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Warn once per shell key that a bake-lane loader baked material into the shell
|
|
352
|
-
* but the capture recorded ZERO tags (no render-collected _requestTags, no
|
|
353
|
-
* static ppr.tags). Such data is frozen in the shared shell until TTL and is
|
|
354
|
-
* un-evictable by tag: a server action refreshes the CLIENT only (rotates Rango
|
|
355
|
-
* state, busts the browser HTTP cache) and never touches the server shell store,
|
|
356
|
-
* and updateTag()/revalidateTag() cannot drop data that was baked WITHOUT a tag.
|
|
357
|
-
*
|
|
358
|
-
* Coarse per-shell-key signal, not per-loader attribution — the tag set is
|
|
359
|
-
* unioned globally at the write barrier, not tracked per loader, so we cannot
|
|
360
|
-
* name the offending loader without adding attribution plumbing (deliberately
|
|
361
|
-
* not done). Dev-only + once-per-key so it never spams production or fires on
|
|
362
|
-
* every capture.
|
|
363
|
-
*/
|
|
364
|
-
function warnUntaggedShellBakeOnce(key: string): void {
|
|
365
|
-
if (warnedUntaggedShellBakes.has(key)) return;
|
|
366
|
-
warnedUntaggedShellBakes.add(key);
|
|
367
|
-
console.warn(
|
|
368
|
-
`[rango] Shell capture for "${key}" baked bake-lane loader data into the ` +
|
|
369
|
-
"shell with NO cache tag. That data is frozen in the shared shell until " +
|
|
370
|
-
"TTL and cannot be tag-invalidated: a server action refresh touches the " +
|
|
371
|
-
"client only (not the server shell store), and updateTag() cannot evict " +
|
|
372
|
-
"data that was baked without a tag.\n" +
|
|
373
|
-
'Fix: tag the data (cacheTag() / "use cache" / cache({ tags })) so ' +
|
|
374
|
-
"updateTag() drops the shell, or move the volatile read under a loading() " +
|
|
375
|
-
"hole so it stays on the live lane and is never baked. See the /ppr skill " +
|
|
376
|
-
"(node_modules/@rangojs/router/skills/ppr/SKILL.md).",
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
351
|
/**
|
|
381
352
|
* Default cap (serialized UTF-8 bytes) on the capture data snapshot riding
|
|
382
353
|
* inside a shell entry, when the route's `ppr` option does not set
|
|
@@ -444,6 +415,7 @@ export interface ShellCaptureDebugEvent {
|
|
|
444
415
|
* the key (stampede guard) and scheduled nothing
|
|
445
416
|
* - skip-backoff: the key is inside its refused-capture backoff window and
|
|
446
417
|
* the capture was not attempted
|
|
418
|
+
* - skip-capacity: the isolate capture queue is full; a later request may retry
|
|
447
419
|
* - backoff: the key entered (or escalated) backoff after a terminal
|
|
448
420
|
* no-shell — carries the new backoff state
|
|
449
421
|
*/
|
|
@@ -455,6 +427,7 @@ export interface ShellCaptureDebugEvent {
|
|
|
455
427
|
| "error"
|
|
456
428
|
| "skip-in-flight"
|
|
457
429
|
| "skip-backoff"
|
|
430
|
+
| "skip-capacity"
|
|
458
431
|
| "backoff";
|
|
459
432
|
/** Attempt number (1 = first, 2 = in-place retry). Absent on skips. */
|
|
460
433
|
attempt?: number;
|
|
@@ -476,6 +449,8 @@ export interface ShellCaptureDebugEvent {
|
|
|
476
449
|
snapshotBytes?: number;
|
|
477
450
|
/** True when the snapshot exceeded maxSnapshotBytes and was dropped. */
|
|
478
451
|
snapshotSkipped?: boolean;
|
|
452
|
+
/** A bake-lane loader settled into a shell that uses TTL/SWR-only invalidation. */
|
|
453
|
+
untaggedBake?: true;
|
|
479
454
|
/** Outcome reported by a store that supports shell-write acknowledgements. */
|
|
480
455
|
storeWrite?: "stored" | "invalidated";
|
|
481
456
|
/** Consecutive failure count in the key's backoff entry, when one exists. */
|
|
@@ -518,6 +493,7 @@ export function describeShellCaptureEvent(
|
|
|
518
493
|
`snapshot=${event.snapshotBytes}b${event.snapshotSkipped ? " (over cap, skipped)" : ""}`,
|
|
519
494
|
);
|
|
520
495
|
}
|
|
496
|
+
if (event.untaggedBake) parts.push("untagged-bake");
|
|
521
497
|
if (event.storeWrite !== undefined) {
|
|
522
498
|
parts.push(`store-write=${event.storeWrite}`);
|
|
523
499
|
}
|
|
@@ -835,6 +811,8 @@ export interface ShellCaptureDescriptor {
|
|
|
835
811
|
* {@link ShellCaptureDebugEvent} per attempt/skip.
|
|
836
812
|
*/
|
|
837
813
|
debugSink?: (event: ShellCaptureDebugEvent) => void;
|
|
814
|
+
/** Store the snapshot for navigation replay, never the captured HTML prelude. */
|
|
815
|
+
navigationOnly?: true;
|
|
838
816
|
}
|
|
839
817
|
|
|
840
818
|
/**
|
|
@@ -844,9 +822,9 @@ export interface ShellCaptureDescriptor {
|
|
|
844
822
|
* error is routed through reportCacheError — capture is best-effort; a failure just
|
|
845
823
|
* means the next request recaptures.
|
|
846
824
|
*
|
|
847
|
-
* Eligibility (nonce/
|
|
848
|
-
*
|
|
849
|
-
*
|
|
825
|
+
* Eligibility (nonce/partial/status/strategy) is decided by the caller. An SSR
|
|
826
|
+
* module loader may be passed for cold partial requests; it runs only after the
|
|
827
|
+
* capture enters the guarded background queue, never on response latency.
|
|
850
828
|
*/
|
|
851
829
|
export function scheduleShellCapture(
|
|
852
830
|
ctx: HandlerContext<any>,
|
|
@@ -854,7 +832,9 @@ export function scheduleShellCapture(
|
|
|
854
832
|
env: any,
|
|
855
833
|
url: URL,
|
|
856
834
|
reqCtx: RequestContext<any>,
|
|
857
|
-
ssrModule:
|
|
835
|
+
ssrModule:
|
|
836
|
+
| SSRModule
|
|
837
|
+
| ((request: Request, url: URL) => Promise<SSRModule | null>),
|
|
858
838
|
descriptor: ShellCaptureDescriptor,
|
|
859
839
|
): void {
|
|
860
840
|
const key = descriptor.key;
|
|
@@ -875,13 +855,30 @@ export function scheduleShellCapture(
|
|
|
875
855
|
inFlightCaptures.add(key);
|
|
876
856
|
const captureTask = async () => {
|
|
877
857
|
try {
|
|
858
|
+
const setupUrl = descriptor.navigationOnly
|
|
859
|
+
? stripInternalParams(url)
|
|
860
|
+
: url;
|
|
861
|
+
const setupRequest = descriptor.navigationOnly
|
|
862
|
+
? createNavigationCaptureRequest(request, setupUrl)
|
|
863
|
+
: request;
|
|
864
|
+
const resolvedSsrModule =
|
|
865
|
+
typeof ssrModule === "function"
|
|
866
|
+
? await ssrModule(setupRequest, setupUrl)
|
|
867
|
+
: ssrModule;
|
|
868
|
+
if (
|
|
869
|
+
!resolvedSsrModule ||
|
|
870
|
+
!resolvedSsrModule.resumeShellHTML ||
|
|
871
|
+
!resolvedSsrModule.captureShellHTML
|
|
872
|
+
) {
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
878
875
|
const outcome = await runShellCapture(
|
|
879
876
|
ctx,
|
|
880
877
|
request,
|
|
881
878
|
env,
|
|
882
879
|
url,
|
|
883
880
|
reqCtx,
|
|
884
|
-
|
|
881
|
+
resolvedSsrModule,
|
|
885
882
|
descriptor,
|
|
886
883
|
);
|
|
887
884
|
// Update the negative cache off the terminal outcome. A stored shell clears
|
|
@@ -917,7 +914,21 @@ export function scheduleShellCapture(
|
|
|
917
914
|
// capture makes the sibling freeze a trivial prelude and store nothing
|
|
918
915
|
// (rotating eternal-MISS victims on GH runners). The stampede guard above
|
|
919
916
|
// stays per-key (dedupe while queued); the queue is cross-key.
|
|
920
|
-
const serializedTask = () =>
|
|
917
|
+
const serializedTask = async () => {
|
|
918
|
+
try {
|
|
919
|
+
await enqueueSerializedCapture(captureTask);
|
|
920
|
+
} catch (error) {
|
|
921
|
+
if (error instanceof CaptureQueueFullError) {
|
|
922
|
+
inFlightCaptures.delete(key);
|
|
923
|
+
publishCaptureDebugEvent(descriptor, {
|
|
924
|
+
key,
|
|
925
|
+
outcome: "skip-capacity",
|
|
926
|
+
});
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
throw error;
|
|
930
|
+
}
|
|
931
|
+
};
|
|
921
932
|
// The capture's own task must NOT enter reqCtx._pendingBackgroundTasks: the
|
|
922
933
|
// capture drains that list before rendering (the write-barrier ordering edge),
|
|
923
934
|
// and awaiting its own still-running promise would burn the whole barrier
|
|
@@ -939,6 +950,22 @@ export function scheduleShellCapture(
|
|
|
939
950
|
*/
|
|
940
951
|
type CaptureAttemptOutcome = "stored" | "redirect" | "no-shell" | "refused";
|
|
941
952
|
|
|
953
|
+
function createNavigationCaptureRequest(request: Request, url: URL): Request {
|
|
954
|
+
const headers = new Headers(request.headers);
|
|
955
|
+
headers.set("accept", "text/html");
|
|
956
|
+
for (const name of [
|
|
957
|
+
"rsc-action",
|
|
958
|
+
"x-rango-prefetch",
|
|
959
|
+
"x-rango-state",
|
|
960
|
+
"x-rsc-hmr",
|
|
961
|
+
"x-rsc-router-client-path",
|
|
962
|
+
"x-rsc-router-intercept-source",
|
|
963
|
+
]) {
|
|
964
|
+
headers.delete(name);
|
|
965
|
+
}
|
|
966
|
+
return new Request(url, { method: request.method, headers });
|
|
967
|
+
}
|
|
968
|
+
|
|
942
969
|
/**
|
|
943
970
|
* Per-attempt observability fields, filled along the capture path (barrier in
|
|
944
971
|
* attemptCapture, the rest in captureAndStoreShell) and folded into the
|
|
@@ -953,6 +980,7 @@ type CaptureAttemptStats = Pick<
|
|
|
953
980
|
| "preludeBytes"
|
|
954
981
|
| "snapshotBytes"
|
|
955
982
|
| "snapshotSkipped"
|
|
983
|
+
| "untaggedBake"
|
|
956
984
|
| "storeWrite"
|
|
957
985
|
>;
|
|
958
986
|
|
|
@@ -984,6 +1012,10 @@ async function runShellCapture(
|
|
|
984
1012
|
descriptor: ShellCaptureDescriptor,
|
|
985
1013
|
retryDelayMs: number = SHELL_CAPTURE_RETRY_DELAY_MS,
|
|
986
1014
|
): Promise<CaptureAttemptOutcome> {
|
|
1015
|
+
const captureUrl = descriptor.navigationOnly ? stripInternalParams(url) : url;
|
|
1016
|
+
const captureRequest = descriptor.navigationOnly
|
|
1017
|
+
? createNavigationCaptureRequest(request, captureUrl)
|
|
1018
|
+
: request;
|
|
987
1019
|
const log = descriptor.debug
|
|
988
1020
|
? (message: string) => console.log(message)
|
|
989
1021
|
: () => {};
|
|
@@ -1000,9 +1032,9 @@ async function runShellCapture(
|
|
|
1000
1032
|
const start = performance.now();
|
|
1001
1033
|
const outcome = await attemptCapture(
|
|
1002
1034
|
ctx,
|
|
1003
|
-
|
|
1035
|
+
captureRequest,
|
|
1004
1036
|
env,
|
|
1005
|
-
|
|
1037
|
+
captureUrl,
|
|
1006
1038
|
reqCtx,
|
|
1007
1039
|
ssrModule,
|
|
1008
1040
|
descriptor,
|
|
@@ -1122,6 +1154,7 @@ async function attemptCapture(
|
|
|
1122
1154
|
const { derivedCtx, freshHandleStore } = deriveShellCaptureContext(
|
|
1123
1155
|
reqCtx,
|
|
1124
1156
|
descriptor,
|
|
1157
|
+
descriptor.navigationOnly ? { request, url } : undefined,
|
|
1125
1158
|
);
|
|
1126
1159
|
const captureStartedAt = Date.now();
|
|
1127
1160
|
|
|
@@ -1195,6 +1228,7 @@ export interface CaptureContextDerivation {
|
|
|
1195
1228
|
export function deriveShellCaptureContext(
|
|
1196
1229
|
reqCtx: RequestContext<any>,
|
|
1197
1230
|
descriptor: Pick<ShellCaptureDescriptor, "ttl" | "swr">,
|
|
1231
|
+
identity?: { request: Request; url: URL },
|
|
1198
1232
|
): CaptureContextDerivation {
|
|
1199
1233
|
const freshHandleStore = createHandleStore();
|
|
1200
1234
|
freshHandleStore.onError = reqCtx._handleStore.onError;
|
|
@@ -1266,6 +1300,13 @@ export function deriveShellCaptureContext(
|
|
|
1266
1300
|
};
|
|
1267
1301
|
|
|
1268
1302
|
const derivedCtx: RequestContext = Object.create(reqCtx);
|
|
1303
|
+
if (identity) {
|
|
1304
|
+
derivedCtx.request = identity.request;
|
|
1305
|
+
derivedCtx.url = identity.url;
|
|
1306
|
+
derivedCtx.originalUrl = new URL(identity.url);
|
|
1307
|
+
derivedCtx.pathname = identity.url.pathname;
|
|
1308
|
+
derivedCtx.searchParams = identity.url.searchParams;
|
|
1309
|
+
}
|
|
1269
1310
|
derivedCtx._handleStore = freshHandleStore;
|
|
1270
1311
|
// Own render barrier, closure-bound to the derived ctx and the fresh store
|
|
1271
1312
|
// (issue #684, plan 009). Without this every _renderBarrier* read fell
|
|
@@ -1553,7 +1594,7 @@ async function captureAndStoreShell(
|
|
|
1553
1594
|
const loaderRecords = reqCtx._shellCaptureLoaderRecords;
|
|
1554
1595
|
// Set once a bake-lane loader settles with real (non-hole) material: its data
|
|
1555
1596
|
// is frozen into the shell prelude regardless of whether snapshot
|
|
1556
|
-
// serialization succeeds. Drives the
|
|
1597
|
+
// serialization succeeds. Drives the opt-in debug metadata below.
|
|
1557
1598
|
let bakedLoaderMaterial = false;
|
|
1558
1599
|
if (loaderRecords && loaderRecords.size > 0) {
|
|
1559
1600
|
// The codec import is deferred past the elide probes: a rejected record
|
|
@@ -1638,13 +1679,15 @@ async function captureAndStoreShell(
|
|
|
1638
1679
|
const union = new Set<string>([...(capture.tags ?? []), ...collected]);
|
|
1639
1680
|
const shellTags = union.size > 0 ? [...union] : undefined;
|
|
1640
1681
|
|
|
1641
|
-
//
|
|
1642
|
-
//
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1682
|
+
// Missing tags are valid: the shell follows TTL/SWR-only invalidation. Expose
|
|
1683
|
+
// that choice only to operators who enabled structured capture diagnostics.
|
|
1684
|
+
if (
|
|
1685
|
+
capture.debugSink &&
|
|
1686
|
+
stats &&
|
|
1687
|
+
bakedLoaderMaterial &&
|
|
1688
|
+
shellTags === undefined
|
|
1689
|
+
) {
|
|
1690
|
+
stats.untaggedBake = true;
|
|
1648
1691
|
}
|
|
1649
1692
|
|
|
1650
1693
|
const store = capture.store ?? reqCtx._cacheStore;
|
|
@@ -1664,6 +1707,7 @@ async function captureAndStoreShell(
|
|
|
1664
1707
|
// ShellCacheEntry.initialTheme.
|
|
1665
1708
|
initialTheme: reqCtx.theme,
|
|
1666
1709
|
snapshot,
|
|
1710
|
+
navigationOnly: capture.navigationOnly,
|
|
1667
1711
|
// Handler-layer liveness folded at the barrier: nested thenables in
|
|
1668
1712
|
// handler-scoped pushes, handler pushes still pending (liveness
|
|
1669
1713
|
// unknowable), or a handler-invoked loader execution — any of them
|
package/src/rsc/shell-serve.ts
CHANGED
|
@@ -20,10 +20,14 @@ import React from "react";
|
|
|
20
20
|
import { isPprEntry, type EntryData } from "../server/context.js";
|
|
21
21
|
import { sortedSearchString } from "../cache/cache-key-utils.js";
|
|
22
22
|
import type { ShellCacheEntry, SegmentCacheStore } from "../cache/types.js";
|
|
23
|
+
import { SHELL_CAPTURE_MAX_WAIT_MS } from "./shell-capture-constants.js";
|
|
23
24
|
|
|
24
25
|
/** Debug/status header the browser (and e2e assertions) can read: HIT | MISS. */
|
|
25
26
|
export const SHELL_STATUS_HEADER = "x-rango-shell";
|
|
26
27
|
|
|
28
|
+
/** Partial-navigation status header set only after captured PPR segments are consumed. */
|
|
29
|
+
export const PPR_REPLAY_STATUS_HEADER = "x-rango-ppr-replay";
|
|
30
|
+
|
|
27
31
|
/**
|
|
28
32
|
* Default shell ttl (seconds) for `ppr: true` and for a PartialPrerenderProps
|
|
29
33
|
* that omits `ttl`.
|
|
@@ -59,9 +63,10 @@ export interface ResolvedPprConfig {
|
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
|
-
* Validate the raw `ppr.captureTimeout` option: a finite number >= 1ms
|
|
63
|
-
*
|
|
64
|
-
* resolves to undefined, which means "use
|
|
66
|
+
* Validate the raw `ppr.captureTimeout` option: a finite number >= 1ms is
|
|
67
|
+
* clamped to the default ceiling; anything else (including
|
|
68
|
+
* 0/negative/NaN/Infinity/non-number) resolves to undefined, which means "use
|
|
69
|
+
* the capture default" downstream.
|
|
65
70
|
* Mirrors the prefetch-limit option policy: invalid values silently fall back
|
|
66
71
|
* to the default rather than throwing at request time. Also the boundary
|
|
67
72
|
* re-normalizer for the dev /__rsc_shell endpoint (vite/router-discovery.ts),
|
|
@@ -69,7 +74,7 @@ export interface ResolvedPprConfig {
|
|
|
69
74
|
*/
|
|
70
75
|
export function normalizeCaptureTimeout(value: unknown): number | undefined {
|
|
71
76
|
return typeof value === "number" && Number.isFinite(value) && value >= 1
|
|
72
|
-
? value
|
|
77
|
+
? Math.min(value, SHELL_CAPTURE_MAX_WAIT_MS)
|
|
73
78
|
: undefined;
|
|
74
79
|
}
|
|
75
80
|
|
|
@@ -1,41 +1,58 @@
|
|
|
1
1
|
import type { MatchResult } from "../types.js";
|
|
2
|
-
import type { TransitionWhenContext } from "../types/segments.js";
|
|
3
2
|
import type { getRequestContext } from "../server/request-context.js";
|
|
4
3
|
import { invokeOnError } from "../router/error-handling.js";
|
|
5
4
|
import type { OnErrorCallback } from "../types/error-types.js";
|
|
5
|
+
import { createTransitionWhenContext } from "../router/transition-when.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Apply transition({ when }) gates to a payload's segments.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* to the router's onError (phase "rendering") and then treated as "do not hold"
|
|
16
|
-
* (conservative), so a buggy predicate degrades to no transition rather than
|
|
17
|
-
* failing the response.
|
|
10
|
+
* PPR predicates were evaluated from the manifest before cache lookup and route
|
|
11
|
+
* handlers; their request-specific decisions are projected onto a copy so they
|
|
12
|
+
* never mutate reusable cache/prerender/shell records. Ordinary-route predicates
|
|
13
|
+
* were collected during fresh resolution and are evaluated here after handlers.
|
|
14
|
+
* Both paths drop the segment transition when the predicate does not hold.
|
|
18
15
|
*
|
|
19
16
|
* Mutating the segments here is safe: the segment cache stores a serialized copy
|
|
20
17
|
* (segment-codec), written during match() BEFORE this gate runs, so dropping a
|
|
21
|
-
* transition never corrupts a cache entry.
|
|
18
|
+
* transition never corrupts a cache entry. On an ordinary route, a cache hit
|
|
22
19
|
* skips resolution, collects no predicate, and replays the cached transition
|
|
23
|
-
* as-is (it was serialized before the gate)
|
|
24
|
-
*
|
|
25
|
-
* avoid caching a route whose transition decision is request-dependent.
|
|
20
|
+
* as-is (it was serialized before the gate). PPR routes are the exception: their
|
|
21
|
+
* manifest predicates were evaluated before lookup and apply to replayed data.
|
|
26
22
|
*
|
|
27
|
-
* Returns the same array
|
|
28
|
-
*
|
|
23
|
+
* Returns the same array for the ordinary post-handler path. A PPR drop returns a
|
|
24
|
+
* copy containing only the request-specific transition changes.
|
|
29
25
|
*/
|
|
30
26
|
export function gateTransitions(
|
|
31
27
|
segments: MatchResult["segments"],
|
|
32
28
|
ctx: ReturnType<typeof getRequestContext>,
|
|
33
29
|
onError?: OnErrorCallback,
|
|
34
30
|
): MatchResult["segments"] {
|
|
31
|
+
const pprDecisions = ctx._pprTransitionDecisions;
|
|
32
|
+
let gatedSegments = segments;
|
|
33
|
+
|
|
34
|
+
const dropTransition = (id: string): void => {
|
|
35
|
+
const index = gatedSegments.findIndex((segment) => segment.id === id);
|
|
36
|
+
if (index === -1) return;
|
|
37
|
+
if (!pprDecisions) {
|
|
38
|
+
gatedSegments[index].transition = undefined;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (gatedSegments === segments) gatedSegments = [...segments];
|
|
42
|
+
gatedSegments[index] = {
|
|
43
|
+
...gatedSegments[index],
|
|
44
|
+
transition: undefined,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (pprDecisions) {
|
|
49
|
+
for (const [id, keep] of pprDecisions) {
|
|
50
|
+
if (!keep) dropTransition(id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
35
53
|
const predicates = ctx._transitionWhen;
|
|
36
|
-
if (predicates
|
|
54
|
+
if (predicates) {
|
|
37
55
|
for (const { id, when } of predicates) {
|
|
38
|
-
let drop: boolean;
|
|
39
56
|
try {
|
|
40
57
|
// Assemble the ShouldRevalidateFn-shaped predicate context from the
|
|
41
58
|
// request context. Source fields (currentUrl/currentParams/fromRouteName)
|
|
@@ -44,28 +61,11 @@ export function gateTransitions(
|
|
|
44
61
|
// method/get/env come straight off ctx (setRequestContextParams ran
|
|
45
62
|
// before the gate). Source/action fields are undefined when absent —
|
|
46
63
|
// never fabricated (see TransitionWhenContext).
|
|
47
|
-
|
|
48
|
-
currentUrl: ctx._gateCurrentUrl,
|
|
49
|
-
currentParams: ctx._gateCurrentParams,
|
|
50
|
-
fromRouteName:
|
|
51
|
-
ctx._prevRouteKey as TransitionWhenContext["fromRouteName"],
|
|
52
|
-
nextUrl: ctx.url,
|
|
53
|
-
nextParams: ctx.params,
|
|
54
|
-
toRouteName: ctx.routeName,
|
|
55
|
-
actionId: ctx._gateActionId,
|
|
56
|
-
actionUrl: ctx._gateActionUrl,
|
|
57
|
-
actionResult: ctx._gateActionResult,
|
|
58
|
-
formData: ctx._gateFormData,
|
|
59
|
-
method: ctx.request.method,
|
|
60
|
-
get: ctx.get,
|
|
61
|
-
env: ctx.env,
|
|
62
|
-
};
|
|
63
|
-
drop = when(whenCtx) === false;
|
|
64
|
+
if (when(createTransitionWhenContext(ctx)) !== false) continue;
|
|
64
65
|
} catch (error) {
|
|
65
66
|
// A throwing predicate must not fail the response: report it and treat
|
|
66
67
|
// the transition as gated off (do not hold). invokeOnError no-ops when
|
|
67
68
|
// onError is undefined.
|
|
68
|
-
drop = true;
|
|
69
69
|
invokeOnError(
|
|
70
70
|
onError,
|
|
71
71
|
error,
|
|
@@ -79,11 +79,8 @@ export function gateTransitions(
|
|
|
79
79
|
"RSC",
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
const seg = segments.find((s) => s.id === id);
|
|
84
|
-
if (seg) seg.transition = undefined;
|
|
85
|
-
}
|
|
82
|
+
dropTransition(id);
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
|
-
return
|
|
85
|
+
return gatedSegments;
|
|
89
86
|
}
|
package/src/rsc/types.ts
CHANGED
|
@@ -49,6 +49,8 @@ export interface RscPayload {
|
|
|
49
49
|
prefetchCacheSize?: number;
|
|
50
50
|
/** Max concurrent speculative prefetch requests on the client */
|
|
51
51
|
prefetchConcurrency?: number;
|
|
52
|
+
/** Router-wide default prefetch strategy for Links without a `prefetch` prop */
|
|
53
|
+
defaultPrefetch?: import("../router/prefetch-default.js").PrefetchStrategy;
|
|
52
54
|
/** Server-resolved rango state cookie name; the client reads it verbatim. */
|
|
53
55
|
stateCookieName?: string;
|
|
54
56
|
/** Theme configuration for FOUC prevention */
|
|
@@ -208,6 +208,9 @@ export interface RequestContext<
|
|
|
208
208
|
*/
|
|
209
209
|
_transitionWhen?: Array<{ id: string; when: TransitionWhenFn }>;
|
|
210
210
|
|
|
211
|
+
/** @internal PPR transition decisions evaluated before cache lookup/handlers. */
|
|
212
|
+
_pprTransitionDecisions?: Map<string, boolean>;
|
|
213
|
+
|
|
211
214
|
/** @internal Cache store for segment caching (optional, used by CacheScope) */
|
|
212
215
|
_cacheStore?: SegmentCacheStore;
|
|
213
216
|
|
|
@@ -276,6 +279,8 @@ export interface RequestContext<
|
|
|
276
279
|
* segment record even when the triggering request is partial.
|
|
277
280
|
*/
|
|
278
281
|
keyPrefix?: "doc";
|
|
282
|
+
/** @internal Called only after the implicit cache hit decodes successfully. */
|
|
283
|
+
onHit?: () => void;
|
|
279
284
|
};
|
|
280
285
|
|
|
281
286
|
/**
|
|
@@ -650,6 +655,7 @@ export type PublicRequestContext<
|
|
|
650
655
|
| "deleteCookie"
|
|
651
656
|
| "_handleStore"
|
|
652
657
|
| "_transitionWhen"
|
|
658
|
+
| "_pprTransitionDecisions"
|
|
653
659
|
| "_cacheStore"
|
|
654
660
|
| "_shellCaptureRun"
|
|
655
661
|
| "_shellImplicitCache"
|
package/src/testing/e2e/index.ts
CHANGED
|
@@ -5,12 +5,15 @@ import {
|
|
|
5
5
|
type FixtureOptions,
|
|
6
6
|
} from "./fixture.js";
|
|
7
7
|
import {
|
|
8
|
+
blockPrefetch,
|
|
9
|
+
unblockPrefetch,
|
|
8
10
|
createPageHelpers,
|
|
9
11
|
createStopwatch,
|
|
10
12
|
getHistoryState,
|
|
11
13
|
getNumericContent,
|
|
12
14
|
goBack,
|
|
13
15
|
goForward,
|
|
16
|
+
isPrefetchRequest,
|
|
14
17
|
isVisibleInViewport,
|
|
15
18
|
measureTime,
|
|
16
19
|
type PageHelpers,
|
|
@@ -41,10 +44,15 @@ export {
|
|
|
41
44
|
type CacheStatusTarget,
|
|
42
45
|
} from "../cache-status.js";
|
|
43
46
|
export {
|
|
47
|
+
assertPprReplayStatus,
|
|
44
48
|
assertShellStatus,
|
|
49
|
+
parsePprReplayStatus,
|
|
45
50
|
parseShellStatus,
|
|
51
|
+
PPR_REPLAY_STATUS_HEADER,
|
|
46
52
|
shellCacheKey,
|
|
47
53
|
SHELL_STATUS_HEADER,
|
|
54
|
+
type PprReplayBypassReason,
|
|
55
|
+
type PprReplayStatus,
|
|
48
56
|
type ShellStatus,
|
|
49
57
|
type ShellStatusTarget,
|
|
50
58
|
} from "../shell-status.js";
|
|
@@ -57,6 +65,9 @@ export {
|
|
|
57
65
|
getHistoryState,
|
|
58
66
|
waitForElement,
|
|
59
67
|
isVisibleInViewport,
|
|
68
|
+
isPrefetchRequest,
|
|
69
|
+
blockPrefetch,
|
|
70
|
+
unblockPrefetch,
|
|
60
71
|
parseNumber,
|
|
61
72
|
getNumericContent,
|
|
62
73
|
createStopwatch,
|
|
@@ -159,6 +159,53 @@ export async function measureTime<T>(
|
|
|
159
159
|
return { elapsed, result };
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
/**
|
|
163
|
+
* True when the request is a speculative prefetch (Link viewport/hover/render
|
|
164
|
+
* strategies or `useRouter().prefetch()`). Every prefetch fetch carries the
|
|
165
|
+
* `X-Rango-Prefetch` header. Links prefetch by default in production unless
|
|
166
|
+
* the router opts out, so tests that track `_rsc_partial` requests to pin
|
|
167
|
+
* NAVIGATION behavior must skip these — a request-count or first-request
|
|
168
|
+
* assertion otherwise races background prefetch traffic.
|
|
169
|
+
*/
|
|
170
|
+
export function isPrefetchRequest(req: {
|
|
171
|
+
headers: () => Record<string, string>;
|
|
172
|
+
}): boolean {
|
|
173
|
+
return !!req.headers()["x-rango-prefetch"];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Module-level matcher + handler so blockPrefetch/unblockPrefetch share
|
|
177
|
+
// stable references — Playwright's unroute matches by identity.
|
|
178
|
+
const rscPartialUrl = (url: URL): boolean =>
|
|
179
|
+
url.searchParams.has("_rsc_partial");
|
|
180
|
+
async function abortPrefetchRoute(
|
|
181
|
+
route: import("@playwright/test").Route,
|
|
182
|
+
): Promise<void> {
|
|
183
|
+
if (isPrefetchRequest(route.request())) {
|
|
184
|
+
await route.abort("aborted");
|
|
185
|
+
} else {
|
|
186
|
+
await route.fallback();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Abort every speculative prefetch request on this page. Install BEFORE
|
|
192
|
+
* `page.goto` so no prefetch can complete first. For tests whose semantics
|
|
193
|
+
* need a virgin prefetch cache: a click on a Link whose target was already
|
|
194
|
+
* prefetched ADOPTS the warmed entry and issues no navigation fetch at all —
|
|
195
|
+
* a `page.route` override, a request waiter, or a Set-Cookie assertion aimed
|
|
196
|
+
* at the navigation request then sees nothing (or sees the prefetch's side
|
|
197
|
+
* effects instead). Aborted prefetches are benign by design (evicted, never
|
|
198
|
+
* adopted, no page error), so the click's real fetch is guaranteed live.
|
|
199
|
+
*/
|
|
200
|
+
export async function blockPrefetch(page: Page): Promise<void> {
|
|
201
|
+
await page.route(rscPartialUrl, abortPrefetchRoute);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Remove a `blockPrefetch` guard, restoring normal prefetch traffic. */
|
|
205
|
+
export async function unblockPrefetch(page: Page): Promise<void> {
|
|
206
|
+
await page.unroute(rscPartialUrl, abortPrefetchRoute);
|
|
207
|
+
}
|
|
208
|
+
|
|
162
209
|
// ============================================================================
|
|
163
210
|
// Factory-bound helpers (need the injected `expect`)
|
|
164
211
|
// ============================================================================
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { Expect, Page, TestType } from "@playwright/test";
|
|
8
8
|
import type { Fixture, FixtureOptions } from "./fixture.js";
|
|
9
9
|
import { DEFAULT_STATE_COOKIE_PREFIX } from "../../browser/cookie-name.js";
|
|
10
|
+
import { blockPrefetch, unblockPrefetch } from "./page-helpers.js";
|
|
10
11
|
|
|
11
12
|
export interface ParityDescribeOptions extends Partial<
|
|
12
13
|
Omit<FixtureOptions, "mode">
|
|
@@ -318,6 +319,15 @@ export function createParity({
|
|
|
318
319
|
// navigation away from it.
|
|
319
320
|
const originUrl = page.url();
|
|
320
321
|
|
|
322
|
+
// Exclude speculative prefetch traffic from the parity window. Links
|
|
323
|
+
// prefetch by default in production unless the router opts out, and a
|
|
324
|
+
// prefetched route's middleware/loader side effects
|
|
325
|
+
// (Set-Cookie, session state) land in the JS jar only — a no-JS context
|
|
326
|
+
// cannot prefetch, so that traffic would diverge the jars on requests the
|
|
327
|
+
// intent never caused. Aborted prefetches are benign by design (evicted,
|
|
328
|
+
// never adopted), so the intent's real navigation always fetches live.
|
|
329
|
+
await blockPrefetch(page);
|
|
330
|
+
|
|
321
331
|
// Settle the intent's observable effect before snapshotting. A `navigate`
|
|
322
332
|
// intent already awaited its navigation in applyIntent (page.goto), so only
|
|
323
333
|
// `submit` needs the DOM-driven settle, and only when no `waitFor` override
|
|
@@ -380,6 +390,9 @@ export function createParity({
|
|
|
380
390
|
);
|
|
381
391
|
} finally {
|
|
382
392
|
await noJsContext.close();
|
|
393
|
+
// Restore the caller's page: the prefetch guard is scoped to the parity
|
|
394
|
+
// window, not the rest of the test.
|
|
395
|
+
await unblockPrefetch(page);
|
|
383
396
|
}
|
|
384
397
|
}
|
|
385
398
|
|
package/src/testing/index.ts
CHANGED
|
@@ -77,12 +77,20 @@ export type {
|
|
|
77
77
|
} from "../router/telemetry.js";
|
|
78
78
|
|
|
79
79
|
export {
|
|
80
|
+
assertPprReplayStatus,
|
|
80
81
|
assertShellStatus,
|
|
82
|
+
parsePprReplayStatus,
|
|
81
83
|
parseShellStatus,
|
|
84
|
+
PPR_REPLAY_STATUS_HEADER,
|
|
82
85
|
shellCacheKey,
|
|
83
86
|
SHELL_STATUS_HEADER,
|
|
84
87
|
} from "./shell-status.js";
|
|
85
|
-
export type {
|
|
88
|
+
export type {
|
|
89
|
+
PprReplayBypassReason,
|
|
90
|
+
PprReplayStatus,
|
|
91
|
+
ShellStatus,
|
|
92
|
+
ShellStatusTarget,
|
|
93
|
+
} from "./shell-status.js";
|
|
86
94
|
|
|
87
95
|
export { collectHandle } from "./collect-handle.js";
|
|
88
96
|
|