@rangojs/router 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/dist/types/browser/event-controller.d.ts +4 -0
- package/dist/types/browser/link-interceptor.d.ts +17 -7
- package/dist/types/browser/navigation-bridge.d.ts +13 -1
- package/dist/types/browser/notify-listeners.d.ts +2 -0
- package/dist/types/browser/prefetch/cache.d.ts +1 -1
- package/dist/types/browser/prefetch/default-strategy.d.ts +12 -3
- package/dist/types/browser/prefetch/invalidation.d.ts +6 -0
- package/dist/types/browser/prefetch/loader.d.ts +3 -1
- package/dist/types/browser/prefetch/observer.d.ts +3 -6
- package/dist/types/browser/rango-state.d.ts +4 -0
- package/dist/types/browser/react/Link.d.ts +4 -9
- package/dist/types/browser/react/context.d.ts +3 -0
- package/dist/types/browser/rsc-router.d.ts +7 -2
- package/dist/types/browser/types.d.ts +1 -0
- package/dist/types/cache/cache-key-utils.d.ts +11 -3
- package/dist/types/cache/cache-scope.d.ts +82 -3
- package/dist/types/cache/cf/cf-cache-store.d.ts +2 -2
- package/dist/types/cache/index.d.ts +3 -1
- package/dist/types/cache/search-params-filter.d.ts +64 -0
- package/dist/types/cache/shell-snapshot.d.ts +4 -4
- package/dist/types/cache/types.d.ts +30 -2
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.rsc.d.ts +1 -0
- package/dist/types/router/match-middleware/cache-lookup.d.ts +13 -0
- package/dist/types/router/navigation-snapshot.d.ts +29 -0
- package/dist/types/router/router-options.d.ts +27 -3
- package/dist/types/rsc/shell-build-manifest.d.ts +7 -1
- package/dist/types/rsc/shell-serve.d.ts +7 -1
- package/dist/types/rsc/types.d.ts +17 -0
- package/dist/types/server/request-context.d.ts +57 -4
- package/dist/types/testing/render-route.d.ts +10 -1
- package/dist/types/testing/shell-status.d.ts +6 -3
- package/dist/types/vite/plugin-types.d.ts +1 -1
- package/dist/vite/index.js +5 -5
- package/package.json +23 -22
- package/skills/caching/SKILL.md +39 -0
- package/skills/comparison/references/framework-comparison.md +7 -1
- package/skills/links/SKILL.md +24 -0
- package/skills/ppr/SKILL.md +53 -4
- package/skills/router-setup/SKILL.md +7 -2
- package/skills/testing/client-components.md +15 -14
- package/skills/vercel/SKILL.md +1 -1
- package/src/browser/event-controller.ts +110 -11
- package/src/browser/link-interceptor.ts +469 -20
- package/src/browser/navigation-bridge.ts +71 -2
- package/src/browser/navigation-store.ts +24 -1
- package/src/browser/notify-listeners.ts +22 -0
- package/src/browser/prefetch/cache.ts +4 -2
- package/src/browser/prefetch/default-strategy.ts +43 -3
- package/src/browser/prefetch/invalidation.ts +30 -0
- package/src/browser/prefetch/loader.ts +19 -12
- package/src/browser/prefetch/observer.ts +50 -22
- package/src/browser/rango-state.ts +21 -0
- package/src/browser/react/Link.tsx +97 -88
- package/src/browser/react/NavigationProvider.tsx +1 -0
- package/src/browser/react/context.ts +4 -0
- package/src/browser/rsc-router.tsx +22 -9
- package/src/browser/types.ts +1 -0
- package/src/cache/cache-key-utils.ts +18 -4
- package/src/cache/cache-runtime.ts +7 -2
- package/src/cache/cache-scope.ts +152 -23
- package/src/cache/cf/cf-cache-store.ts +51 -16
- package/src/cache/document-cache.ts +7 -1
- package/src/cache/index.ts +7 -0
- package/src/cache/search-params-filter.ts +118 -0
- package/src/cache/shell-snapshot.ts +8 -4
- package/src/cache/types.ts +33 -2
- package/src/cache/vercel/vercel-cache-store.ts +17 -3
- package/src/index.rsc.ts +4 -0
- package/src/index.ts +6 -0
- package/src/router/match-middleware/cache-lookup.ts +146 -33
- package/src/router/match-middleware/cache-store.ts +70 -0
- package/src/router/navigation-snapshot.ts +46 -6
- package/src/router/router-options.ts +31 -4
- package/src/rsc/handler.ts +9 -0
- package/src/rsc/response-cache-serve.ts +1 -1
- package/src/rsc/rsc-rendering.ts +252 -27
- package/src/rsc/shell-build-manifest.ts +8 -1
- package/src/rsc/shell-capture.ts +5 -0
- package/src/rsc/shell-serve.ts +8 -2
- package/src/rsc/types.ts +17 -0
- package/src/server/request-context.ts +62 -3
- package/src/testing/dispatch.ts +21 -3
- package/src/testing/render-route.tsx +86 -17
- package/src/testing/shell-status.ts +20 -3
- package/src/vite/plugin-types.ts +1 -1
- package/src/vite/plugins/vercel-output.ts +2 -2
- package/dist/types.backup/__internal.d.ts +0 -127
- package/dist/types.backup/bin/rango.d.ts +0 -1
- package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
- package/dist/types.backup/browser/action-fence.d.ts +0 -33
- package/dist/types.backup/browser/app-shell.d.ts +0 -34
- package/dist/types.backup/browser/app-version.d.ts +0 -6
- package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
- package/dist/types.backup/browser/cookie-name.d.ts +0 -66
- package/dist/types.backup/browser/event-controller.d.ts +0 -221
- package/dist/types.backup/browser/history-state.d.ts +0 -26
- package/dist/types.backup/browser/index.d.ts +0 -1
- package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
- package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
- package/dist/types.backup/browser/logging.d.ts +0 -33
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
- package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
- package/dist/types.backup/browser/navigation-client.d.ts +0 -17
- package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
- package/dist/types.backup/browser/navigation-store.d.ts +0 -95
- package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
- package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
- package/dist/types.backup/browser/partial-update.d.ts +0 -61
- package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
- package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
- package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
- package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
- package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
- package/dist/types.backup/browser/rango-state.d.ts +0 -52
- package/dist/types.backup/browser/react/Link.d.ts +0 -140
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
- package/dist/types.backup/browser/react/context.d.ts +0 -54
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
- package/dist/types.backup/browser/react/index.d.ts +0 -1
- package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
- package/dist/types.backup/browser/react/location-state.d.ts +0 -29
- package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
- package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
- package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
- package/dist/types.backup/browser/react/use-action.d.ts +0 -61
- package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
- package/dist/types.backup/browser/react/use-href.d.ts +0 -32
- package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
- package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
- package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
- package/dist/types.backup/browser/react/use-params.d.ts +0 -21
- package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
- package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
- package/dist/types.backup/browser/react/use-router.d.ts +0 -23
- package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
- package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
- package/dist/types.backup/browser/response-adapter.d.ts +0 -58
- package/dist/types.backup/browser/rsc-router.d.ts +0 -141
- package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
- package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
- package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
- package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
- package/dist/types.backup/browser/types.d.ts +0 -530
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
- package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
- package/dist/types.backup/build/generate-manifest.d.ts +0 -100
- package/dist/types.backup/build/generate-route-types.d.ts +0 -8
- package/dist/types.backup/build/index.d.ts +0 -21
- package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
- package/dist/types.backup/build/route-trie.d.ts +0 -89
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
- package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
- package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
- package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
- package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
- package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
- package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
- package/dist/types.backup/cache/background-task.d.ts +0 -21
- package/dist/types.backup/cache/cache-error.d.ts +0 -71
- package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
- package/dist/types.backup/cache/cache-policy.d.ts +0 -59
- package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
- package/dist/types.backup/cache/cache-scope.d.ts +0 -134
- package/dist/types.backup/cache/cache-tag.d.ts +0 -79
- package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
- package/dist/types.backup/cache/cf/index.d.ts +0 -3
- package/dist/types.backup/cache/document-cache.d.ts +0 -69
- package/dist/types.backup/cache/handle-capture.d.ts +0 -23
- package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
- package/dist/types.backup/cache/index.d.ts +0 -7
- package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
- package/dist/types.backup/cache/profile-registry.d.ts +0 -40
- package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
- package/dist/types.backup/cache/segment-codec.d.ts +0 -78
- package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
- package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
- package/dist/types.backup/cache/taint.d.ts +0 -71
- package/dist/types.backup/cache/types.d.ts +0 -407
- package/dist/types.backup/cache/vercel/index.d.ts +0 -1
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
- package/dist/types.backup/client.d.ts +0 -184
- package/dist/types.backup/client.rsc.d.ts +0 -39
- package/dist/types.backup/cloudflare/index.d.ts +0 -7
- package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
- package/dist/types.backup/component-utils.d.ts +0 -46
- package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
- package/dist/types.backup/context-var.d.ts +0 -84
- package/dist/types.backup/debug.d.ts +0 -57
- package/dist/types.backup/decode-loader-results.d.ts +0 -5
- package/dist/types.backup/default-error-boundary.d.ts +0 -10
- package/dist/types.backup/defer.d.ts +0 -89
- package/dist/types.backup/deps/browser.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
- package/dist/types.backup/deps/rsc.d.ts +0 -1
- package/dist/types.backup/deps/ssr.d.ts +0 -1
- package/dist/types.backup/encode-kv.d.ts +0 -35
- package/dist/types.backup/errors.d.ts +0 -226
- package/dist/types.backup/escape-script.d.ts +0 -44
- package/dist/types.backup/handle.d.ts +0 -93
- package/dist/types.backup/handles/MetaTags.d.ts +0 -17
- package/dist/types.backup/handles/Scripts.d.ts +0 -38
- package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
- package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
- package/dist/types.backup/handles/is-thenable.d.ts +0 -12
- package/dist/types.backup/handles/meta.d.ts +0 -43
- package/dist/types.backup/handles/script.d.ts +0 -139
- package/dist/types.backup/host/cookie-handler.d.ts +0 -8
- package/dist/types.backup/host/errors.d.ts +0 -40
- package/dist/types.backup/host/index.d.ts +0 -33
- package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
- package/dist/types.backup/host/router.d.ts +0 -12
- package/dist/types.backup/host/testing.d.ts +0 -41
- package/dist/types.backup/host/types.d.ts +0 -148
- package/dist/types.backup/host/utils.d.ts +0 -20
- package/dist/types.backup/href-client.d.ts +0 -214
- package/dist/types.backup/index.d.ts +0 -112
- package/dist/types.backup/index.rsc.d.ts +0 -51
- package/dist/types.backup/internal-debug.d.ts +0 -1
- package/dist/types.backup/loader-store.d.ts +0 -193
- package/dist/types.backup/loader.d.ts +0 -18
- package/dist/types.backup/loader.rsc.d.ts +0 -18
- package/dist/types.backup/missing-id-error.d.ts +0 -1
- package/dist/types.backup/outlet-context.d.ts +0 -12
- package/dist/types.backup/outlet-provider.d.ts +0 -12
- package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
- package/dist/types.backup/prerender/param-hash.d.ts +0 -6
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
- package/dist/types.backup/prerender/store.d.ts +0 -62
- package/dist/types.backup/prerender.d.ts +0 -292
- package/dist/types.backup/redirect-origin.d.ts +0 -55
- package/dist/types.backup/regex-escape.d.ts +0 -6
- package/dist/types.backup/render-error-thrower.d.ts +0 -13
- package/dist/types.backup/response-utils.d.ts +0 -35
- package/dist/types.backup/reverse.d.ts +0 -206
- package/dist/types.backup/root-error-boundary.d.ts +0 -32
- package/dist/types.backup/route-content-wrapper.d.ts +0 -40
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
- package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
- package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
- package/dist/types.backup/route-definition/index.d.ts +0 -7
- package/dist/types.backup/route-definition/redirect.d.ts +0 -48
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
- package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
- package/dist/types.backup/route-definition.d.ts +0 -1
- package/dist/types.backup/route-map-builder.d.ts +0 -127
- package/dist/types.backup/route-name.d.ts +0 -27
- package/dist/types.backup/route-types.d.ts +0 -172
- package/dist/types.backup/router/basename.d.ts +0 -10
- package/dist/types.backup/router/content-negotiation.d.ts +0 -91
- package/dist/types.backup/router/debug-manifest.d.ts +0 -7
- package/dist/types.backup/router/error-handling.d.ts +0 -76
- package/dist/types.backup/router/find-match.d.ts +0 -19
- package/dist/types.backup/router/handler-context.d.ts +0 -41
- package/dist/types.backup/router/instrument.d.ts +0 -161
- package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
- package/dist/types.backup/router/lazy-includes.d.ts +0 -26
- package/dist/types.backup/router/loader-resolution.d.ts +0 -63
- package/dist/types.backup/router/logging.d.ts +0 -41
- package/dist/types.backup/router/manifest.d.ts +0 -8
- package/dist/types.backup/router/match-api.d.ts +0 -19
- package/dist/types.backup/router/match-context.d.ts +0 -184
- package/dist/types.backup/router/match-handlers.d.ts +0 -49
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
- package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
- package/dist/types.backup/router/match-pipelines.d.ts +0 -103
- package/dist/types.backup/router/match-result.d.ts +0 -114
- package/dist/types.backup/router/metrics.d.ts +0 -6
- package/dist/types.backup/router/middleware-types.d.ts +0 -74
- package/dist/types.backup/router/middleware.d.ts +0 -116
- package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
- package/dist/types.backup/router/params-util.d.ts +0 -8
- package/dist/types.backup/router/parse-pattern.d.ts +0 -38
- package/dist/types.backup/router/pattern-matching.d.ts +0 -169
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
- package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
- package/dist/types.backup/router/prerender-match.d.ts +0 -50
- package/dist/types.backup/router/preview-match.d.ts +0 -22
- package/dist/types.backup/router/request-classification.d.ts +0 -104
- package/dist/types.backup/router/revalidation.d.ts +0 -57
- package/dist/types.backup/router/route-snapshot.d.ts +0 -112
- package/dist/types.backup/router/router-context.d.ts +0 -137
- package/dist/types.backup/router/router-interfaces.d.ts +0 -432
- package/dist/types.backup/router/router-options.d.ts +0 -738
- package/dist/types.backup/router/router-registry.d.ts +0 -15
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
- package/dist/types.backup/router/segment-resolution.d.ts +0 -3
- package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
- package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
- package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
- package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
- package/dist/types.backup/router/telemetry.d.ts +0 -215
- package/dist/types.backup/router/timeout.d.ts +0 -68
- package/dist/types.backup/router/tracing.d.ts +0 -125
- package/dist/types.backup/router/trie-matching.d.ts +0 -32
- package/dist/types.backup/router/types.d.ts +0 -98
- package/dist/types.backup/router/url-params.d.ts +0 -26
- package/dist/types.backup/router.d.ts +0 -7
- package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
- package/dist/types.backup/rsc/full-payload.d.ts +0 -22
- package/dist/types.backup/rsc/handler-context.d.ts +0 -31
- package/dist/types.backup/rsc/handler.d.ts +0 -9
- package/dist/types.backup/rsc/helpers.d.ts +0 -213
- package/dist/types.backup/rsc/index.d.ts +0 -17
- package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
- package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
- package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
- package/dist/types.backup/rsc/nonce.d.ts +0 -28
- package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
- package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
- package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
- package/dist/types.backup/rsc/response-error.d.ts +0 -19
- package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
- package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
- package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
- package/dist/types.backup/rsc/server-action.d.ts +0 -68
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
- package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
- package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
- package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
- package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
- package/dist/types.backup/rsc/types.d.ts +0 -290
- package/dist/types.backup/runtime-env.d.ts +0 -1
- package/dist/types.backup/search-params.d.ts +0 -125
- package/dist/types.backup/segment-content-promise.d.ts +0 -13
- package/dist/types.backup/segment-fragments.d.ts +0 -56
- package/dist/types.backup/segment-loader-promise.d.ts +0 -22
- package/dist/types.backup/segment-system.d.ts +0 -84
- package/dist/types.backup/serialize.d.ts +0 -164
- package/dist/types.backup/server/context.d.ts +0 -494
- package/dist/types.backup/server/cookie-parse.d.ts +0 -10
- package/dist/types.backup/server/cookie-store.d.ts +0 -107
- package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
- package/dist/types.backup/server/handle-store.d.ts +0 -100
- package/dist/types.backup/server/loader-registry.d.ts +0 -32
- package/dist/types.backup/server/request-context.d.ts +0 -596
- package/dist/types.backup/server/root-layout.d.ts +0 -3
- package/dist/types.backup/server.d.ts +0 -15
- package/dist/types.backup/ssr/index.d.ts +0 -233
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
- package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
- package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
- package/dist/types.backup/static-handler.d.ts +0 -57
- package/dist/types.backup/testing/cache-status.d.ts +0 -63
- package/dist/types.backup/testing/collect-handle.d.ts +0 -20
- package/dist/types.backup/testing/dispatch.d.ts +0 -123
- package/dist/types.backup/testing/dom.entry.d.ts +0 -15
- package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
- package/dist/types.backup/testing/e2e/index.d.ts +0 -30
- package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
- package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
- package/dist/types.backup/testing/e2e/server.d.ts +0 -35
- package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
- package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
- package/dist/types.backup/testing/flight-tree.d.ts +0 -192
- package/dist/types.backup/testing/flight.d.ts +0 -115
- package/dist/types.backup/testing/flight.entry.d.ts +0 -27
- package/dist/types.backup/testing/generated-routes.d.ts +0 -66
- package/dist/types.backup/testing/index.d.ts +0 -52
- package/dist/types.backup/testing/internal/context.d.ts +0 -225
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
- package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
- package/dist/types.backup/testing/render-handler.d.ts +0 -160
- package/dist/types.backup/testing/render-route.d.ts +0 -246
- package/dist/types.backup/testing/run-loader.d.ts +0 -186
- package/dist/types.backup/testing/run-middleware.d.ts +0 -132
- package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
- package/dist/types.backup/testing/vitest.d.ts +0 -205
- package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
- package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
- package/dist/types.backup/theme/constants.d.ts +0 -39
- package/dist/types.backup/theme/index.d.ts +0 -29
- package/dist/types.backup/theme/theme-context.d.ts +0 -21
- package/dist/types.backup/theme/theme-script.d.ts +0 -26
- package/dist/types.backup/theme/types.d.ts +0 -162
- package/dist/types.backup/theme/use-theme.d.ts +0 -8
- package/dist/types.backup/types/boundaries.d.ts +0 -93
- package/dist/types.backup/types/cache-types.d.ts +0 -191
- package/dist/types.backup/types/error-types.d.ts +0 -114
- package/dist/types.backup/types/global-namespace.d.ts +0 -90
- package/dist/types.backup/types/handler-context.d.ts +0 -658
- package/dist/types.backup/types/index.d.ts +0 -11
- package/dist/types.backup/types/loader-types.d.ts +0 -182
- package/dist/types.backup/types/request-scope.d.ts +0 -93
- package/dist/types.backup/types/route-config.d.ts +0 -105
- package/dist/types.backup/types/route-entry.d.ts +0 -95
- package/dist/types.backup/types/segments.d.ts +0 -234
- package/dist/types.backup/types.d.ts +0 -1
- package/dist/types.backup/urls/include-helper.d.ts +0 -17
- package/dist/types.backup/urls/include-provider.d.ts +0 -27
- package/dist/types.backup/urls/index.d.ts +0 -6
- package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
- package/dist/types.backup/urls/path-helper.d.ts +0 -12
- package/dist/types.backup/urls/pattern-types.d.ts +0 -166
- package/dist/types.backup/urls/response-types.d.ts +0 -67
- package/dist/types.backup/urls/type-extraction.d.ts +0 -157
- package/dist/types.backup/urls/urls-function.d.ts +0 -24
- package/dist/types.backup/urls.d.ts +0 -1
- package/dist/types.backup/use-loader.d.ts +0 -150
- package/dist/types.backup/vercel/index.d.ts +0 -10
- package/dist/types.backup/vercel/tracing.d.ts +0 -70
- package/dist/types.backup/vite/debug.d.ts +0 -80
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
- package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
- package/dist/types.backup/vite/discovery/state.d.ts +0 -162
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
- package/dist/types.backup/vite/index.d.ts +0 -11
- package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
- package/dist/types.backup/vite/plugin-types.d.ts +0 -298
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
- package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
- package/dist/types.backup/vite/rango.d.ts +0 -29
- package/dist/types.backup/vite/router-discovery.d.ts +0 -23
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
- package/dist/types.backup/vite/utils/banner.d.ts +0 -2
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
- package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
- package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
- package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
import type { SegmentCacheStore, ShellCacheEntry } from "../cache/types.js";
|
|
29
29
|
import { sortedSearchString } from "../cache/cache-key-utils.js";
|
|
30
|
+
import type { SearchParamsFilter } from "../cache/search-params-filter.js";
|
|
30
31
|
import {
|
|
31
32
|
DEV_SHELL_PROBE_TIMEOUT_MS,
|
|
32
33
|
hasIntactShellPayload,
|
|
@@ -252,12 +253,18 @@ async function fetchDevShellEntry(
|
|
|
252
253
|
* version validity, payload integrity, and tag-invalidation markers. Returns
|
|
253
254
|
* null on any gate failure — the caller degrades to the ordinary MISS path
|
|
254
255
|
* (axis 1 + runtime capture), never a broken serve.
|
|
256
|
+
*
|
|
257
|
+
* "Search-less" is evaluated AFTER the request's `cache.searchParams` filter:
|
|
258
|
+
* a URL whose only params are excluded ones (`?fbclid=…` under a tracking
|
|
259
|
+
* exclusion) matches the baked shell — ad-click traffic is exactly the
|
|
260
|
+
* traffic the shell was prerendered for.
|
|
255
261
|
*/
|
|
256
262
|
export async function lookupBuildShell(
|
|
257
263
|
url: URL,
|
|
258
264
|
buildVersion: string,
|
|
259
265
|
store: SegmentCacheStore,
|
|
260
266
|
dev?: DevShellLookup,
|
|
267
|
+
filter?: SearchParamsFilter,
|
|
261
268
|
): Promise<BuildShellHit | null> {
|
|
262
269
|
try {
|
|
263
270
|
// Source-presence first: with no manifest and no dev context this is the
|
|
@@ -265,7 +272,7 @@ export async function lookupBuildShell(
|
|
|
265
272
|
// the searchParams sort/allocation below.
|
|
266
273
|
const hasManifest = globalThis.__loadShellManifestModule !== undefined;
|
|
267
274
|
if (!hasManifest && !dev) return null;
|
|
268
|
-
if (sortedSearchString(url.searchParams) !== "") return null;
|
|
275
|
+
if (sortedSearchString(url.searchParams, filter) !== "") return null;
|
|
269
276
|
let record: BuildShellEntry | undefined;
|
|
270
277
|
if (hasManifest) {
|
|
271
278
|
const mod = await loadManifest();
|
package/src/rsc/shell-capture.ts
CHANGED
|
@@ -1707,6 +1707,11 @@ async function captureAndStoreShell(
|
|
|
1707
1707
|
// ShellCacheEntry.initialTheme.
|
|
1708
1708
|
initialTheme: reqCtx.theme,
|
|
1709
1709
|
snapshot,
|
|
1710
|
+
// The canonical doc segment record's key, published by the doc
|
|
1711
|
+
// scope's cacheRoute during this capture's match (undefined when no
|
|
1712
|
+
// doc record was recorded — the entry then never claims navigation
|
|
1713
|
+
// replayability). Only meaningful alongside a snapshot.
|
|
1714
|
+
docKey: snapshot ? reqCtx._shellImplicitCache?.docKey : undefined,
|
|
1710
1715
|
navigationOnly: capture.navigationOnly,
|
|
1711
1716
|
// Handler-layer liveness folded at the barrier: nested thenables in
|
|
1712
1717
|
// handler-scoped pushes, handler pushes still pending (liveness
|
package/src/rsc/shell-serve.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
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
|
+
import type { SearchParamsFilter } from "../cache/search-params-filter.js";
|
|
22
23
|
import type { ShellCacheEntry, SegmentCacheStore } from "../cache/types.js";
|
|
23
24
|
import { SHELL_CAPTURE_MAX_WAIT_MS } from "./shell-capture-constants.js";
|
|
24
25
|
|
|
@@ -117,9 +118,14 @@ export function resolvePprConfig(
|
|
|
117
118
|
* The key includes the request HOST: in a multi-tenant host-router deployment
|
|
118
119
|
* (one worker, one shared KV/runtime-cache store) a host-less key would serve
|
|
119
120
|
* tenant A's captured shell to tenant B's users.
|
|
121
|
+
*
|
|
122
|
+
* `filter` is the request's compiled `cache.searchParams` config
|
|
123
|
+
* (ctx._searchParamsFilter): excluded params collapse onto one shell slot.
|
|
124
|
+
* Callers on the serve/capture path MUST pass it -- key drift between capture
|
|
125
|
+
* and lookup makes every shell request a permanent miss.
|
|
120
126
|
*/
|
|
121
|
-
export function buildShellKey(url: URL): string {
|
|
122
|
-
const sorted = sortedSearchString(url.searchParams);
|
|
127
|
+
export function buildShellKey(url: URL, filter?: SearchParamsFilter): string {
|
|
128
|
+
const sorted = sortedSearchString(url.searchParams, filter);
|
|
123
129
|
const searchSuffix = sorted ? `?${sorted}` : "";
|
|
124
130
|
return `${url.host}${url.pathname}${searchSuffix}:shell`;
|
|
125
131
|
}
|
package/src/rsc/types.ts
CHANGED
|
@@ -210,6 +210,23 @@ export interface HandlerCacheConfig {
|
|
|
210
210
|
store: import("../cache/types.js").SegmentCacheStore;
|
|
211
211
|
/** Enable/disable caching (default: true) */
|
|
212
212
|
enabled?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Which query params key the cache (default: `"all"`). Affects cache keys
|
|
215
|
+
* ONLY -- handlers and loaders still see the full query string. Global by
|
|
216
|
+
* design: the per-route case is already reachable through `cache({ key })`.
|
|
217
|
+
*
|
|
218
|
+
* Excluding a param is a promise that rendered output does not depend on
|
|
219
|
+
* it; if it does, the first variant is cached and served to everyone.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* cache: {
|
|
224
|
+
* store: cacheStore,
|
|
225
|
+
* searchParams: { exclude: TRACKING_SEARCH_PARAMS },
|
|
226
|
+
* }
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
searchParams?: import("../cache/search-params-filter.js").CacheSearchParams;
|
|
213
230
|
}
|
|
214
231
|
|
|
215
232
|
/**
|
|
@@ -211,9 +211,27 @@ export interface RequestContext<
|
|
|
211
211
|
/** @internal PPR transition decisions evaluated before cache lookup/handlers. */
|
|
212
212
|
_pprTransitionDecisions?: Map<string, boolean>;
|
|
213
213
|
|
|
214
|
+
/**
|
|
215
|
+
* @internal Post-match serve-source truth for the PPR replay reporter.
|
|
216
|
+
* Stamped from the match context as `intercept`, then overwritten as
|
|
217
|
+
* `prerender-store` if that lookup actually serves. The latter wins because
|
|
218
|
+
* it identifies the response source. matchPartialWithPprReplay reads this
|
|
219
|
+
* AFTER matching to reclassify its pre-match guess and suppress pointless
|
|
220
|
+
* heal captures.
|
|
221
|
+
*/
|
|
222
|
+
_pprReplayPostMatchReason?: "prerender-store" | "intercept";
|
|
223
|
+
|
|
214
224
|
/** @internal Cache store for segment caching (optional, used by CacheScope) */
|
|
215
225
|
_cacheStore?: SegmentCacheStore;
|
|
216
226
|
|
|
227
|
+
/**
|
|
228
|
+
* @internal Compiled `cache.searchParams` filter for default cache-key
|
|
229
|
+
* generation (undefined = "all", the byte-stable unfiltered format). Set
|
|
230
|
+
* once per request by handler.ts; every URL-keyed tier (segment, document,
|
|
231
|
+
* response, shell, "use cache") reads it so the tiers cannot drift.
|
|
232
|
+
*/
|
|
233
|
+
_searchParamsFilter?: import("../cache/search-params-filter.js").SearchParamsFilter;
|
|
234
|
+
|
|
217
235
|
/**
|
|
218
236
|
* @internal PPR shell-capture ACTIVE marker. True ONLY inside the background
|
|
219
237
|
* capture task's derived request context (built by shell-capture.ts). This is
|
|
@@ -265,9 +283,13 @@ export interface RequestContext<
|
|
|
265
283
|
* (b) a HIT tail's seeded context, and (c) an eligible normal-route partial
|
|
266
284
|
* replay, where `store` is a request-local segment overlay. Handler-live holes
|
|
267
285
|
* and conditional transitions decline replay.
|
|
268
|
-
* Routes with their own cache() config
|
|
269
|
-
*
|
|
270
|
-
*
|
|
286
|
+
* Routes with their own cache() config are never overridden — their scope's
|
|
287
|
+
* store/key/ttl/swr/condition semantics stay authoritative. On the
|
|
288
|
+
* navigation-replay serve path (`onExplicitHit` set) the marker COMPOSES with
|
|
289
|
+
* such a scope instead of being ignored: the seeded doc record supplies the match
|
|
290
|
+
* only when the explicit tier misses (withCacheLookup). cache(false) and a
|
|
291
|
+
* false condition() stay absolute opt-outs — replay bypasses before any
|
|
292
|
+
* shell read (`cache-disabled`).
|
|
271
293
|
*/
|
|
272
294
|
_shellImplicitCache?: {
|
|
273
295
|
ttl?: number;
|
|
@@ -281,6 +303,34 @@ export interface RequestContext<
|
|
|
281
303
|
keyPrefix?: "doc";
|
|
282
304
|
/** @internal Called only after the implicit cache hit decodes successfully. */
|
|
283
305
|
onHit?: () => void;
|
|
306
|
+
/**
|
|
307
|
+
* @internal The resolved key of the canonical document segment record.
|
|
308
|
+
* Written during a CAPTURE render by CacheScope.cacheRoute when a
|
|
309
|
+
* doc-namespaced scope records the matched segments; captureAndStoreShell
|
|
310
|
+
* stamps it onto the ShellCacheEntry (`docKey`) so replay eligibility can
|
|
311
|
+
* require the exact consumable record instead of "any segment record".
|
|
312
|
+
*/
|
|
313
|
+
docKey?: string;
|
|
314
|
+
/**
|
|
315
|
+
* @internal Set ONLY by matchPartialWithPprReplay on the navigation-replay
|
|
316
|
+
* serve path. Its presence arms the explicit-scope composition in
|
|
317
|
+
* withCacheLookup: a route-derived cache() scope stays authoritative, and
|
|
318
|
+
* only when its lookup MISSes does the seeded doc record supply the match.
|
|
319
|
+
* A capture render must never set this (its match must re-run handlers so
|
|
320
|
+
* SWR recapture stays fresh), which is why the fallback keys off this
|
|
321
|
+
* field and not off the marker itself. Fired when the route-derived
|
|
322
|
+
* scope's own lookup supplied the match — the header then reports
|
|
323
|
+
* `BYPASS; reason=explicit-cache-hit`, never a false replay HIT.
|
|
324
|
+
*/
|
|
325
|
+
onExplicitHit?: () => void;
|
|
326
|
+
/**
|
|
327
|
+
* @internal Companion to onExplicitHit, same lifecycle: fired when the
|
|
328
|
+
* route-derived scope's lookup REFUSED the read (`bypass` outcome — a
|
|
329
|
+
* false condition() or no store). The gate only pre-decides the static
|
|
330
|
+
* cache(false) case; a predicate refusal is known only at lookup time and
|
|
331
|
+
* reports `BYPASS; reason=cache-disabled` post-match.
|
|
332
|
+
*/
|
|
333
|
+
onExplicitBypass?: () => void;
|
|
284
334
|
};
|
|
285
335
|
|
|
286
336
|
/**
|
|
@@ -656,7 +706,9 @@ export type PublicRequestContext<
|
|
|
656
706
|
| "_handleStore"
|
|
657
707
|
| "_transitionWhen"
|
|
658
708
|
| "_pprTransitionDecisions"
|
|
709
|
+
| "_pprReplayPostMatchReason"
|
|
659
710
|
| "_cacheStore"
|
|
711
|
+
| "_searchParamsFilter"
|
|
660
712
|
| "_shellCaptureRun"
|
|
661
713
|
| "_shellImplicitCache"
|
|
662
714
|
| "_shellLoaderSeed"
|
|
@@ -842,6 +894,11 @@ export interface CreateRequestContextOptions<TEnv> {
|
|
|
842
894
|
initialResponse?: Response;
|
|
843
895
|
/** Optional cache store for segment caching (used by CacheScope) */
|
|
844
896
|
cacheStore?: SegmentCacheStore;
|
|
897
|
+
/**
|
|
898
|
+
* Compiled `cache.searchParams` filter from the resolved handler cache
|
|
899
|
+
* config (handler.ts). Stored as _searchParamsFilter.
|
|
900
|
+
*/
|
|
901
|
+
searchParamsFilter?: import("../cache/search-params-filter.js").SearchParamsFilter;
|
|
845
902
|
/**
|
|
846
903
|
* Handler-owned registry of explicit per-scope stores for cross-store tag
|
|
847
904
|
* invalidation. Created once per handler, reused across requests.
|
|
@@ -882,6 +939,7 @@ export function createRequestContext<TEnv>(
|
|
|
882
939
|
variables,
|
|
883
940
|
initialResponse,
|
|
884
941
|
cacheStore,
|
|
942
|
+
searchParamsFilter,
|
|
885
943
|
explicitTaggedStores,
|
|
886
944
|
cacheProfiles,
|
|
887
945
|
executionContext,
|
|
@@ -1176,6 +1234,7 @@ export function createRequestContext<TEnv>(
|
|
|
1176
1234
|
_handleStore: handleStore,
|
|
1177
1235
|
_transitionWhen: [],
|
|
1178
1236
|
_cacheStore: cacheStore,
|
|
1237
|
+
_searchParamsFilter: searchParamsFilter,
|
|
1179
1238
|
_explicitTaggedStores: explicitTaggedStores,
|
|
1180
1239
|
_requestTags: new Set<string>(),
|
|
1181
1240
|
_cacheProfiles: cacheProfiles,
|
package/src/testing/dispatch.ts
CHANGED
|
@@ -116,6 +116,11 @@ import {
|
|
|
116
116
|
stripInternalParams,
|
|
117
117
|
} from "../router/handler-context.js";
|
|
118
118
|
import { NOCACHE_SYMBOL } from "../cache/taint.js";
|
|
119
|
+
import {
|
|
120
|
+
compileSearchParamsFilter,
|
|
121
|
+
type CacheSearchParams,
|
|
122
|
+
type SearchParamsFilter,
|
|
123
|
+
} from "../cache/search-params-filter.js";
|
|
119
124
|
import type { SegmentCacheStore } from "../cache/types.js";
|
|
120
125
|
import type { CacheProfile } from "../cache/profile-registry.js";
|
|
121
126
|
// cache-scope is loaded LAZILY inside the response-route cache path (below):
|
|
@@ -193,11 +198,19 @@ interface DispatchableRouter<TEnv> {
|
|
|
193
198
|
} | null>;
|
|
194
199
|
basename?: string;
|
|
195
200
|
cache?:
|
|
196
|
-
| {
|
|
201
|
+
| {
|
|
202
|
+
enabled?: boolean;
|
|
203
|
+
store?: SegmentCacheStore;
|
|
204
|
+
searchParams?: CacheSearchParams;
|
|
205
|
+
}
|
|
197
206
|
| ((
|
|
198
207
|
env: TEnv,
|
|
199
208
|
executionContext: unknown,
|
|
200
|
-
) => {
|
|
209
|
+
) => {
|
|
210
|
+
enabled?: boolean;
|
|
211
|
+
store?: SegmentCacheStore;
|
|
212
|
+
searchParams?: CacheSearchParams;
|
|
213
|
+
});
|
|
201
214
|
cacheProfiles?: Record<string, CacheProfile>;
|
|
202
215
|
}
|
|
203
216
|
|
|
@@ -375,13 +388,17 @@ export async function dispatch<TEnv = any>(
|
|
|
375
388
|
// "use cache" inside a response-route handler reaches the request-scope
|
|
376
389
|
// (NOCACHE) detection below instead of bypassing on a missing store.
|
|
377
390
|
let cacheStore: SegmentCacheStore | undefined;
|
|
391
|
+
let searchParamsFilter: SearchParamsFilter | undefined;
|
|
378
392
|
const cacheOption = router.cache;
|
|
379
393
|
if (cacheOption && !url.searchParams.has("__no_cache")) {
|
|
380
394
|
const cacheConfig =
|
|
381
395
|
typeof cacheOption === "function"
|
|
382
396
|
? cacheOption(env, undefined)
|
|
383
397
|
: cacheOption;
|
|
384
|
-
if (cacheConfig.enabled !== false)
|
|
398
|
+
if (cacheConfig.enabled !== false) {
|
|
399
|
+
cacheStore = cacheConfig.store;
|
|
400
|
+
searchParamsFilter = compileSearchParamsFilter(cacheConfig.searchParams);
|
|
401
|
+
}
|
|
385
402
|
}
|
|
386
403
|
|
|
387
404
|
const requestContext = createRequestContext<TEnv>({
|
|
@@ -390,6 +407,7 @@ export async function dispatch<TEnv = any>(
|
|
|
390
407
|
url,
|
|
391
408
|
variables,
|
|
392
409
|
cacheStore,
|
|
410
|
+
searchParamsFilter,
|
|
393
411
|
cacheProfiles: router.cacheProfiles,
|
|
394
412
|
});
|
|
395
413
|
// Wire background error reporting so cache degradation (reportCacheError ->
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* (the segment chain is wrapped in a MountContext exactly as in production).
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
-
import type
|
|
41
|
+
import { useEffect, type ReactNode, type ComponentType } from "react";
|
|
42
42
|
import type { RenderResult } from "@testing-library/react";
|
|
43
43
|
import { renderSegments } from "../segment-system.js";
|
|
44
44
|
import {
|
|
@@ -62,8 +62,14 @@ import type { Handle } from "../handle.js";
|
|
|
62
62
|
import type { ThemeConfig } from "../theme/types.js";
|
|
63
63
|
import { resolveThemeConfig } from "../theme/constants.js";
|
|
64
64
|
import { isUnderTestRunner } from "../runtime-env.js";
|
|
65
|
+
import { setupNavigationBridgeDelegatedPrefetch } from "../browser/navigation-bridge.js";
|
|
66
|
+
import { resetAdaptiveStrategyForTesting } from "../browser/prefetch/default-strategy.js";
|
|
67
|
+
import { resetPrefetchObserverForTesting } from "../browser/prefetch/observer.js";
|
|
68
|
+
import type { PrefetchStrategy } from "../router/prefetch-default.js";
|
|
65
69
|
|
|
66
70
|
const TEST_ORIGIN = "http://localhost";
|
|
71
|
+
let activePrefetchRegistrations = 0;
|
|
72
|
+
let pendingPrefetchReset: object | undefined;
|
|
67
73
|
|
|
68
74
|
/**
|
|
69
75
|
* Seed shape for `options.handle`, matching the handle wire format:
|
|
@@ -268,6 +274,14 @@ export interface RenderRouteOptions {
|
|
|
268
274
|
* expect(getByTestId("nonce").textContent).toBe("test-nonce");
|
|
269
275
|
*/
|
|
270
276
|
nonce?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Router default prefetch strategy scoped to this rendered tree. This mirrors
|
|
279
|
+
* `createRouter({ defaultPrefetch })` for Links and eligible plain anchors
|
|
280
|
+
* inside `basename`. `data-prefetch="false"`/`"none"` opts out; `"true"`
|
|
281
|
+
* allows an application route with a common static-resource suffix but does
|
|
282
|
+
* not override a `"none"` default.
|
|
283
|
+
*/
|
|
284
|
+
defaultPrefetch?: PrefetchStrategy;
|
|
271
285
|
}
|
|
272
286
|
|
|
273
287
|
/**
|
|
@@ -299,6 +313,41 @@ interface ResolvedMatch {
|
|
|
299
313
|
pathname: string;
|
|
300
314
|
}
|
|
301
315
|
|
|
316
|
+
function DelegatedPrefetchRegistration({
|
|
317
|
+
bridge,
|
|
318
|
+
}: {
|
|
319
|
+
bridge: NavigationBridge;
|
|
320
|
+
}): null {
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
const unregister = bridge.registerDelegatedPrefetch();
|
|
323
|
+
pendingPrefetchReset = undefined;
|
|
324
|
+
activePrefetchRegistrations++;
|
|
325
|
+
return () => {
|
|
326
|
+
try {
|
|
327
|
+
unregister();
|
|
328
|
+
} finally {
|
|
329
|
+
activePrefetchRegistrations--;
|
|
330
|
+
if (activePrefetchRegistrations === 0) {
|
|
331
|
+
const reset = {};
|
|
332
|
+
pendingPrefetchReset = reset;
|
|
333
|
+
queueMicrotask(() => {
|
|
334
|
+
if (
|
|
335
|
+
pendingPrefetchReset !== reset ||
|
|
336
|
+
activePrefetchRegistrations !== 0
|
|
337
|
+
) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
pendingPrefetchReset = undefined;
|
|
341
|
+
resetPrefetchObserverForTesting();
|
|
342
|
+
resetAdaptiveStrategyForTesting();
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
}, [bridge]);
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
|
|
302
351
|
function matchLeaf(
|
|
303
352
|
pattern: string,
|
|
304
353
|
pathname: string,
|
|
@@ -429,6 +478,7 @@ export async function renderRoute(
|
|
|
429
478
|
|
|
430
479
|
const historyKey = generateHistoryKey(url.href);
|
|
431
480
|
const mount = normalizeBasename(options.mount);
|
|
481
|
+
const basename = normalizeBasename(options.basename);
|
|
432
482
|
// Fail loud on a request that cannot resolve the leaf route (a typo, or the
|
|
433
483
|
// mount-prefixed-vs-relative confusion) instead of silently rendering empty
|
|
434
484
|
// params (matchLeaf -> null -> {}). renderRoute paths are include-RELATIVE and
|
|
@@ -520,20 +570,31 @@ export async function renderRoute(
|
|
|
520
570
|
});
|
|
521
571
|
};
|
|
522
572
|
|
|
573
|
+
let prefetchRoot: HTMLElement | undefined;
|
|
523
574
|
const bridge: NavigationBridge = {
|
|
524
575
|
navigate: (target) => navigate(target),
|
|
525
576
|
refresh: () => navigate(url.pathname + url.search),
|
|
526
577
|
handlePopstate: async () => {},
|
|
527
578
|
registerLinkInterception: () => () => {},
|
|
579
|
+
registerDelegatedPrefetch: () =>
|
|
580
|
+
setupNavigationBridgeDelegatedPrefetch(
|
|
581
|
+
store,
|
|
582
|
+
eventController,
|
|
583
|
+
() => undefined,
|
|
584
|
+
{
|
|
585
|
+
defaultPrefetch: options.defaultPrefetch,
|
|
586
|
+
root: prefetchRoot,
|
|
587
|
+
basename,
|
|
588
|
+
},
|
|
589
|
+
),
|
|
528
590
|
getVersion: () => undefined,
|
|
529
591
|
updateVersion: () => {},
|
|
530
592
|
};
|
|
531
593
|
|
|
532
|
-
const initialMetadata =
|
|
533
|
-
url.pathname,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
);
|
|
594
|
+
const initialMetadata = {
|
|
595
|
+
...makeMetadata(url.pathname, initialSegments, initialMatch.params),
|
|
596
|
+
defaultPrefetch: options.defaultPrefetch,
|
|
597
|
+
};
|
|
537
598
|
const initialTree = await renderSegments(initialSegments);
|
|
538
599
|
|
|
539
600
|
// Wrap render in an awaited async act so a tree that suspends (async loaders,
|
|
@@ -542,19 +603,27 @@ export async function renderRoute(
|
|
|
542
603
|
// suspended inside an act scope, but the act call was not awaited") and the
|
|
543
604
|
// resolved content never reaches the asserted DOM.
|
|
544
605
|
let result!: Awaited<ReturnType<typeof render>>;
|
|
606
|
+
const container = document.body.appendChild(document.createElement("div"));
|
|
607
|
+
prefetchRoot = container;
|
|
545
608
|
await act(async () => {
|
|
546
609
|
result = render(
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
610
|
+
<>
|
|
611
|
+
<NavigationProvider
|
|
612
|
+
store={store}
|
|
613
|
+
eventController={eventController}
|
|
614
|
+
initialPayload={{ root: initialTree, metadata: initialMetadata }}
|
|
615
|
+
bridge={bridge}
|
|
616
|
+
basename={basename}
|
|
617
|
+
themeConfig={
|
|
618
|
+
options.theme === undefined
|
|
619
|
+
? null
|
|
620
|
+
: resolveThemeConfig(options.theme)
|
|
621
|
+
}
|
|
622
|
+
nonce={options.nonce}
|
|
623
|
+
/>
|
|
624
|
+
<DelegatedPrefetchRegistration bridge={bridge} />
|
|
625
|
+
</>,
|
|
626
|
+
{ baseElement: document.body, container },
|
|
558
627
|
);
|
|
559
628
|
});
|
|
560
629
|
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import { sortedSearchString } from "../cache/cache-key-utils.js";
|
|
32
|
+
import {
|
|
33
|
+
compileSearchParamsFilter,
|
|
34
|
+
type CacheSearchParams,
|
|
35
|
+
} from "../cache/search-params-filter.js";
|
|
32
36
|
|
|
33
37
|
/** Production header name (`rsc/shell-serve.ts` `SHELL_STATUS_HEADER`). */
|
|
34
38
|
export const SHELL_STATUS_HEADER: string = "x-rango-shell";
|
|
@@ -45,6 +49,10 @@ const PPR_REPLAY_BYPASS_REASONS = [
|
|
|
45
49
|
"nonce",
|
|
46
50
|
"store-unavailable",
|
|
47
51
|
"passive-read-unsupported",
|
|
52
|
+
"no-navigation-context",
|
|
53
|
+
"prerender-store",
|
|
54
|
+
"intercept",
|
|
55
|
+
"cache-disabled",
|
|
48
56
|
"read-error",
|
|
49
57
|
"no-entry",
|
|
50
58
|
"invalid-version",
|
|
@@ -53,6 +61,7 @@ const PPR_REPLAY_BYPASS_REASONS = [
|
|
|
53
61
|
"transition-when",
|
|
54
62
|
"no-segment-snapshot",
|
|
55
63
|
"snapshot-miss",
|
|
64
|
+
"explicit-cache-hit",
|
|
56
65
|
"stale-build-entry",
|
|
57
66
|
] as const;
|
|
58
67
|
|
|
@@ -74,12 +83,20 @@ export type ShellStatusTarget = Response | { headers: Headers };
|
|
|
74
83
|
* module (it pulls React). A parity test pins the two implementations.
|
|
75
84
|
*
|
|
76
85
|
* Accepts a `URL` or an absolute/relative request URL string (relative strings
|
|
77
|
-
* resolve against `http://localhost`).
|
|
86
|
+
* resolve against `http://localhost`). Pass the router's `cache.searchParams`
|
|
87
|
+
* config as `searchParams` when the app under test sets one — the production
|
|
88
|
+
* key applies it, so the expected key must too.
|
|
78
89
|
*/
|
|
79
|
-
export function shellCacheKey(
|
|
90
|
+
export function shellCacheKey(
|
|
91
|
+
url: URL | string,
|
|
92
|
+
searchParams?: CacheSearchParams,
|
|
93
|
+
): string {
|
|
80
94
|
const resolved =
|
|
81
95
|
typeof url === "string" ? new URL(url, "http://localhost") : url;
|
|
82
|
-
const sorted = sortedSearchString(
|
|
96
|
+
const sorted = sortedSearchString(
|
|
97
|
+
resolved.searchParams,
|
|
98
|
+
compileSearchParamsFilter(searchParams),
|
|
99
|
+
);
|
|
83
100
|
const searchSuffix = sorted ? `?${sorted}` : "";
|
|
84
101
|
return `${resolved.host}${resolved.pathname}${searchSuffix}:shell`;
|
|
85
102
|
}
|
package/src/vite/plugin-types.ts
CHANGED
|
@@ -267,7 +267,7 @@ export interface RangoCloudflareOptions extends RangoBaseOptions {
|
|
|
267
267
|
* `.vc-config.json` (and `config.json` for `functionName`).
|
|
268
268
|
*/
|
|
269
269
|
export interface VercelPresetOptions {
|
|
270
|
-
/** Node runtime for the function. @default "
|
|
270
|
+
/** Node runtime for the function. @default "nodejs24.x" */
|
|
271
271
|
runtime?: string;
|
|
272
272
|
/** Max execution time in seconds. @default 30 */
|
|
273
273
|
maxDuration?: number;
|
|
@@ -99,7 +99,7 @@ export function assertVercelNodeRuntime(runtime: string | undefined): void {
|
|
|
99
99
|
throw new Error(
|
|
100
100
|
`[rango] preset "vercel": runtime "${runtime}" is not supported. ` +
|
|
101
101
|
`This preset emits a Node serverless function; use a "nodejs*" runtime ` +
|
|
102
|
-
`(default "
|
|
102
|
+
`(default "nodejs24.x"). The Edge runtime is not supported.`,
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -125,7 +125,7 @@ export function buildVercelVcConfig(
|
|
|
125
125
|
vercel: VercelPresetOptions,
|
|
126
126
|
): Record<string, unknown> {
|
|
127
127
|
const vcConfig: Record<string, unknown> = {
|
|
128
|
-
runtime: vercel.runtime ?? "
|
|
128
|
+
runtime: vercel.runtime ?? "nodejs24.x",
|
|
129
129
|
handler: "index.mjs",
|
|
130
130
|
launcherType: "Nodejs",
|
|
131
131
|
shouldAddHelpers: false,
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal Types - Implementation Details
|
|
3
|
-
*
|
|
4
|
-
* @internal
|
|
5
|
-
* These types are for internal use only and should not be relied upon by consumers.
|
|
6
|
-
* They may change without notice between versions.
|
|
7
|
-
*
|
|
8
|
-
* If you find yourself needing these types, please open an issue to discuss
|
|
9
|
-
* adding them to the public API.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
* Internal representation of a resolved route segment.
|
|
14
|
-
* Used during route matching and rendering pipeline.
|
|
15
|
-
*/
|
|
16
|
-
export type { ResolvedSegment, SegmentMetadata } from "./types.js";
|
|
17
|
-
/**
|
|
18
|
-
* @internal
|
|
19
|
-
* Internal match result from route resolution.
|
|
20
|
-
*/
|
|
21
|
-
export type { MatchResult, SlotState } from "./types.js";
|
|
22
|
-
/**
|
|
23
|
-
* @internal
|
|
24
|
-
* Context for intercept route selection.
|
|
25
|
-
*/
|
|
26
|
-
export type { InterceptSelectorContext, InterceptSegmentsState, InterceptWhenFn, } from "./server/context.js";
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
* RSC protocol payload structure.
|
|
30
|
-
*/
|
|
31
|
-
export type { RscPayload, ReactFormState } from "./rsc/types.js";
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* Internal navigation store interface.
|
|
35
|
-
*/
|
|
36
|
-
export type { NavigationStore, NavigationBridge, RscMetadata, ActionResult, InflightAction, NavigationState, TrackedActionState, ActionStateListener, SegmentCache, SegmentState, NavigationUpdate, } from "./browser/types.js";
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
* Internal handle storage mechanism.
|
|
40
|
-
*/
|
|
41
|
-
export type { HandleStore, HandleData } from "./server/handle-store.js";
|
|
42
|
-
/**
|
|
43
|
-
* @internal
|
|
44
|
-
* Segment handle data in cache.
|
|
45
|
-
*/
|
|
46
|
-
export type { SegmentHandleData } from "./cache/types.js";
|
|
47
|
-
/**
|
|
48
|
-
* @internal
|
|
49
|
-
* Internal cache entry data structure.
|
|
50
|
-
*/
|
|
51
|
-
export type { CachedEntryData, CacheGetResult, SerializedSegmentData, CacheDefaults, } from "./cache/types.js";
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
* Router context for AsyncLocalStorage.
|
|
55
|
-
*/
|
|
56
|
-
export type { RouterContext, RevalidationContext, InterceptResult, } from "./router/router-context.js";
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
* Route match context during pipeline processing.
|
|
60
|
-
*/
|
|
61
|
-
export type { MatchContext, MatchPipelineState, } from "./router/match-context.js";
|
|
62
|
-
/**
|
|
63
|
-
* @internal
|
|
64
|
-
* Pattern matching result.
|
|
65
|
-
*/
|
|
66
|
-
export type { RouteMatchResult } from "./router/pattern-matching.js";
|
|
67
|
-
/**
|
|
68
|
-
* @internal
|
|
69
|
-
* Entry data during route traversal.
|
|
70
|
-
*/
|
|
71
|
-
export type { EntryData, InterceptEntry, MetricsStore, PerformanceMetric, EntryCacheConfig, EntryPropCommon, EntryPropDatas, LoaderEntry, EntryPropSegments, } from "./server/context.js";
|
|
72
|
-
/**
|
|
73
|
-
* @internal
|
|
74
|
-
* Internal handler context with additional props for router internals.
|
|
75
|
-
* Includes `_currentSegmentId` and `_responseType`.
|
|
76
|
-
*/
|
|
77
|
-
export type { InternalHandlerContext } from "./types.js";
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
* Builds React element trees from route segments.
|
|
81
|
-
*/
|
|
82
|
-
export { renderSegments } from "./segment-system.js";
|
|
83
|
-
/**
|
|
84
|
-
* @internal
|
|
85
|
-
* Error sanitization and network error utilities.
|
|
86
|
-
*/
|
|
87
|
-
export { sanitizeError, NetworkError, isNetworkError } from "./errors.js";
|
|
88
|
-
/**
|
|
89
|
-
* @internal
|
|
90
|
-
* Scoped view of GeneratedRouteMap for Handler<"localName", ScopedRouteMap<"prefix">>.
|
|
91
|
-
*/
|
|
92
|
-
export type { ScopedRouteMap } from "./types.js";
|
|
93
|
-
/**
|
|
94
|
-
* @internal
|
|
95
|
-
* Type-level utilities for reverse URL generation.
|
|
96
|
-
*/
|
|
97
|
-
export type { MergeRoutes, SanitizePrefix } from "./reverse.js";
|
|
98
|
-
/**
|
|
99
|
-
* @internal
|
|
100
|
-
* Individual telemetry event types.
|
|
101
|
-
*/
|
|
102
|
-
export type { RequestStartEvent, RequestEndEvent, RequestErrorEvent, RequestTimeoutEvent, LoaderStartEvent, LoaderEndEvent, LoaderErrorEvent, HandlerErrorEvent, CacheDecisionEvent, RevalidationDecisionEvent, } from "./router/telemetry.js";
|
|
103
|
-
/**
|
|
104
|
-
* @internal
|
|
105
|
-
* Type guard for prerender handler definitions.
|
|
106
|
-
*/
|
|
107
|
-
export { isPrerenderHandler, isPassthroughHandler } from "./prerender.js";
|
|
108
|
-
/**
|
|
109
|
-
* @internal
|
|
110
|
-
* Type guard for static handler definitions.
|
|
111
|
-
*/
|
|
112
|
-
export { isStaticHandler } from "./static-handler.js";
|
|
113
|
-
/**
|
|
114
|
-
* @internal
|
|
115
|
-
* Sentinel used to tag response-type route entries.
|
|
116
|
-
*/
|
|
117
|
-
export { RESPONSE_TYPE } from "./urls.js";
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
* Debug utilities for route matching performance analysis.
|
|
121
|
-
*/
|
|
122
|
-
export { enableMatchDebug, getMatchDebugStats, } from "./router/pattern-matching.js";
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
* Debug utilities for manifest inspection and comparison.
|
|
126
|
-
*/
|
|
127
|
-
export { serializeManifest, compareManifests, formatManifestDiff, type SerializedEntry, type SerializedManifest, } from "./debug.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|