@rangojs/router 0.2.0 → 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/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/types.d.ts +6 -0
- 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/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 +4 -3
- package/dist/types/rsc/types.d.ts +2 -0
- package/dist/types/testing/e2e/index.d.ts +2 -2
- package/dist/types/testing/e2e/page-helpers.d.ts +24 -0
- 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 +1 -1
- package/skills/comparison/references/framework-comparison.md +2 -1
- package/skills/ppr/SKILL.md +28 -13
- package/skills/router-setup/SKILL.md +4 -0
- 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/cf/cf-cache-store.ts +4 -0
- package/src/cache/types.ts +6 -0
- package/src/cache/vercel/vercel-cache-store.ts +6 -1
- 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.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/rsc-rendering.ts +120 -18
- package/src/rsc/shell-capture.ts +94 -50
- package/src/rsc/shell-serve.ts +6 -4
- package/src/rsc/types.ts +2 -0
- package/src/testing/e2e/index.ts +6 -0
- package/src/testing/e2e/page-helpers.ts +47 -0
- package/src/testing/e2e/parity.ts +13 -0
package/src/rsc/rsc-rendering.ts
CHANGED
|
@@ -68,7 +68,11 @@ import {
|
|
|
68
68
|
import { nonce as nonceToken } from "./nonce.js";
|
|
69
69
|
import { reportCacheError } from "../cache/cache-error.js";
|
|
70
70
|
import { INTERNAL_RANGO_DEBUG } from "../internal-debug.js";
|
|
71
|
-
import type {
|
|
71
|
+
import type {
|
|
72
|
+
SegmentCacheStore,
|
|
73
|
+
ShellCacheEntry,
|
|
74
|
+
ShellSnapshotRecord,
|
|
75
|
+
} from "../cache/types.js";
|
|
72
76
|
|
|
73
77
|
type PprReplayBypassReason =
|
|
74
78
|
| "method"
|
|
@@ -106,6 +110,43 @@ function describePprReplayStatus(status: PprReplayStatus): string {
|
|
|
106
110
|
: `bypass:${status.reason}`;
|
|
107
111
|
}
|
|
108
112
|
|
|
113
|
+
function buildNavigationShellKey(url: URL): string {
|
|
114
|
+
return `${buildShellKey(url)}:navigation`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function createShellCaptureDescriptor(
|
|
118
|
+
ctx: HandlerContext<any>,
|
|
119
|
+
key: string,
|
|
120
|
+
pprConfig: ResolvedPprConfig,
|
|
121
|
+
store: SegmentCacheStore<any>,
|
|
122
|
+
navigationOnly?: true,
|
|
123
|
+
): ShellCaptureDescriptor {
|
|
124
|
+
return {
|
|
125
|
+
key,
|
|
126
|
+
buildVersion: ctx.version,
|
|
127
|
+
ttl: pprConfig.ttl,
|
|
128
|
+
swr: pprConfig.swr,
|
|
129
|
+
tags: pprConfig.tags,
|
|
130
|
+
captureTimeout: pprConfig.captureTimeout,
|
|
131
|
+
store,
|
|
132
|
+
debug: INTERNAL_RANGO_DEBUG,
|
|
133
|
+
maxSnapshotBytes: pprConfig.maxSnapshotBytes,
|
|
134
|
+
debugSink: resolveShellCaptureDebugSink(ctx.router.debugShellCapture),
|
|
135
|
+
navigationOnly,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function shouldHealReplayMiss(
|
|
140
|
+
reason: PprReplayBypassReason | undefined,
|
|
141
|
+
): boolean {
|
|
142
|
+
return (
|
|
143
|
+
reason === undefined ||
|
|
144
|
+
reason === "invalid-version" ||
|
|
145
|
+
reason === "corrupt-entry" ||
|
|
146
|
+
reason === "stale-build-entry"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
109
150
|
function resolveDevShellLookup(
|
|
110
151
|
reqCtx: RequestContext<any>,
|
|
111
152
|
pprConfig: ResolvedPprConfig,
|
|
@@ -194,6 +235,7 @@ async function handleRscRenderingInner<TEnv>(
|
|
|
194
235
|
let payload: RscPayload;
|
|
195
236
|
let hasInterceptSlots = false;
|
|
196
237
|
let pprReplayStatus: PprReplayStatus | undefined;
|
|
238
|
+
let partialCaptureNeeded = false;
|
|
197
239
|
|
|
198
240
|
// --- Axis 2: integrated PPR shell serve (docs/design/ppr-shell-resume.md) ---
|
|
199
241
|
//
|
|
@@ -280,23 +322,12 @@ async function handleRscRenderingInner<TEnv>(
|
|
|
280
322
|
ssrModule.resumeShellHTML &&
|
|
281
323
|
ssrModule.captureShellHTML
|
|
282
324
|
) {
|
|
283
|
-
const descriptor
|
|
325
|
+
const descriptor = createShellCaptureDescriptor(
|
|
326
|
+
ctx,
|
|
284
327
|
key,
|
|
285
|
-
|
|
286
|
-
ttl: pprConfig.ttl,
|
|
287
|
-
swr: pprConfig.swr,
|
|
288
|
-
tags: pprConfig.tags,
|
|
289
|
-
captureTimeout: pprConfig.captureTimeout,
|
|
328
|
+
pprConfig,
|
|
290
329
|
store,
|
|
291
|
-
|
|
292
|
-
maxSnapshotBytes: pprConfig.maxSnapshotBytes,
|
|
293
|
-
// The resolver owns the whole policy: option wins, the
|
|
294
|
-
// INTERNAL_RANGO_DEBUG env flag lights the events up when no
|
|
295
|
-
// option is set, an explicit `false` stays off.
|
|
296
|
-
debugSink: resolveShellCaptureDebugSink(
|
|
297
|
-
ctx.router.debugShellCapture,
|
|
298
|
-
),
|
|
299
|
-
};
|
|
330
|
+
);
|
|
300
331
|
// One serve funnel for BOTH entry sources (runtime store hit below,
|
|
301
332
|
// build-manifest hit further down): schedule the background
|
|
302
333
|
// recapture when asked, then commit the composed response.
|
|
@@ -347,7 +378,11 @@ async function handleRscRenderingInner<TEnv>(
|
|
|
347
378
|
cached ? "hit" : "miss",
|
|
348
379
|
);
|
|
349
380
|
}
|
|
350
|
-
if (
|
|
381
|
+
if (
|
|
382
|
+
cached &&
|
|
383
|
+
!cached.entry.navigationOnly &&
|
|
384
|
+
isValidShellHit(cached.entry, ctx.version)
|
|
385
|
+
) {
|
|
351
386
|
if (!hasIntactShellPayload(cached.entry)) {
|
|
352
387
|
// Corrupt stored payload (undecodable prelude / unparseable
|
|
353
388
|
// postponed): a store-layer fault worth a diagnostic, unlike the
|
|
@@ -407,6 +442,8 @@ async function handleRscRenderingInner<TEnv>(
|
|
|
407
442
|
);
|
|
408
443
|
const result = replay.result;
|
|
409
444
|
pprReplayStatus = replay.status;
|
|
445
|
+
partialCaptureNeeded =
|
|
446
|
+
"captureNeeded" in replay && replay.captureNeeded === true;
|
|
410
447
|
|
|
411
448
|
if (!result) {
|
|
412
449
|
// Fall back to full render
|
|
@@ -462,6 +499,7 @@ async function handleRscRenderingInner<TEnv>(
|
|
|
462
499
|
prefetchCacheTTL: ctx.router.prefetchCacheTTL,
|
|
463
500
|
prefetchCacheSize: ctx.router.prefetchCacheSize,
|
|
464
501
|
prefetchConcurrency: ctx.router.prefetchConcurrency,
|
|
502
|
+
defaultPrefetch: ctx.router.defaultPrefetch,
|
|
465
503
|
stateCookieName: ctx.router.resolvedStateCookieName,
|
|
466
504
|
},
|
|
467
505
|
};
|
|
@@ -607,6 +645,40 @@ async function handleRscRenderingInner<TEnv>(
|
|
|
607
645
|
response.headers.set(SHELL_STATUS_HEADER, "MISS");
|
|
608
646
|
}
|
|
609
647
|
|
|
648
|
+
if (
|
|
649
|
+
isPartial &&
|
|
650
|
+
partialCaptureNeeded &&
|
|
651
|
+
!reqCtx._dynamic &&
|
|
652
|
+
response.status === 200
|
|
653
|
+
) {
|
|
654
|
+
const pprConfig = resolvePprConfig(reqCtx._classifiedRoute?.manifestEntry)!;
|
|
655
|
+
const store = reqCtx._cacheStore!;
|
|
656
|
+
scheduleShellCapture(
|
|
657
|
+
ctx,
|
|
658
|
+
request,
|
|
659
|
+
env,
|
|
660
|
+
url,
|
|
661
|
+
reqCtx,
|
|
662
|
+
async (captureRequest, captureUrl) => {
|
|
663
|
+
const [ssrModule, streamMode] = await getSSRSetup(
|
|
664
|
+
ctx,
|
|
665
|
+
captureRequest,
|
|
666
|
+
env,
|
|
667
|
+
captureUrl,
|
|
668
|
+
undefined,
|
|
669
|
+
);
|
|
670
|
+
return streamMode === "allReady" ? null : ssrModule;
|
|
671
|
+
},
|
|
672
|
+
createShellCaptureDescriptor(
|
|
673
|
+
ctx,
|
|
674
|
+
buildNavigationShellKey(url),
|
|
675
|
+
pprConfig,
|
|
676
|
+
store,
|
|
677
|
+
true,
|
|
678
|
+
),
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
|
|
610
682
|
return response;
|
|
611
683
|
}
|
|
612
684
|
|
|
@@ -668,6 +740,7 @@ async function matchPartialWithPprReplay<TEnv>(
|
|
|
668
740
|
}
|
|
669
741
|
|
|
670
742
|
const key = buildShellKey(url);
|
|
743
|
+
const navigationKey = buildNavigationShellKey(url);
|
|
671
744
|
let cached: Awaited<ReturnType<typeof store.getShell>> = null;
|
|
672
745
|
try {
|
|
673
746
|
cached = await store.getShell(key, { claimRevalidation: false });
|
|
@@ -689,6 +762,34 @@ async function matchPartialWithPprReplay<TEnv>(
|
|
|
689
762
|
}
|
|
690
763
|
}
|
|
691
764
|
|
|
765
|
+
if (
|
|
766
|
+
!snapshot &&
|
|
767
|
+
bypassReason !== "handler-live-holes" &&
|
|
768
|
+
bypassReason !== "transition-when"
|
|
769
|
+
) {
|
|
770
|
+
let navigationCached: Awaited<ReturnType<typeof store.getShell>> = null;
|
|
771
|
+
try {
|
|
772
|
+
navigationCached = await store.getShell(navigationKey, {
|
|
773
|
+
claimRevalidation: false,
|
|
774
|
+
});
|
|
775
|
+
} catch (error) {
|
|
776
|
+
reportCacheError(error, "cache-read", "[NavigationPPR] getShell");
|
|
777
|
+
return runMatch({ outcome: "BYPASS", reason: "read-error" });
|
|
778
|
+
}
|
|
779
|
+
if (navigationCached) {
|
|
780
|
+
const decision = replayableShellSnapshot(
|
|
781
|
+
navigationCached.entry,
|
|
782
|
+
ctx.version,
|
|
783
|
+
);
|
|
784
|
+
if ("snapshot" in decision) {
|
|
785
|
+
snapshot = decision.snapshot;
|
|
786
|
+
freshness = navigationCached.shouldRevalidate ? "stale" : "fresh";
|
|
787
|
+
} else {
|
|
788
|
+
bypassReason = decision.reason;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
692
793
|
if (!snapshot) {
|
|
693
794
|
// Production build manifests are local module data. In dev, resolving a
|
|
694
795
|
// missing build shell would foreground-fetch /__rsc_shell and block an
|
|
@@ -710,10 +811,11 @@ async function matchPartialWithPprReplay<TEnv>(
|
|
|
710
811
|
}
|
|
711
812
|
|
|
712
813
|
if (!snapshot) {
|
|
713
|
-
|
|
814
|
+
const match = await runMatch({
|
|
714
815
|
outcome: "BYPASS",
|
|
715
816
|
reason: bypassReason ?? "no-entry",
|
|
716
817
|
});
|
|
818
|
+
return { ...match, captureNeeded: shouldHealReplayMiss(bypassReason) };
|
|
717
819
|
}
|
|
718
820
|
|
|
719
821
|
const previousImplicitCache = reqCtx._shellImplicitCache;
|
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,6 +20,7 @@ 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";
|
|
@@ -62,9 +63,10 @@ export interface ResolvedPprConfig {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
|
-
* Validate the raw `ppr.captureTimeout` option: a finite number >= 1ms
|
|
66
|
-
*
|
|
67
|
-
* 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.
|
|
68
70
|
* Mirrors the prefetch-limit option policy: invalid values silently fall back
|
|
69
71
|
* to the default rather than throwing at request time. Also the boundary
|
|
70
72
|
* re-normalizer for the dev /__rsc_shell endpoint (vite/router-discovery.ts),
|
|
@@ -72,7 +74,7 @@ export interface ResolvedPprConfig {
|
|
|
72
74
|
*/
|
|
73
75
|
export function normalizeCaptureTimeout(value: unknown): number | undefined {
|
|
74
76
|
return typeof value === "number" && Number.isFinite(value) && value >= 1
|
|
75
|
-
? value
|
|
77
|
+
? Math.min(value, SHELL_CAPTURE_MAX_WAIT_MS)
|
|
76
78
|
: undefined;
|
|
77
79
|
}
|
|
78
80
|
|
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 */
|
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,
|
|
@@ -62,6 +65,9 @@ export {
|
|
|
62
65
|
getHistoryState,
|
|
63
66
|
waitForElement,
|
|
64
67
|
isVisibleInViewport,
|
|
68
|
+
isPrefetchRequest,
|
|
69
|
+
blockPrefetch,
|
|
70
|
+
unblockPrefetch,
|
|
65
71
|
parseNumber,
|
|
66
72
|
getNumericContent,
|
|
67
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
|
|