@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
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* `getCache(...)` result, which satisfies the shape structurally. That keeps the
|
|
31
31
|
* router free of a hard Vercel dependency.
|
|
32
32
|
*/
|
|
33
|
-
import type { SegmentCacheStore, CachedEntryData, CacheDefaults, CacheGetResult, CacheItemResult, CacheItemOptions, ShellCacheEntry } from "../types.js";
|
|
33
|
+
import type { SegmentCacheStore, CachedEntryData, CacheDefaults, CacheGetResult, CacheItemResult, CacheItemOptions, ShellCacheEntry, CacheReadError } from "../types.js";
|
|
34
34
|
import type { RequestContext } from "../../server/request-context.js";
|
|
35
35
|
/**
|
|
36
36
|
* Minimal structural shape of the Vercel Runtime Cache returned by `getCache()`
|
|
@@ -194,7 +194,7 @@ export declare class VercelCacheStore<TEnv = unknown> implements SegmentCacheSto
|
|
|
194
194
|
private readonly name?;
|
|
195
195
|
private readonly debug?;
|
|
196
196
|
constructor(options: VercelCacheStoreOptions<TEnv>);
|
|
197
|
-
get(key: string): Promise<CacheGetResult | null>;
|
|
197
|
+
get(key: string): Promise<CacheGetResult | null | CacheReadError>;
|
|
198
198
|
set(key: string, data: CachedEntryData, ttl: number, swr?: number): Promise<void>;
|
|
199
199
|
delete(key: string): Promise<boolean>;
|
|
200
200
|
getResponse(key: string): Promise<{
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { RouteNotFoundError, DataNotFoundError, notFound, MiddlewareError, Handl
|
|
|
13
13
|
export type { DocumentProps, DefaultEnv, RouteDefinition, RouteConfig, RouteDefinitionOptions, TrailingSlashMode, Handler, // Supports params object, path pattern, or route name
|
|
14
14
|
HandlerContext, ExtractParams, GenericParams, Middleware, RevalidateParams, Revalidate, ActionRef, RouteKeys, LoaderDefinition, LoaderFn, LoaderContext, FetchableLoaderOptions, LoadOptions, ErrorInfo, ErrorBoundaryFallbackProps, ErrorBoundaryHandler, ClientErrorBoundaryFallbackProps, NotFoundInfo, NotFoundBoundaryFallbackProps, NotFoundBoundaryHandler, ErrorPhase, OnErrorContext, OnErrorCallback, } from "./types.js";
|
|
15
15
|
export type { SearchSchema, SearchSchemaValue, ResolveSearchSchema, RouteSearchParams, RouteParams, } from "./search-params.js";
|
|
16
|
+
export { TRACKING_SEARCH_PARAMS, type CacheSearchParams, } from "./cache/search-params-filter.js";
|
|
16
17
|
export { createLoader } from "./loader.js";
|
|
17
18
|
export type { RouteHelpers, RouteHandlers } from "./route-definition.js";
|
|
18
19
|
export type { TransitionConfig, TransitionWhenFn, TransitionWhenContext, ViewTransitionClass, } from "./types.js";
|
|
@@ -24,6 +24,7 @@ export { Static, type StaticHandlerDefinition, type StaticHandlerOptions, } from
|
|
|
24
24
|
export { urls, type PathHelpers, type PathOptions, type PartialPrerenderProps, type UrlPatterns, type IncludeOptions, type IncludeItem, type RouteResponse, type ProblemDetails, type ResponseHandler, type ResponseHandlerContext, type JsonResponseHandler, type TextResponseHandler, type JsonValue, type ResponsePathFn, type JsonResponsePathFn, type TextResponsePathFn, } from "./urls.js";
|
|
25
25
|
export { createRouter, type Rango, type RootLayoutProps, type RouterRequestInput, } from "./router.js";
|
|
26
26
|
export type { HandlerCacheConfig } from "./rsc/types.js";
|
|
27
|
+
export { TRACKING_SEARCH_PARAMS, type CacheSearchParams, } from "./cache/search-params-filter.js";
|
|
27
28
|
export { Meta } from "./handles/meta.js";
|
|
28
29
|
export { Script, type ScriptConfig, type ScriptAttributes, } from "./handles/script.js";
|
|
29
30
|
export { Breadcrumbs, type BreadcrumbItem } from "./handles/breadcrumbs.js";
|
|
@@ -92,7 +92,20 @@
|
|
|
92
92
|
* - Action context (if POST)
|
|
93
93
|
*/
|
|
94
94
|
import type { ResolvedSegment } from "../../types.js";
|
|
95
|
+
import type { EntryData } from "../../server/context.js";
|
|
95
96
|
import type { MatchContext, MatchPipelineState } from "../match-context.js";
|
|
97
|
+
/**
|
|
98
|
+
* Whether the prerender store holds a baked entry for this route + params.
|
|
99
|
+
* Consulted by the PPR replay gate (matchPartialWithPprReplay), which must
|
|
100
|
+
* only report `prerender-store` when the short-circuit below will actually
|
|
101
|
+
* serve: a Passthrough(Prerender()) route with an unbaked/passthrough param
|
|
102
|
+
* misses the store and renders live, and replay — including its heal
|
|
103
|
+
* capture — must stay available for it (withCacheStore records the doc
|
|
104
|
+
* record on that path; state.cacheSource is not "prerender"). The store
|
|
105
|
+
* memoizes per routeKey/paramHash, so this probe and tryPrerenderLookup's
|
|
106
|
+
* subsequent get() share one underlying load.
|
|
107
|
+
*/
|
|
108
|
+
export declare function prerenderEntryExists(routeKey: string | undefined, params: Record<string, string>, pathname: string, entries: EntryData[]): Promise<boolean>;
|
|
96
109
|
/**
|
|
97
110
|
* Async generator middleware type
|
|
98
111
|
*/
|
|
@@ -18,5 +18,34 @@ export interface NavigationSnapshot {
|
|
|
18
18
|
export interface ResolveNavigationDeps {
|
|
19
19
|
findMatch: (pathname: string) => RouteMatchResult | null | Promise<RouteMatchResult | null>;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The raw navigation-context header for a partial request, or null when the
|
|
23
|
+
* request carries none. Single source of truth shared by resolveNavigation and
|
|
24
|
+
* the PPR replay gate (matchPartialWithPprReplay): a context-less partial can
|
|
25
|
+
* never produce a partial match, so the replay path must decide
|
|
26
|
+
* `no-navigation-context` BEFORE spending shell-store reads — the two
|
|
27
|
+
* predicates drifting apart would misattribute the bypass again.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getNavigationContextHeader(request: Request): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Whether withCacheLookup's prerender short-circuit will serve this partial
|
|
32
|
+
* from the build-time prerender store: a Prerender() match (`matched.pr`)
|
|
33
|
+
* outside dev HMR — the short-circuit is disabled on X-RSC-HMR so HMR
|
|
34
|
+
* navigations pick up edited modules. Shared by withCacheLookup and the PPR
|
|
35
|
+
* replay gate (matchPartialWithPprReplay) for the same drift reason as
|
|
36
|
+
* getNavigationContextHeader: the gate's `prerender-store` bypass must decide
|
|
37
|
+
* exactly what the middleware will actually do. (Both callers additionally
|
|
38
|
+
* exclude actions on their own paths — the gate via its GET-only check.)
|
|
39
|
+
*/
|
|
40
|
+
export declare function prerenderStoreShortCircuits(pr: true | undefined, request: Request): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The intercept-source header for a partial request, or null when the request
|
|
43
|
+
* carries none. Shared by resolveNavigation and the PPR replay gate's
|
|
44
|
+
* prerender probe: intercept navigations consult the intercept-specific
|
|
45
|
+
* prerender artifact (`paramHash + "/i"`), so the probe must check the same
|
|
46
|
+
* variant the middleware will — probing the bare hash for an intercept
|
|
47
|
+
* request would report `prerender-store` for an artifact that cannot serve.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getInterceptSourceHeader(request: Request): string | null;
|
|
21
50
|
export declare function resolveNavigation(request: Request, url: URL, currentRouteKey: string, deps: ResolveNavigationDeps): Promise<NavigationSnapshot | null>;
|
|
22
51
|
export declare function createNavigationSnapshot(overrides?: Partial<NavigationSnapshot>): NavigationSnapshot;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from "react";
|
|
2
2
|
import type { SegmentCacheStore } from "../cache/types.js";
|
|
3
|
+
import type { CacheSearchParams } from "../cache/search-params-filter.js";
|
|
3
4
|
import type { ErrorBoundaryHandler, NotFoundBoundaryHandler, OnErrorCallback } from "../types";
|
|
4
5
|
import type { NonceProvider } from "../rsc/types.js";
|
|
5
6
|
import type { ShellCaptureDebug } from "../rsc/shell-capture.js";
|
|
@@ -283,13 +284,32 @@ export interface RangoOptions<TEnv = any> {
|
|
|
283
284
|
* }),
|
|
284
285
|
* });
|
|
285
286
|
* ```
|
|
287
|
+
*
|
|
288
|
+
* `searchParams` controls which query params key the cache (default:
|
|
289
|
+
* `"all"`). Cache keys only -- handlers still see the full query string.
|
|
290
|
+
* Excluding a param is a promise that rendered output does not depend on
|
|
291
|
+
* it; if it does, the first variant is cached and served to everyone.
|
|
292
|
+
*
|
|
293
|
+
* @example Ignore tracking params for cache keys
|
|
294
|
+
* ```typescript
|
|
295
|
+
* import { TRACKING_SEARCH_PARAMS } from "@rangojs/router";
|
|
296
|
+
*
|
|
297
|
+
* const router = createRouter({
|
|
298
|
+
* cache: {
|
|
299
|
+
* store: cacheStore,
|
|
300
|
+
* searchParams: { exclude: TRACKING_SEARCH_PARAMS },
|
|
301
|
+
* },
|
|
302
|
+
* });
|
|
303
|
+
* ```
|
|
286
304
|
*/
|
|
287
305
|
cache?: {
|
|
288
306
|
store: SegmentCacheStore;
|
|
289
307
|
enabled?: boolean;
|
|
308
|
+
searchParams?: CacheSearchParams;
|
|
290
309
|
} | ((env: TEnv, ctx?: ExecutionContext) => {
|
|
291
310
|
store: SegmentCacheStore;
|
|
292
311
|
enabled?: boolean;
|
|
312
|
+
searchParams?: CacheSearchParams;
|
|
293
313
|
});
|
|
294
314
|
/**
|
|
295
315
|
* Named cache profiles for "use cache" directive.
|
|
@@ -498,9 +518,13 @@ export interface RangoOptions<TEnv = any> {
|
|
|
498
518
|
prefetchConcurrency?: number;
|
|
499
519
|
/**
|
|
500
520
|
* Default prefetch strategy for every `<Link>` that does not set its own
|
|
501
|
-
* `prefetch` prop
|
|
502
|
-
*
|
|
503
|
-
*
|
|
521
|
+
* `prefetch` prop and every eligible intercepted plain anchor. Plain anchors
|
|
522
|
+
* can opt out with `data-prefetch="false"` or `data-prefetch="none"`. Common
|
|
523
|
+
* static-resource suffixes are excluded unless `data-prefetch="true"` marks
|
|
524
|
+
* the URL as an application route. Mark side-effectful GET links such as
|
|
525
|
+
* `/logout` with an opt-out because the router cannot infer endpoint safety.
|
|
526
|
+
* A per-Link `prefetch` prop always wins in both directions (a Link can opt
|
|
527
|
+
* out with `prefetch="none"`, or opt in under `defaultPrefetch: "none"`).
|
|
504
528
|
*
|
|
505
529
|
* - `"viewport"` (production default): prefetch when the link enters the viewport —
|
|
506
530
|
* idle-gated and queued (see `prefetchConcurrency`), so prefetches never
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* markers say whether it is still current.
|
|
26
26
|
*/
|
|
27
27
|
import type { SegmentCacheStore, ShellCacheEntry } from "../cache/types.js";
|
|
28
|
+
import type { SearchParamsFilter } from "../cache/search-params-filter.js";
|
|
28
29
|
/** One baked manifest record (the __ps asset module's default export). */
|
|
29
30
|
export interface BuildShellEntry {
|
|
30
31
|
entry: ShellCacheEntry;
|
|
@@ -79,6 +80,11 @@ export interface DevShellLookup {
|
|
|
79
80
|
* version validity, payload integrity, and tag-invalidation markers. Returns
|
|
80
81
|
* null on any gate failure — the caller degrades to the ordinary MISS path
|
|
81
82
|
* (axis 1 + runtime capture), never a broken serve.
|
|
83
|
+
*
|
|
84
|
+
* "Search-less" is evaluated AFTER the request's `cache.searchParams` filter:
|
|
85
|
+
* a URL whose only params are excluded ones (`?fbclid=…` under a tracking
|
|
86
|
+
* exclusion) matches the baked shell — ad-click traffic is exactly the
|
|
87
|
+
* traffic the shell was prerendered for.
|
|
82
88
|
*/
|
|
83
|
-
export declare function lookupBuildShell(url: URL, buildVersion: string, store: SegmentCacheStore, dev?: DevShellLookup): Promise<BuildShellHit | null>;
|
|
89
|
+
export declare function lookupBuildShell(url: URL, buildVersion: string, store: SegmentCacheStore, dev?: DevShellLookup, filter?: SearchParamsFilter): Promise<BuildShellHit | null>;
|
|
84
90
|
export {};
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* intent cannot be honored — unlike an undeclared route, which is silent).
|
|
17
17
|
*/
|
|
18
18
|
import { type EntryData } from "../server/context.js";
|
|
19
|
+
import type { SearchParamsFilter } from "../cache/search-params-filter.js";
|
|
19
20
|
import type { ShellCacheEntry, SegmentCacheStore } from "../cache/types.js";
|
|
20
21
|
/** Debug/status header the browser (and e2e assertions) can read: HIT | MISS. */
|
|
21
22
|
export declare const SHELL_STATUS_HEADER = "x-rango-shell";
|
|
@@ -86,8 +87,13 @@ export declare function resolvePprConfig(entry: EntryData | undefined | null): R
|
|
|
86
87
|
* The key includes the request HOST: in a multi-tenant host-router deployment
|
|
87
88
|
* (one worker, one shared KV/runtime-cache store) a host-less key would serve
|
|
88
89
|
* tenant A's captured shell to tenant B's users.
|
|
90
|
+
*
|
|
91
|
+
* `filter` is the request's compiled `cache.searchParams` config
|
|
92
|
+
* (ctx._searchParamsFilter): excluded params collapse onto one shell slot.
|
|
93
|
+
* Callers on the serve/capture path MUST pass it -- key drift between capture
|
|
94
|
+
* and lookup makes every shell request a permanent miss.
|
|
89
95
|
*/
|
|
90
|
-
export declare function buildShellKey(url: URL): string;
|
|
96
|
+
export declare function buildShellKey(url: URL, filter?: SearchParamsFilter): string;
|
|
91
97
|
/**
|
|
92
98
|
* Version gates for a stored shell: reactVersion AND buildVersion must both
|
|
93
99
|
* match the running server. The postponed blob encodes hole positions against
|
|
@@ -194,6 +194,23 @@ export interface HandlerCacheConfig {
|
|
|
194
194
|
store: import("../cache/types.js").SegmentCacheStore;
|
|
195
195
|
/** Enable/disable caching (default: true) */
|
|
196
196
|
enabled?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Which query params key the cache (default: `"all"`). Affects cache keys
|
|
199
|
+
* ONLY -- handlers and loaders still see the full query string. Global by
|
|
200
|
+
* design: the per-route case is already reachable through `cache({ key })`.
|
|
201
|
+
*
|
|
202
|
+
* Excluding a param is a promise that rendered output does not depend on
|
|
203
|
+
* it; if it does, the first variant is cached and served to everyone.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* cache: {
|
|
208
|
+
* store: cacheStore,
|
|
209
|
+
* searchParams: { exclude: TRACKING_SEARCH_PARAMS },
|
|
210
|
+
* }
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
searchParams?: import("../cache/search-params-filter.js").CacheSearchParams;
|
|
197
214
|
}
|
|
198
215
|
/**
|
|
199
216
|
* Nonce provider function type.
|
|
@@ -143,8 +143,24 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
143
143
|
}>;
|
|
144
144
|
/** @internal PPR transition decisions evaluated before cache lookup/handlers. */
|
|
145
145
|
_pprTransitionDecisions?: Map<string, boolean>;
|
|
146
|
+
/**
|
|
147
|
+
* @internal Post-match serve-source truth for the PPR replay reporter.
|
|
148
|
+
* Stamped from the match context as `intercept`, then overwritten as
|
|
149
|
+
* `prerender-store` if that lookup actually serves. The latter wins because
|
|
150
|
+
* it identifies the response source. matchPartialWithPprReplay reads this
|
|
151
|
+
* AFTER matching to reclassify its pre-match guess and suppress pointless
|
|
152
|
+
* heal captures.
|
|
153
|
+
*/
|
|
154
|
+
_pprReplayPostMatchReason?: "prerender-store" | "intercept";
|
|
146
155
|
/** @internal Cache store for segment caching (optional, used by CacheScope) */
|
|
147
156
|
_cacheStore?: SegmentCacheStore;
|
|
157
|
+
/**
|
|
158
|
+
* @internal Compiled `cache.searchParams` filter for default cache-key
|
|
159
|
+
* generation (undefined = "all", the byte-stable unfiltered format). Set
|
|
160
|
+
* once per request by handler.ts; every URL-keyed tier (segment, document,
|
|
161
|
+
* response, shell, "use cache") reads it so the tiers cannot drift.
|
|
162
|
+
*/
|
|
163
|
+
_searchParamsFilter?: import("../cache/search-params-filter.js").SearchParamsFilter;
|
|
148
164
|
/**
|
|
149
165
|
* @internal PPR shell-capture ACTIVE marker. True ONLY inside the background
|
|
150
166
|
* capture task's derived request context (built by shell-capture.ts). This is
|
|
@@ -190,9 +206,13 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
190
206
|
* (b) a HIT tail's seeded context, and (c) an eligible normal-route partial
|
|
191
207
|
* replay, where `store` is a request-local segment overlay. Handler-live holes
|
|
192
208
|
* and conditional transitions decline replay.
|
|
193
|
-
* Routes with their own cache() config
|
|
194
|
-
*
|
|
195
|
-
*
|
|
209
|
+
* Routes with their own cache() config are never overridden — their scope's
|
|
210
|
+
* store/key/ttl/swr/condition semantics stay authoritative. On the
|
|
211
|
+
* navigation-replay serve path (`onExplicitHit` set) the marker COMPOSES with
|
|
212
|
+
* such a scope instead of being ignored: the seeded doc record supplies the match
|
|
213
|
+
* only when the explicit tier misses (withCacheLookup). cache(false) and a
|
|
214
|
+
* false condition() stay absolute opt-outs — replay bypasses before any
|
|
215
|
+
* shell read (`cache-disabled`).
|
|
196
216
|
*/
|
|
197
217
|
_shellImplicitCache?: {
|
|
198
218
|
ttl?: number;
|
|
@@ -206,6 +226,34 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
206
226
|
keyPrefix?: "doc";
|
|
207
227
|
/** @internal Called only after the implicit cache hit decodes successfully. */
|
|
208
228
|
onHit?: () => void;
|
|
229
|
+
/**
|
|
230
|
+
* @internal The resolved key of the canonical document segment record.
|
|
231
|
+
* Written during a CAPTURE render by CacheScope.cacheRoute when a
|
|
232
|
+
* doc-namespaced scope records the matched segments; captureAndStoreShell
|
|
233
|
+
* stamps it onto the ShellCacheEntry (`docKey`) so replay eligibility can
|
|
234
|
+
* require the exact consumable record instead of "any segment record".
|
|
235
|
+
*/
|
|
236
|
+
docKey?: string;
|
|
237
|
+
/**
|
|
238
|
+
* @internal Set ONLY by matchPartialWithPprReplay on the navigation-replay
|
|
239
|
+
* serve path. Its presence arms the explicit-scope composition in
|
|
240
|
+
* withCacheLookup: a route-derived cache() scope stays authoritative, and
|
|
241
|
+
* only when its lookup MISSes does the seeded doc record supply the match.
|
|
242
|
+
* A capture render must never set this (its match must re-run handlers so
|
|
243
|
+
* SWR recapture stays fresh), which is why the fallback keys off this
|
|
244
|
+
* field and not off the marker itself. Fired when the route-derived
|
|
245
|
+
* scope's own lookup supplied the match — the header then reports
|
|
246
|
+
* `BYPASS; reason=explicit-cache-hit`, never a false replay HIT.
|
|
247
|
+
*/
|
|
248
|
+
onExplicitHit?: () => void;
|
|
249
|
+
/**
|
|
250
|
+
* @internal Companion to onExplicitHit, same lifecycle: fired when the
|
|
251
|
+
* route-derived scope's lookup REFUSED the read (`bypass` outcome — a
|
|
252
|
+
* false condition() or no store). The gate only pre-decides the static
|
|
253
|
+
* cache(false) case; a predicate refusal is known only at lookup time and
|
|
254
|
+
* reports `BYPASS; reason=cache-disabled` post-match.
|
|
255
|
+
*/
|
|
256
|
+
onExplicitBypass?: () => void;
|
|
209
257
|
};
|
|
210
258
|
/**
|
|
211
259
|
* @internal Shell-HIT tail marker: cache/prerender-store hits during THIS
|
|
@@ -518,7 +566,7 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
518
566
|
* This is the type exported to library consumers. Internal code should
|
|
519
567
|
* use the full RequestContext interface directly.
|
|
520
568
|
*/
|
|
521
|
-
export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_pprTransitionDecisions" | "_cacheStore" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_cacheSignal" | "_dynamic" | "res">;
|
|
569
|
+
export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_pprTransitionDecisions" | "_pprReplayPostMatchReason" | "_cacheStore" | "_searchParamsFilter" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_cacheSignal" | "_dynamic" | "res">;
|
|
522
570
|
/**
|
|
523
571
|
* Marker for a waitUntil-scheduled fn whose task promise must NOT enter
|
|
524
572
|
* _pendingBackgroundTasks. Used by the PPR shell capture for its own task:
|
|
@@ -574,6 +622,11 @@ export interface CreateRequestContextOptions<TEnv> {
|
|
|
574
622
|
initialResponse?: Response;
|
|
575
623
|
/** Optional cache store for segment caching (used by CacheScope) */
|
|
576
624
|
cacheStore?: SegmentCacheStore;
|
|
625
|
+
/**
|
|
626
|
+
* Compiled `cache.searchParams` filter from the resolved handler cache
|
|
627
|
+
* config (handler.ts). Stored as _searchParamsFilter.
|
|
628
|
+
*/
|
|
629
|
+
searchParamsFilter?: import("../cache/search-params-filter.js").SearchParamsFilter;
|
|
577
630
|
/**
|
|
578
631
|
* Handler-owned registry of explicit per-scope stores for cross-store tag
|
|
579
632
|
* invalidation. Created once per handler, reused across requests.
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* subtree, pass the `mount` option so useMount() returns the mounted prefix
|
|
38
38
|
* (the segment chain is wrapped in a MountContext exactly as in production).
|
|
39
39
|
*/
|
|
40
|
-
import type
|
|
40
|
+
import { type ComponentType } from "react";
|
|
41
41
|
import type { RenderResult } from "@testing-library/react";
|
|
42
42
|
import type { NavigationStore } from "../browser/types.js";
|
|
43
43
|
import type { EventController } from "../browser/event-controller.js";
|
|
@@ -45,6 +45,7 @@ import type { LoaderDefinition } from "../types.js";
|
|
|
45
45
|
import type { LocationStateDefinition } from "../browser/react/location-state-shared.js";
|
|
46
46
|
import type { Handle } from "../handle.js";
|
|
47
47
|
import type { ThemeConfig } from "../theme/types.js";
|
|
48
|
+
import type { PrefetchStrategy } from "../router/prefetch-default.js";
|
|
48
49
|
/**
|
|
49
50
|
* Seed shape for `options.handle`, matching the handle wire format:
|
|
50
51
|
* `{ [handleName]: { [segmentId]: pushedValues[] } }` (each segment accumulates
|
|
@@ -218,6 +219,14 @@ export interface RenderRouteOptions {
|
|
|
218
219
|
* expect(getByTestId("nonce").textContent).toBe("test-nonce");
|
|
219
220
|
*/
|
|
220
221
|
nonce?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Router default prefetch strategy scoped to this rendered tree. This mirrors
|
|
224
|
+
* `createRouter({ defaultPrefetch })` for Links and eligible plain anchors
|
|
225
|
+
* inside `basename`. `data-prefetch="false"`/`"none"` opts out; `"true"`
|
|
226
|
+
* allows an application route with a common static-resource suffix but does
|
|
227
|
+
* not override a `"none"` default.
|
|
228
|
+
*/
|
|
229
|
+
defaultPrefetch?: PrefetchStrategy;
|
|
221
230
|
}
|
|
222
231
|
/**
|
|
223
232
|
* Imperative handle returned alongside the RTL result.
|
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
* Import from `@rangojs/router/testing` (Vitest) or `@rangojs/router/testing/e2e`
|
|
28
28
|
* (Playwright — same pure helpers, no Vite virtuals).
|
|
29
29
|
*/
|
|
30
|
+
import { type CacheSearchParams } from "../cache/search-params-filter.js";
|
|
30
31
|
/** Production header name (`rsc/shell-serve.ts` `SHELL_STATUS_HEADER`). */
|
|
31
32
|
export declare const SHELL_STATUS_HEADER: string;
|
|
32
33
|
/** Partial-navigation replay decision header from `rsc/rsc-rendering.ts`. */
|
|
33
34
|
export declare const PPR_REPLAY_STATUS_HEADER: string;
|
|
34
35
|
/** Values the serve path writes on `x-rango-shell`. */
|
|
35
36
|
export type ShellStatus = "HIT" | "MISS";
|
|
36
|
-
declare const PPR_REPLAY_BYPASS_REASONS: readonly ["method", "dynamic", "nonce", "store-unavailable", "passive-read-unsupported", "read-error", "no-entry", "invalid-version", "corrupt-entry", "handler-live-holes", "transition-when", "no-segment-snapshot", "snapshot-miss", "stale-build-entry"];
|
|
37
|
+
declare const PPR_REPLAY_BYPASS_REASONS: readonly ["method", "dynamic", "nonce", "store-unavailable", "passive-read-unsupported", "no-navigation-context", "prerender-store", "intercept", "cache-disabled", "read-error", "no-entry", "invalid-version", "corrupt-entry", "handler-live-holes", "transition-when", "no-segment-snapshot", "snapshot-miss", "explicit-cache-hit", "stale-build-entry"];
|
|
37
38
|
/** Bounded reasons a PPR partial request can fall open to ordinary matching. */
|
|
38
39
|
export type PprReplayBypassReason = (typeof PPR_REPLAY_BYPASS_REASONS)[number];
|
|
39
40
|
/** Parsed `x-rango-ppr-replay` value. */
|
|
@@ -55,9 +56,11 @@ export type ShellStatusTarget = Response | {
|
|
|
55
56
|
* module (it pulls React). A parity test pins the two implementations.
|
|
56
57
|
*
|
|
57
58
|
* Accepts a `URL` or an absolute/relative request URL string (relative strings
|
|
58
|
-
* resolve against `http://localhost`).
|
|
59
|
+
* resolve against `http://localhost`). Pass the router's `cache.searchParams`
|
|
60
|
+
* config as `searchParams` when the app under test sets one — the production
|
|
61
|
+
* key applies it, so the expected key must too.
|
|
59
62
|
*/
|
|
60
|
-
export declare function shellCacheKey(url: URL | string): string;
|
|
63
|
+
export declare function shellCacheKey(url: URL | string, searchParams?: CacheSearchParams): string;
|
|
61
64
|
/**
|
|
62
65
|
* Read `x-rango-shell` from a response. Returns `null` when the header is
|
|
63
66
|
* absent (axis-1 / non-ppr / ineligible request).
|
|
@@ -236,7 +236,7 @@ export interface RangoCloudflareOptions extends RangoBaseOptions {
|
|
|
236
236
|
* `.vc-config.json` (and `config.json` for `functionName`).
|
|
237
237
|
*/
|
|
238
238
|
export interface VercelPresetOptions {
|
|
239
|
-
/** Node runtime for the function. @default "
|
|
239
|
+
/** Node runtime for the function. @default "nodejs24.x" */
|
|
240
240
|
runtime?: string;
|
|
241
241
|
/** Max execution time in seconds. @default 30 */
|
|
242
242
|
maxDuration?: number;
|
package/dist/vite/index.js
CHANGED
|
@@ -2530,7 +2530,7 @@ import { resolve } from "node:path";
|
|
|
2530
2530
|
// package.json
|
|
2531
2531
|
var package_default = {
|
|
2532
2532
|
name: "@rangojs/router",
|
|
2533
|
-
version: "0.4.
|
|
2533
|
+
version: "0.4.1",
|
|
2534
2534
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
2535
2535
|
keywords: [
|
|
2536
2536
|
"react",
|
|
@@ -2727,7 +2727,8 @@ var package_default = {
|
|
|
2727
2727
|
picomatch: "^4.0.4",
|
|
2728
2728
|
"rsc-html-stream": "^0.0.7",
|
|
2729
2729
|
srvx: "^0.11.15",
|
|
2730
|
-
tinyexec: "^0.3.2"
|
|
2730
|
+
tinyexec: "^0.3.2",
|
|
2731
|
+
typescript: "^5.3.0 || ^6.0.0"
|
|
2731
2732
|
},
|
|
2732
2733
|
devDependencies: {
|
|
2733
2734
|
"@opentelemetry/api": "^1.9.0",
|
|
@@ -2745,7 +2746,6 @@ var package_default = {
|
|
|
2745
2746
|
jiti: "^2.7.0",
|
|
2746
2747
|
react: "catalog:",
|
|
2747
2748
|
"react-dom": "catalog:",
|
|
2748
|
-
typescript: "^5.3.0",
|
|
2749
2749
|
vitest: "^4.1.9"
|
|
2750
2750
|
},
|
|
2751
2751
|
peerDependencies: {
|
|
@@ -4353,7 +4353,7 @@ export default toNodeHandler(fetchHandler);
|
|
|
4353
4353
|
function assertVercelNodeRuntime(runtime) {
|
|
4354
4354
|
if (runtime != null && !runtime.startsWith("nodejs")) {
|
|
4355
4355
|
throw new Error(
|
|
4356
|
-
`[rango] preset "vercel": runtime "${runtime}" is not supported. This preset emits a Node serverless function; use a "nodejs*" runtime (default "
|
|
4356
|
+
`[rango] preset "vercel": runtime "${runtime}" is not supported. This preset emits a Node serverless function; use a "nodejs*" runtime (default "nodejs24.x"). The Edge runtime is not supported.`
|
|
4357
4357
|
);
|
|
4358
4358
|
}
|
|
4359
4359
|
}
|
|
@@ -4368,7 +4368,7 @@ function assertValidVercelFunctionName(functionName) {
|
|
|
4368
4368
|
}
|
|
4369
4369
|
function buildVercelVcConfig(vercel) {
|
|
4370
4370
|
const vcConfig = {
|
|
4371
|
-
runtime: vercel.runtime ?? "
|
|
4371
|
+
runtime: vercel.runtime ?? "nodejs24.x",
|
|
4372
4372
|
handler: "index.mjs",
|
|
4373
4373
|
launcherType: "Nodejs",
|
|
4374
4374
|
shouldAddHelpers: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rangojs/router",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Django-inspired RSC router with composable URL patterns",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -176,6 +176,19 @@
|
|
|
176
176
|
"access": "public",
|
|
177
177
|
"tag": "latest"
|
|
178
178
|
},
|
|
179
|
+
"scripts": {
|
|
180
|
+
"build": "pnpm run build:types && pnpm exec esbuild src/vite/index.ts --bundle --format=esm --outfile=dist/vite/index.js --platform=node --packages=external && mkdir -p dist/vite/plugins && cp src/vite/plugins/cloudflare-protocol-loader-hook.mjs dist/vite/plugins/cloudflare-protocol-loader-hook.mjs && pnpm exec esbuild src/testing/vitest.ts --bundle --format=esm --outfile=dist/testing/vitest.js --platform=node --packages=external && pnpm exec esbuild src/bin/rango.ts --bundle --format=esm --outfile=dist/bin/rango.js --platform=node --packages=external --banner:js='#!/usr/bin/env node' && chmod +x dist/bin/rango.js",
|
|
181
|
+
"build:types": "rm -rf dist/types && pnpm exec tsc -p tsconfig.types.json",
|
|
182
|
+
"prepublishOnly": "pnpm build",
|
|
183
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.strict-check.json --noEmit && tsc -p tsconfig.augment-check.json --noEmit",
|
|
184
|
+
"test": "playwright test",
|
|
185
|
+
"test:ui": "playwright test --ui",
|
|
186
|
+
"test:hmr-local": "playwright test --project=dev-warmup --project=hmr-basename --project=hmr-prerender --no-deps --workers=1 && RANGO_E2E_ROUTE_HMR_ONLY=1 playwright test --project=hmr-routes --no-deps --workers=1",
|
|
187
|
+
"test:hmr-routes-local": "RANGO_E2E_ROUTE_HMR_ONLY=1 playwright test --project=hmr-routes --no-deps --workers=1",
|
|
188
|
+
"test:unit": "pnpm run build:types && vitest run",
|
|
189
|
+
"test:unit:watch": "vitest",
|
|
190
|
+
"test:unit:rsc": "vitest run --config vitest.rsc.config.ts"
|
|
191
|
+
},
|
|
179
192
|
"dependencies": {
|
|
180
193
|
"@types/debug": "^4.1.12",
|
|
181
194
|
"@vitejs/plugin-rsc": "^0.5.27",
|
|
@@ -184,26 +197,26 @@
|
|
|
184
197
|
"picomatch": "^4.0.4",
|
|
185
198
|
"rsc-html-stream": "^0.0.7",
|
|
186
199
|
"srvx": "^0.11.15",
|
|
187
|
-
"tinyexec": "^0.3.2"
|
|
200
|
+
"tinyexec": "^0.3.2",
|
|
201
|
+
"typescript": "^5.3.0 || ^6.0.0"
|
|
188
202
|
},
|
|
189
203
|
"devDependencies": {
|
|
190
204
|
"@opentelemetry/api": "^1.9.0",
|
|
191
205
|
"@opentelemetry/context-async-hooks": "^2.9.0",
|
|
192
206
|
"@opentelemetry/sdk-trace-base": "^2.9.0",
|
|
193
207
|
"@playwright/test": "^1.49.1",
|
|
208
|
+
"@shared/e2e": "workspace:*",
|
|
194
209
|
"@testing-library/dom": "^10.4.1",
|
|
195
210
|
"@testing-library/react": "^16.3.2",
|
|
196
211
|
"@types/node": "^24.10.1",
|
|
197
|
-
"@types/react": "
|
|
198
|
-
"@types/react-dom": "
|
|
212
|
+
"@types/react": "catalog:",
|
|
213
|
+
"@types/react-dom": "catalog:",
|
|
199
214
|
"esbuild": "^0.28.1",
|
|
200
215
|
"happy-dom": "^20.10.1",
|
|
201
216
|
"jiti": "^2.7.0",
|
|
202
|
-
"react": "
|
|
203
|
-
"react-dom": "
|
|
204
|
-
"
|
|
205
|
-
"vitest": "^4.1.9",
|
|
206
|
-
"@shared/e2e": "0.0.1"
|
|
217
|
+
"react": "catalog:",
|
|
218
|
+
"react-dom": "catalog:",
|
|
219
|
+
"vitest": "^4.1.9"
|
|
207
220
|
},
|
|
208
221
|
"peerDependencies": {
|
|
209
222
|
"@cloudflare/vite-plugin": "^1.42.1",
|
|
@@ -242,17 +255,5 @@
|
|
|
242
255
|
},
|
|
243
256
|
"engines": {
|
|
244
257
|
"node": ">=24.0.0"
|
|
245
|
-
},
|
|
246
|
-
"scripts": {
|
|
247
|
-
"build": "pnpm run build:types && pnpm exec esbuild src/vite/index.ts --bundle --format=esm --outfile=dist/vite/index.js --platform=node --packages=external && mkdir -p dist/vite/plugins && cp src/vite/plugins/cloudflare-protocol-loader-hook.mjs dist/vite/plugins/cloudflare-protocol-loader-hook.mjs && pnpm exec esbuild src/testing/vitest.ts --bundle --format=esm --outfile=dist/testing/vitest.js --platform=node --packages=external && pnpm exec esbuild src/bin/rango.ts --bundle --format=esm --outfile=dist/bin/rango.js --platform=node --packages=external --banner:js='#!/usr/bin/env node' && chmod +x dist/bin/rango.js",
|
|
248
|
-
"build:types": "rm -rf dist/types && pnpm exec tsc -p tsconfig.types.json",
|
|
249
|
-
"typecheck": "tsc --noEmit && tsc -p tsconfig.strict-check.json --noEmit && tsc -p tsconfig.augment-check.json --noEmit",
|
|
250
|
-
"test": "playwright test",
|
|
251
|
-
"test:ui": "playwright test --ui",
|
|
252
|
-
"test:hmr-local": "playwright test --project=dev-warmup --project=hmr-basename --project=hmr-prerender --no-deps --workers=1 && RANGO_E2E_ROUTE_HMR_ONLY=1 playwright test --project=hmr-routes --no-deps --workers=1",
|
|
253
|
-
"test:hmr-routes-local": "RANGO_E2E_ROUTE_HMR_ONLY=1 playwright test --project=hmr-routes --no-deps --workers=1",
|
|
254
|
-
"test:unit": "pnpm run build:types && vitest run",
|
|
255
|
-
"test:unit:watch": "vitest",
|
|
256
|
-
"test:unit:rsc": "vitest run --config vitest.rsc.config.ts"
|
|
257
258
|
}
|
|
258
|
-
}
|
|
259
|
+
}
|
package/skills/caching/SKILL.md
CHANGED
|
@@ -267,6 +267,45 @@ const router = createRouter({
|
|
|
267
267
|
});
|
|
268
268
|
```
|
|
269
269
|
|
|
270
|
+
### Search param key filtering (`cache.searchParams`)
|
|
271
|
+
|
|
272
|
+
By default every non-reserved query param keys the cache, so
|
|
273
|
+
`?utm_source=tw` and `?utm_source=ig` occupy separate slots in every tier.
|
|
274
|
+
The global `searchParams` option controls which params participate in default
|
|
275
|
+
cache-key generation:
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
import { createRouter, TRACKING_SEARCH_PARAMS } from "@rangojs/router";
|
|
279
|
+
|
|
280
|
+
const router = createRouter({
|
|
281
|
+
document: Document,
|
|
282
|
+
urls: urlpatterns,
|
|
283
|
+
cache: {
|
|
284
|
+
store,
|
|
285
|
+
// "all" (default) | "none" | { include: string[] } | { exclude: string[] }
|
|
286
|
+
searchParams: { exclude: TRACKING_SEARCH_PARAMS },
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
- **Key-only**: `ctx.searchParams` and the request URL are untouched — handlers
|
|
292
|
+
and loaders still see the full query string.
|
|
293
|
+
- **Matching**: exact names plus a `*` SUFFIX wildcard (`"utm_*"`). No RegExp.
|
|
294
|
+
- **All tiers**: segment, document, response, PPR shell capture/lookup, the
|
|
295
|
+
baked-shell manifest gate (a URL whose only params are excluded ones now
|
|
296
|
+
matches the prerendered shell), and `"use cache"` ctx key normalization.
|
|
297
|
+
- **`cache({ key })` override wins**: a custom key bypasses the filter along
|
|
298
|
+
with the rest of default key generation.
|
|
299
|
+
- **The footgun**: excluding a param promises the rendered output does not
|
|
300
|
+
depend on it. If it does, the first variant is cached and served to everyone.
|
|
301
|
+
That is why the default is `"all"`.
|
|
302
|
+
- `TRACKING_SEARCH_PARAMS` (also exported from `@rangojs/router/cache`) covers
|
|
303
|
+
`utm_*`, `gclid`, `fbclid`, `msclkid`, `ttclid`, `mc_cid`/`mc_eid`, and the
|
|
304
|
+
other common click-id params.
|
|
305
|
+
|
|
306
|
+
Global-only by design — the per-route "this page varies only by `q`" case is
|
|
307
|
+
already expressible with `cache({ key })`.
|
|
308
|
+
|
|
270
309
|
## Cache Stores
|
|
271
310
|
|
|
272
311
|
### Memory Store
|
|
@@ -542,7 +542,13 @@ analog but operates on loader/query reload, not RSC-segment render.
|
|
|
542
542
|
`<Link prefetch="hover|viewport|render|adaptive|none">` (default: the router's
|
|
543
543
|
`defaultPrefetch`, `"none"` in development and `"viewport"` in production), plus
|
|
544
544
|
`prefetchKey` (`":source"` scopes a prefetch to the originating page for routes
|
|
545
|
-
whose response branches on `currentUrl`).
|
|
545
|
+
whose response branches on `currentUrl`). Intercepted plain `<a href>` elements
|
|
546
|
+
inside the router basename follow the same default; common static-resource
|
|
547
|
+
extensions are excluded unless `data-prefetch="true"` identifies an application
|
|
548
|
+
route, and `data-prefetch="false"` or `"none"` opts out unsafe GET links. A
|
|
549
|
+
container with `data-prefetch-scope="false"` or `"none"` is a hard subtree boundary for both
|
|
550
|
+
Links and plain anchors, so one annotation suppresses speculative work for a
|
|
551
|
+
whole navigation section. The distinguishing part is the stability
|
|
546
552
|
gating: a queued prefetch (`viewport`/`render`) will not fire until **both** the
|
|
547
553
|
main thread is idle (`requestIdleCallback`, 200ms fallback) **and**
|
|
548
554
|
`waitForViewportImages()` resolves — in-viewport images that are not `.complete`
|
package/skills/links/SKILL.md
CHANGED
|
@@ -423,6 +423,30 @@ Don't edit the file by hand — re-run codegen when patterns change.
|
|
|
423
423
|
}
|
|
424
424
|
```
|
|
425
425
|
|
|
426
|
+
## Prefetch boundaries
|
|
427
|
+
|
|
428
|
+
`Link` follows its `prefetch` prop or the router's `defaultPrefetch`; eligible
|
|
429
|
+
plain anchors follow the router default. When a whole DOM section must never
|
|
430
|
+
speculate, mark its container instead of repeating per-link opt-outs:
|
|
431
|
+
|
|
432
|
+
```tsx
|
|
433
|
+
<section data-prefetch-scope="none">
|
|
434
|
+
<Link to="/activity" prefetch="viewport">
|
|
435
|
+
Activity
|
|
436
|
+
</Link>
|
|
437
|
+
<a href="/export">Export</a>
|
|
438
|
+
</section>
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
The scope is a hard opt-out for every descendant Link and plain anchor; `"false"`
|
|
442
|
+
and `"none"` are equivalent. An explicit `prefetch` prop or
|
|
443
|
+
`data-prefetch="true"` cannot override it, and navigation still works normally.
|
|
444
|
+
Use `data-prefetch="false"` or `"none"` directly on a plain anchor when only that
|
|
445
|
+
anchor is unsafe. Dynamic scope changes re-evaluate only descendant anchors and
|
|
446
|
+
mounted viewport/render Links. Links share one document-level scope observer,
|
|
447
|
+
not one observer per Link or container. Adding a scope cannot recall work already
|
|
448
|
+
queued or in flight; removing it re-arms both Link types.
|
|
449
|
+
|
|
426
450
|
## When to use what
|
|
427
451
|
|
|
428
452
|
| Context | API | Resolves | Use for |
|