@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
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @rangojs/router/testing/flight
|
|
3
|
-
*
|
|
4
|
-
* Real React Server Component (Flight) rendering for unit tests. This entry is
|
|
5
|
-
* SEPARATE from the main ./testing barrel because its serializer (the vendored
|
|
6
|
-
* react-server-dom build) can only be imported under the `react-server` node
|
|
7
|
-
* condition; importing it elsewhere throws. Use it only from a Vitest project
|
|
8
|
-
* configured with that condition (see vitest.rsc.config.ts) — name those test
|
|
9
|
-
* files `*.rsc-test.{ts,tsx}` and run `pnpm test:unit:rsc`.
|
|
10
|
-
*
|
|
11
|
-
* This entry deliberately does NOT pull in Vitest. The `toMatchFlight` /
|
|
12
|
-
* `toMatchFlightSnapshot` matchers (which import `vitest`) live at the separate
|
|
13
|
-
* `@rangojs/router/testing/flight-matchers` subpath, so a consumer can import
|
|
14
|
-
* `renderToFlightString` without taking a hard dependency on Vitest.
|
|
15
|
-
*
|
|
16
|
-
* `renderToFlightString` returns the wire STRING (for `toMatchFlight`).
|
|
17
|
-
* `renderServerTree` additionally deserializes it back to an inspectable React
|
|
18
|
-
* element tree, so you can assert typed prop fidelity across the client boundary
|
|
19
|
-
* (a `Date` comes back a `Date`) and detect inlined-vs-island. Serialize +
|
|
20
|
-
* deserialize only — no hydration/interaction (that is the e2e tier).
|
|
21
|
-
*/
|
|
22
|
-
export { renderToFlightString, normalizeFlight, assertFlightRuntimeAvailable, } from "./flight.js";
|
|
23
|
-
export type { RenderToFlightStringOptions } from "./flight.js";
|
|
24
|
-
export { renderServerTree, findClientBoundaries, findElements, textContent, assertFlightTreeRuntimeAvailable, } from "./flight-tree.js";
|
|
25
|
-
export type { RenderServerTreeOptions, RenderServerTreeResult, ClientBoundary, BoundarySelector, FoundElement, ElementSelector, } from "./flight-tree.js";
|
|
26
|
-
export { renderHandler } from "./render-handler.js";
|
|
27
|
-
export type { TestableHandler, RenderHandlerOptions, RenderHandlerResult, StateCookieSeed, } from "./render-handler.js";
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* assertGeneratedRoutesMatch — pin the generated named-routes map against the
|
|
3
|
-
* router's runtime route map.
|
|
4
|
-
*
|
|
5
|
-
* The Vite plugin writes a `*.named-routes.gen.ts` file mapping route names to
|
|
6
|
-
* URL patterns; consumers import that map and pass it here. The check compares
|
|
7
|
-
* it to the router's runtime `routeMap`, catching drift when a route is added,
|
|
8
|
-
* removed, renamed, or its pattern changes without regenerating the file.
|
|
9
|
-
*
|
|
10
|
-
* Directionality (relative to the generated map):
|
|
11
|
-
* - missing: present in the generated map but NOT at runtime (stale entry).
|
|
12
|
-
* - extra: present at runtime but NOT in the generated map (ungenerated route).
|
|
13
|
-
* Auto-generated internal names (the "$path_" / "$prefix_" prefixes)
|
|
14
|
-
* are excluded — they live in the runtime map but are never written
|
|
15
|
-
* to the generated file, so they are not drift.
|
|
16
|
-
* - mismatch: present in both under the same name, but the patterns differ.
|
|
17
|
-
*
|
|
18
|
-
* When `generatedMap` is omitted, the global route map (getGlobalRouteMap()) is
|
|
19
|
-
* used as the generated side — useful when a single router has registered into
|
|
20
|
-
* the global map.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Router shape this check depends on: a runtime route map, plus the optional
|
|
24
|
-
* `findMatch` used to force-expand lazy `include()`d routes (see below).
|
|
25
|
-
*/
|
|
26
|
-
interface RouterWithRouteMap {
|
|
27
|
-
routeMap: Record<string, unknown>;
|
|
28
|
-
findMatch?: (pathname: string) => unknown;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* A single name/pattern mismatch: [routeName, generatedPattern, runtimePattern].
|
|
32
|
-
*/
|
|
33
|
-
export type GeneratedRouteMismatch = [
|
|
34
|
-
name: string,
|
|
35
|
-
generated: string,
|
|
36
|
-
runtime: string
|
|
37
|
-
];
|
|
38
|
-
/**
|
|
39
|
-
* Structured diff between the generated route map and the runtime route map.
|
|
40
|
-
*/
|
|
41
|
-
export interface GeneratedRoutesDiff {
|
|
42
|
-
/** Names in the generated map but absent at runtime. */
|
|
43
|
-
missing: string[];
|
|
44
|
-
/** Names at runtime but absent from the generated map. */
|
|
45
|
-
extra: string[];
|
|
46
|
-
/** Names in both with differing patterns. */
|
|
47
|
-
mismatch: GeneratedRouteMismatch[];
|
|
48
|
-
/** True when missing, extra, and mismatch are all empty. */
|
|
49
|
-
ok: boolean;
|
|
50
|
-
}
|
|
51
|
-
export declare function diffGeneratedRoutes(router: RouterWithRouteMap, generatedMap?: Record<string, unknown>): Promise<GeneratedRoutesDiff>;
|
|
52
|
-
/**
|
|
53
|
-
* Assert the router's runtime route map matches the generated map. Throws a
|
|
54
|
-
* descriptive Error listing every missing, extra, and mismatched route when
|
|
55
|
-
* they diverge.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* import generated from "./router.named-routes.gen";
|
|
60
|
-
* import { router } from "./router";
|
|
61
|
-
*
|
|
62
|
-
* await assertGeneratedRoutesMatch(router, generated);
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export declare function assertGeneratedRoutesMatch(router: RouterWithRouteMap, generatedMap?: Record<string, unknown>): Promise<void>;
|
|
66
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @rangojs/router/testing
|
|
3
|
-
*
|
|
4
|
-
* Consumer-facing testing primitives for apps built on @rangojs/router.
|
|
5
|
-
*
|
|
6
|
-
* This is the entry for UNIT and INTEGRATION tests, meant to run under a
|
|
7
|
-
* Vite-driven Vitest project (the rango Vite plugin must be active so the
|
|
8
|
-
* `@rangojs/router:version` and related virtual modules the router internals
|
|
9
|
-
* import can resolve; alternatively alias `@rangojs/router:version`). Importing
|
|
10
|
-
* this module references neither React, @testing-library/react, @playwright/test,
|
|
11
|
-
* nor the RSC runtime — a unit suite testing only loaders/middleware/dispatch
|
|
12
|
-
* pulls in none of them.
|
|
13
|
-
*
|
|
14
|
-
* The other surfaces are SEPARATE entries because each pulls a dependency or
|
|
15
|
-
* runtime this barrel deliberately keeps out:
|
|
16
|
-
* - `@rangojs/router/testing/dom` — `renderRoute` (the RTL component stub). Kept
|
|
17
|
-
* separate so this barrel never references React, the browser runtime, or
|
|
18
|
-
* `@testing-library/react` types — a unit suite testing only loaders/middleware
|
|
19
|
-
* needs none of them.
|
|
20
|
-
* - `@rangojs/router/testing/e2e` — the Playwright harness (createRangoE2E,
|
|
21
|
-
* useFixture, parityDescribe, expectParity, matchers). Kept separate so it is
|
|
22
|
-
* loadable in a plain (non-Vite) Playwright runner, which cannot resolve the
|
|
23
|
-
* router-manifest virtual modules this barrel pulls in.
|
|
24
|
-
* - `@rangojs/router/testing/flight` — real Flight rendering. Its serializer
|
|
25
|
-
* (vendored react-server-dom) loads only under the `react-server` node
|
|
26
|
-
* condition and would throw if pulled into this barrel.
|
|
27
|
-
*
|
|
28
|
-
* Layers:
|
|
29
|
-
* - Unit: runMiddleware, runLoader
|
|
30
|
-
* - Integration: dispatch (request -> Response)
|
|
31
|
-
* - Cross-cut: assertCacheStatus, assertGeneratedRoutesMatch
|
|
32
|
-
* - Component: see @rangojs/router/testing/dom (renderRoute)
|
|
33
|
-
* - E2E: see @rangojs/router/testing/e2e
|
|
34
|
-
* - RSC: see @rangojs/router/testing/flight
|
|
35
|
-
*/
|
|
36
|
-
export { runMiddleware } from "./run-middleware.js";
|
|
37
|
-
export type { RunMiddlewareOptions, RunMiddlewareResult, } from "./run-middleware.js";
|
|
38
|
-
export { runLoader, runLoaderResult } from "./run-loader.js";
|
|
39
|
-
export type { RunLoaderOptions, RunLoaderResult, UseResolver, TestLoaderContext, } from "./run-loader.js";
|
|
40
|
-
export { runTransitionWhen } from "./run-transition-when.js";
|
|
41
|
-
export type { RunTransitionWhenOptions, RunTransitionWhenResult, } from "./run-transition-when.js";
|
|
42
|
-
export { dispatch } from "./dispatch.js";
|
|
43
|
-
export type { DispatchOptions } from "./dispatch.js";
|
|
44
|
-
export { assertCacheStatus, assertCacheDecision, parseCacheHeader, createCacheSink, filterCacheDecisions, } from "./cache-status.js";
|
|
45
|
-
export type { ExpectedCacheStatus, CacheStatusTarget, CacheSink, } from "./cache-status.js";
|
|
46
|
-
export type { TelemetryEvent, TelemetrySink, CacheDecisionEvent, CacheSegmentSignal, CacheSegmentStatus, } from "../router/telemetry.js";
|
|
47
|
-
export { collectHandle } from "./collect-handle.js";
|
|
48
|
-
export { diffGeneratedRoutes, assertGeneratedRoutesMatch, } from "./generated-routes.js";
|
|
49
|
-
export type { GeneratedRoutesDiff, GeneratedRouteMismatch, } from "./generated-routes.js";
|
|
50
|
-
export { createTestRequestContext, runInRequestContext, toRequest, seedVariables, } from "./internal/context.js";
|
|
51
|
-
export type { CreateTestContextOptions, TestRequestContext, TestRequestContextObject, RunInRequestContextResult, VarsInit, StateCookieSeed, } from "./internal/context.js";
|
|
52
|
-
export { runWithRequestContext } from "../server/request-context.js";
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared internals for the consumer testing primitives.
|
|
3
|
-
*
|
|
4
|
-
* Builds a real RequestContext via the same createRequestContext the RSC
|
|
5
|
-
* handler uses, with test-friendly defaults, so loaders and middleware run
|
|
6
|
-
* with production-fidelity context (cookies, headers, get/set, use, reverse)
|
|
7
|
-
* instead of a hand-rolled mock.
|
|
8
|
-
*/
|
|
9
|
-
import { type RequestContext } from "../../server/request-context.js";
|
|
10
|
-
import { seedVariables, type VarsInit, type StateCookieSeed } from "./seed-vars.js";
|
|
11
|
-
import type { ThemeConfig } from "../../theme/types.js";
|
|
12
|
-
import type { SegmentCacheStore } from "../../cache/types.js";
|
|
13
|
-
import type { CacheProfile } from "../../cache/profile-registry.js";
|
|
14
|
-
export type { VarsInit, StateCookieSeed };
|
|
15
|
-
export { seedVariables };
|
|
16
|
-
/** Normalize a Request | string | undefined into a concrete Request. */
|
|
17
|
-
export declare function toRequest(request: Request | string | undefined, init?: RequestInit): Request;
|
|
18
|
-
export interface CreateTestContextOptions<TEnv> {
|
|
19
|
-
env?: TEnv;
|
|
20
|
-
request?: Request | string;
|
|
21
|
-
requestInit?: RequestInit;
|
|
22
|
-
/** Backing store for ctx.get()/ctx.set(); pre-seeded from `vars`. */
|
|
23
|
-
variables?: Record<string, unknown>;
|
|
24
|
-
/** Variables a prior middleware would have set (object or [key, value] list). */
|
|
25
|
-
vars?: VarsInit;
|
|
26
|
-
/** Route name -> pattern map enabling ctx.reverse() without global state. */
|
|
27
|
-
routeMap?: Record<string, string>;
|
|
28
|
-
routeName?: string;
|
|
29
|
-
params?: Record<string, string>;
|
|
30
|
-
/**
|
|
31
|
-
* Seed `ctx.build` (default false). Set `true` to unit-test middleware or a
|
|
32
|
-
* handler that branches on the build-time PPR shell-capture pass — e.g.
|
|
33
|
-
* `if (ctx.build) ctx.dynamic()`. Mirrors the synthetic build request the
|
|
34
|
-
* shell-capture producer creates; also makes `ctx.waitUntil()` inert, as at
|
|
35
|
-
* build time.
|
|
36
|
-
*/
|
|
37
|
-
build?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Router basename for this request (what the RSC handler stores on the
|
|
40
|
-
* context). Drives redirect() prefixing. Normalized exactly like
|
|
41
|
-
* createRouter({ basename }) (leading slash forced, trailing stripped, bare
|
|
42
|
-
* "/" -> undefined) so passing the same value your router takes yields the
|
|
43
|
-
* same redirect Location. Defaults to undefined (no basename).
|
|
44
|
-
*/
|
|
45
|
-
basename?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Cache store backing `use cache` functions invoked during the test, the
|
|
48
|
-
* same shape `createRouter({ cache })` resolves. Without it,
|
|
49
|
-
* registerCachedFunction bypasses (it checks for a store FIRST), so a cached
|
|
50
|
-
* function runs uncached and its taint/profile guards never fire. Wire one
|
|
51
|
-
* (e.g. `new MemorySegmentCacheStore()`) to exercise real cache behavior.
|
|
52
|
-
*/
|
|
53
|
-
cacheStore?: SegmentCacheStore;
|
|
54
|
-
/**
|
|
55
|
-
* Cache profiles in the `createRouter({ cacheProfiles })` shape. Required for
|
|
56
|
-
* a `use cache: "profileName"` function to resolve its profile (an unknown
|
|
57
|
-
* profile throws), once a `cacheStore` is wired.
|
|
58
|
-
*/
|
|
59
|
-
cacheProfiles?: Record<string, CacheProfile>;
|
|
60
|
-
/**
|
|
61
|
-
* Theme config in the same shape `createRouter({ theme })` takes (resolved
|
|
62
|
-
* internally). Without it `ctx.theme`/`ctx.setTheme` are inert (undefined),
|
|
63
|
-
* mirroring an app with no theme configured. Pass one (e.g. `true`, or
|
|
64
|
-
* `{ themes: [...] }`) to exercise a handler that reads them.
|
|
65
|
-
*/
|
|
66
|
-
theme?: ThemeConfig | true;
|
|
67
|
-
/**
|
|
68
|
-
* Customize the rango state cookie that `invalidateClientCache()` rotates.
|
|
69
|
-
* The name is ALWAYS seeded (default `rango-state_router_0`) so a call to
|
|
70
|
-
* `invalidateClientCache()` rotates and emits the `Set-Cookie` exactly as in
|
|
71
|
-
* production, rather than silently no-opping. Override `prefix`/`routerId` to
|
|
72
|
-
* match your `createRouter({ stateCookiePrefix, id })` so the test asserts the
|
|
73
|
-
* same name, or `version` (the build identifier prefixed to the rotated
|
|
74
|
-
* `{version}:{timestamp}` value, default `"0"`). Assert
|
|
75
|
-
* `response.headers.getSetCookie()` against the resolved `stateCookieName`
|
|
76
|
-
* (returned by `runInRequestContext`).
|
|
77
|
-
*/
|
|
78
|
-
stateCookie?: StateCookieSeed;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The seeded RequestContext with its `reverse` RELAXED to accept any route NAME
|
|
82
|
-
* from the `routeMap` you passed, rather than the global `Rango.GeneratedRouteMap`
|
|
83
|
-
* union — so reversing a test-only route name is not a type error (it works at
|
|
84
|
-
* runtime; the names come from your `routeMap`). Mirrors runLoader's
|
|
85
|
-
* `TestLoaderContext.reverse`. Everything else is the real `RequestContext`.
|
|
86
|
-
*/
|
|
87
|
-
export type TestRequestContextObject<TEnv> = Omit<RequestContext<TEnv>, "reverse"> & {
|
|
88
|
-
reverse: (name: string, params?: Record<string, string>, search?: Record<string, unknown>) => string;
|
|
89
|
-
};
|
|
90
|
-
export interface TestRequestContext<TEnv> {
|
|
91
|
-
ctx: TestRequestContextObject<TEnv>;
|
|
92
|
-
request: Request;
|
|
93
|
-
url: URL;
|
|
94
|
-
variables: Record<string, unknown>;
|
|
95
|
-
/**
|
|
96
|
-
* The resolved rango state cookie name seeded into the context (default
|
|
97
|
-
* `rango-state_router_0`, or composed from `opts.stateCookie`). The name a
|
|
98
|
-
* call to `invalidateClientCache()` rotates.
|
|
99
|
-
*/
|
|
100
|
-
stateCookieName: string;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Create a real RequestContext for unit-testing loaders/middleware.
|
|
104
|
-
*
|
|
105
|
-
* The returned `ctx` must be ENTERED before use — wrap your call in
|
|
106
|
-
* `runWithRequestContext(ctx, fn)` (re-exported from `@rangojs/router/testing`)
|
|
107
|
-
* so that cookie/header mutations and `getRequestContext()` resolve. For the
|
|
108
|
-
* common case prefer {@link runInRequestContext}, which builds AND enters the
|
|
109
|
-
* context in a single call.
|
|
110
|
-
*/
|
|
111
|
-
export declare function createTestRequestContext<TEnv>(opts?: CreateTestContextOptions<TEnv>): TestRequestContext<TEnv>;
|
|
112
|
-
/**
|
|
113
|
-
* What a run accumulated on the request context, surfaced as PUBLIC values so a
|
|
114
|
-
* test never has to cast through the `@internal` `ctx.res` / `ctx.cookies()` to
|
|
115
|
-
* assert what an action produced.
|
|
116
|
-
*/
|
|
117
|
-
export interface RunInRequestContextResult<T> {
|
|
118
|
-
/**
|
|
119
|
-
* The value `fn` returned (awaited), or `undefined` if `fn` threw — in which
|
|
120
|
-
* case the thrown value is on {@link thrown}. The snapshot below is captured
|
|
121
|
-
* either way.
|
|
122
|
-
*/
|
|
123
|
-
result: T | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* The value `fn` threw, or `undefined` if it returned normally. Commonly a
|
|
126
|
-
* `Response` from `throw redirect(...)` / `throw notFound()` — the dominant
|
|
127
|
-
* cookie+flash case is an action that sets them then throws a redirect — so
|
|
128
|
-
* this (and the snapshot below) is observable WITHOUT wrapping the action in
|
|
129
|
-
* your own try/catch. NOTE: the value is captured, NOT re-thrown; assert on it
|
|
130
|
-
* for a throwing action.
|
|
131
|
-
*/
|
|
132
|
-
thrown: unknown;
|
|
133
|
-
/**
|
|
134
|
-
* A Response carrying the status, headers, and Set-Cookie the run set (via
|
|
135
|
-
* `cookies().set()`, `ctx.header()`, etc.). Assert Set-Cookie with
|
|
136
|
-
* `response.headers.getSetCookie()`. When `fn` threw a `Response` (a redirect),
|
|
137
|
-
* THIS is that Response with the accumulated Set-Cookie/headers merged in
|
|
138
|
-
* (mirroring how the framework merges them in production), so a redirect's
|
|
139
|
-
* Location AND the cookies it set are both observable here.
|
|
140
|
-
*/
|
|
141
|
-
response: Response;
|
|
142
|
-
/**
|
|
143
|
-
* The effective cookie view after the run: request cookies merged with
|
|
144
|
-
* anything the run set or deleted (last-write-wins), as `{ name: value }`.
|
|
145
|
-
*/
|
|
146
|
-
cookies: Record<string, string>;
|
|
147
|
-
/**
|
|
148
|
-
* The response headers the run set (via `ctx.header(...)`, plus a thrown
|
|
149
|
-
* redirect's `Location`), as a plain `{ name: value }` object — the same view
|
|
150
|
-
* as `response.headers`, but assertable like `cookies`/`locationState`.
|
|
151
|
-
* EXCLUDES `set-cookie` (use `cookies`, or `response.headers.getSetCookie()`).
|
|
152
|
-
* Header names are lowercased (HTTP headers are case-insensitive).
|
|
153
|
-
*/
|
|
154
|
-
headers: Record<string, string>;
|
|
155
|
-
/**
|
|
156
|
-
* Location state the run set via `ctx.setLocationState()` / `redirect({ state })`,
|
|
157
|
-
* resolved to the flat `{ key: value }` shape the client reads off
|
|
158
|
-
* `history.state` (empty object when none) — so a post-action flash ("Saved!")
|
|
159
|
-
* is assertable at the unit layer.
|
|
160
|
-
*/
|
|
161
|
-
locationState: Record<string, unknown>;
|
|
162
|
-
/**
|
|
163
|
-
* The resolved rango state cookie name seeded into the run (default
|
|
164
|
-
* `rango-state_router_0`, or composed from `opts.stateCookie`). Assert an
|
|
165
|
-
* action's `invalidateClientCache()` rotation against it without recomputing:
|
|
166
|
-
* `response.headers.getSetCookie().some((c) => c.startsWith(stateCookieName + "="))`.
|
|
167
|
-
*/
|
|
168
|
-
stateCookieName: string;
|
|
169
|
-
}
|
|
170
|
-
export declare function snapshotRunEffects<TEnv>(ctx: RequestContext<TEnv>): {
|
|
171
|
-
cookies: Record<string, string>;
|
|
172
|
-
locationState: Record<string, unknown>;
|
|
173
|
-
};
|
|
174
|
-
export declare function headersToObject(headers: Headers): Record<string, string>;
|
|
175
|
-
export declare function buildRunResponse<TEnv>(ctx: RequestContext<TEnv>, thrown: unknown): Response;
|
|
176
|
-
export declare function buildRunSnapshot<TEnv>(ctx: RequestContext<TEnv>, thrown: unknown, stateCookieName: string): {
|
|
177
|
-
thrown: unknown;
|
|
178
|
-
response: Response;
|
|
179
|
-
cookies: Record<string, string>;
|
|
180
|
-
headers: Record<string, string>;
|
|
181
|
-
locationState: Record<string, unknown>;
|
|
182
|
-
stateCookieName: string;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Build a seeded RequestContext (via {@link createTestRequestContext}) and run
|
|
186
|
-
* `fn` inside it, so code under test that calls `getRequestContext()`,
|
|
187
|
-
* `cookies()`, or reads/mutates request headers resolves exactly as in
|
|
188
|
-
* production.
|
|
189
|
-
*
|
|
190
|
-
* This is the entry point for the advanced cases the unit wrappers
|
|
191
|
-
* (`runLoader` / `runMiddleware`) do not model — most notably a server ACTION
|
|
192
|
-
* that authenticates off the request cookie or sets a session cookie / flash:
|
|
193
|
-
* an action has no loader context, so `runLoader` is the wrong shape, yet it
|
|
194
|
-
* still needs a real request context to read the cookie and resolve
|
|
195
|
-
* `getRequestContext()`.
|
|
196
|
-
*
|
|
197
|
-
* Returns `{ result, thrown, response, cookies, headers, locationState }` so the
|
|
198
|
-
* action's OUTPUT (Set-Cookie, response headers, flash) is assertable without
|
|
199
|
-
* casting through the `@internal` `ctx.res` / `ctx.cookies()`. `fn` may be async — the context stays
|
|
200
|
-
* active across its awaits (AsyncLocalStorage), and the snapshot is captured
|
|
201
|
-
* whether `fn` returns OR throws. The throw path matters: the most common
|
|
202
|
-
* cookie+flash case is an auth action that sets a cookie + flash then
|
|
203
|
-
* `throw redirect(...)` on success — the thrown redirect is on `thrown` (NOT
|
|
204
|
-
* re-thrown) and its Location plus the cookies are on `response`/`cookies`.
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```ts
|
|
208
|
-
* const { result, cookies, response, thrown } = await runInRequestContext(
|
|
209
|
-
* () => loginAction(input), // sets a session cookie, then `throw redirect("/app")`
|
|
210
|
-
* {
|
|
211
|
-
* env,
|
|
212
|
-
* request: new Request("https://app.test/", {
|
|
213
|
-
* headers: { Cookie: "sid=abc" },
|
|
214
|
-
* }),
|
|
215
|
-
* },
|
|
216
|
-
* );
|
|
217
|
-
* expect(cookies.session).toBe("new-token");
|
|
218
|
-
* expect(headers.location).toBe("/app"); // response headers as a plain object
|
|
219
|
-
* expect((thrown as Response).headers.get("Location")).toBe("/app");
|
|
220
|
-
* expect(response.headers.getSetCookie()).toContainEqual(
|
|
221
|
-
* expect.stringContaining("session="),
|
|
222
|
-
* );
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
export declare function runInRequestContext<T, TEnv = unknown>(fn: (ctx: RequestContext<TEnv>) => T | Promise<T>, opts?: CreateTestContextOptions<TEnv>): Promise<RunInRequestContextResult<T>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Variable seeding shared by the node/DOM testing tier (internal/context.ts)
|
|
3
|
-
* AND the react-server Flight tier (flight.ts). Depends only on the
|
|
4
|
-
* dependency-free `context-var` module and the env-agnostic state-cookie-name
|
|
5
|
-
* composition (no window/document), so it is safe to import under the
|
|
6
|
-
* `react-server` condition (unlike internal/context.ts, which pulls
|
|
7
|
-
* client/browser modules).
|
|
8
|
-
*/
|
|
9
|
-
import { type ContextVar } from "../../context-var.js";
|
|
10
|
-
export interface StateCookieSeed {
|
|
11
|
-
/**
|
|
12
|
-
* Cookie-name prefix, sanitized then composed with `routerId` exactly like
|
|
13
|
-
* `createRouter({ stateCookiePrefix })`. Defaults to `"rango-state"`.
|
|
14
|
-
*/
|
|
15
|
-
prefix?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Router id; the resolved name is `{sanitizedPrefix}_{sanitizedRouterId}`.
|
|
18
|
-
* Defaults to `"router_0"` (the name a single default router resolves to), so
|
|
19
|
-
* the default name is `rango-state_router_0`.
|
|
20
|
-
*/
|
|
21
|
-
routerId?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Build version used as the rotated value's prefix (`{version}:{timestamp}`).
|
|
24
|
-
* Defaults to `"0"` (resolved inside createRequestContext).
|
|
25
|
-
*/
|
|
26
|
-
version?: string;
|
|
27
|
-
}
|
|
28
|
-
export declare function resolveSeededStateCookieName(seed?: StateCookieSeed): string;
|
|
29
|
-
export type VarsInit = Record<string, unknown> | ReadonlyArray<readonly [ContextVar<unknown> | string, unknown]>;
|
|
30
|
-
export declare function seedVariables(variables: Record<string, unknown>, vars?: VarsInit): Record<string, unknown>;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* renderHandler — run a REAL route handler and assert what it renders.
|
|
3
|
-
*
|
|
4
|
-
* A Rango route handler is a pure function `(ctx) => RSC` (what you pass to
|
|
5
|
-
* `path("/p/:slug", ProductPage)`), NOT a component. To test one faithfully you
|
|
6
|
-
* must give it the HandlerContext the router builds at runtime, so `ctx.params`,
|
|
7
|
-
* `ctx.use(Loader)`, `ctx.use(Meta)` / `ctx.use(Breadcrumbs)` (handles),
|
|
8
|
-
* `ctx.reverse`, `ctx.get`/`ctx.header`/`cookies()` all work. renderHandler does
|
|
9
|
-
* exactly that, then serializes the handler's returned RSC and deserializes it
|
|
10
|
-
* to an inspectable tree (same serialize/deserialize core as renderServerTree).
|
|
11
|
-
*
|
|
12
|
-
* Loaders are SEEDED (no real loader execution) the same way `runLoader` seeds
|
|
13
|
-
* them — pass `loaders: [[ProductLoader, data]]`. Handle pushes
|
|
14
|
-
* (`ctx.use(Meta)({...})`) are captured on `result.handles`. The handler's
|
|
15
|
-
* cookie/header/flash effects and a thrown/returned redirect are surfaced too
|
|
16
|
-
* (like `runInRequestContext`). If the handler returns/throws a `Response`
|
|
17
|
-
* (a response route / `throw redirect()`), there is no RSC `tree`.
|
|
18
|
-
*
|
|
19
|
-
* Must run under the `react-server` export condition (the rsc Vitest project).
|
|
20
|
-
* Wire `rangoUseClientTransform()` so `"use client"` islands in the handler's RSC
|
|
21
|
-
* auto-register (or pass `clientComponents`).
|
|
22
|
-
*/
|
|
23
|
-
import type { ReactNode } from "react";
|
|
24
|
-
import { type Handle } from "../handle.js";
|
|
25
|
-
import type { HandlerContext } from "../types/handler-context.js";
|
|
26
|
-
import type { LoaderDefinition } from "../types.js";
|
|
27
|
-
import { type VarsInit, type StateCookieSeed } from "./internal/seed-vars.js";
|
|
28
|
-
export type { StateCookieSeed } from "./internal/seed-vars.js";
|
|
29
|
-
import type { SegmentCacheStore } from "../cache/types.js";
|
|
30
|
-
import type { CacheProfile } from "../cache/profile-registry.js";
|
|
31
|
-
import type { ThemeConfig } from "../theme/types.js";
|
|
32
|
-
/** A route handler under test: the `(ctx) => RSC | Response` function you pass to `path(...)`. */
|
|
33
|
-
export type TestableHandler<TEnv = any> = (ctx: HandlerContext<any, TEnv>) => ReactNode | Response | Promise<ReactNode | Response>;
|
|
34
|
-
/** Options for {@link renderHandler}. */
|
|
35
|
-
export interface RenderHandlerOptions<TEnv = any> {
|
|
36
|
-
/** Route params surfaced as `ctx.params`. */
|
|
37
|
-
params?: Record<string, string>;
|
|
38
|
-
/** Environment bindings surfaced as `ctx.env`. */
|
|
39
|
-
env?: TEnv;
|
|
40
|
-
/** Backing Request (string or Request); defaults to a localhost GET. */
|
|
41
|
-
request?: Request | string;
|
|
42
|
-
/** Request headers (e.g. Cookie) the handler reads via `cookies()`. */
|
|
43
|
-
headers?: HeadersInit;
|
|
44
|
-
/** Variables a prior middleware set, read via `ctx.get(...)`. Object or tuples. */
|
|
45
|
-
vars?: VarsInit;
|
|
46
|
-
/** Matched route name (drives `ctx.routeName` and scoped reverse). */
|
|
47
|
-
routeName?: string;
|
|
48
|
-
/** Route name -> pattern map enabling `ctx.reverse()`. */
|
|
49
|
-
routeMap?: Record<string, string>;
|
|
50
|
-
/**
|
|
51
|
-
* Seed `ctx.build` (default false) so a handler that branches on the
|
|
52
|
-
* build-time pass — including calling `ctx.dynamic()` on a MISS — is
|
|
53
|
-
* unit-testable. Assert a `ctx.dynamic()` call via `result.dynamic`.
|
|
54
|
-
*/
|
|
55
|
-
build?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Seed the data `ctx.use(SomeLoader)` returns — NO real loader runs (same model
|
|
58
|
-
* as `runLoader`'s `loaders`). Matched by loader reference, so a real
|
|
59
|
-
* `createLoader()` handle resolves regardless of its build-injected `$$id`.
|
|
60
|
-
*/
|
|
61
|
-
loaders?: ReadonlyArray<readonly [LoaderDefinition<any, any>, unknown]>;
|
|
62
|
-
/**
|
|
63
|
-
* `"use client"` components in the handler's RSC, so they serialize as real
|
|
64
|
-
* boundaries when `rangoUseClientTransform()` is not wired. Keyed by name; see
|
|
65
|
-
* renderServerTree's `clientComponents`.
|
|
66
|
-
*/
|
|
67
|
-
clientComponents?: Record<string, unknown>;
|
|
68
|
-
/**
|
|
69
|
-
* Customize the rango state cookie a handler that calls
|
|
70
|
-
* `invalidateClientCache()` rotates. The name is ALWAYS seeded (default
|
|
71
|
-
* `rango-state_router_0`) so the rotation `Set-Cookie` is emitted like
|
|
72
|
-
* production rather than no-opping; override `prefix`/`routerId` to match your
|
|
73
|
-
* `createRouter({ stateCookiePrefix, id })`, or `version` (the build
|
|
74
|
-
* identifier prefixed to the rotated `{version}:{timestamp}` value, default
|
|
75
|
-
* `"0"`). Assert via `result.response.headers.getSetCookie()` against
|
|
76
|
-
* `result.stateCookieName`.
|
|
77
|
-
*/
|
|
78
|
-
stateCookie?: StateCookieSeed;
|
|
79
|
-
/**
|
|
80
|
-
* Segment cache store backing a `"use cache"` function the handler invokes
|
|
81
|
-
* (e.g. `new MemorySegmentCacheStore()`). Without it, `registerCachedFunction`
|
|
82
|
-
* takes the uncached bypass and the cached path is NOT exercised (the runtime
|
|
83
|
-
* emits a one-time warning under the test runner). Pair with `cacheProfiles`
|
|
84
|
-
* so the profile the directive names resolves.
|
|
85
|
-
*/
|
|
86
|
-
cacheStore?: SegmentCacheStore;
|
|
87
|
-
/**
|
|
88
|
-
* Cache profiles in the `createRouter({ cacheProfiles })` shape, required for
|
|
89
|
-
* `"use cache: profileName"` resolution once a `cacheStore` is wired.
|
|
90
|
-
*/
|
|
91
|
-
cacheProfiles?: Record<string, CacheProfile>;
|
|
92
|
-
/**
|
|
93
|
-
* Render as if inside a server action's revalidation render (production sets
|
|
94
|
-
* this in revalidateAfterAction). A stale `"use cache"` entry whose profile
|
|
95
|
-
* opts into `foregroundOnAction` then re-executes in the FOREGROUND (fresh
|
|
96
|
-
* result in this render) instead of being served stale + revalidated in the
|
|
97
|
-
* background. Without it, a stale entry keeps SWR. Pair with `cacheStore` +
|
|
98
|
-
* `cacheProfiles` to exercise the `foregroundOnAction` opt-in.
|
|
99
|
-
*/
|
|
100
|
-
inActionRevalidation?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Theme config in the same shape `createRouter({ theme })` takes (e.g. `true`
|
|
103
|
-
* or `{ themes: [...] }`). Without it `ctx.theme`/`ctx.setTheme` are inert,
|
|
104
|
-
* mirroring an app with no theme configured. Pass one to exercise a handler
|
|
105
|
-
* that reads `ctx.theme` or writes the theme cookie via `ctx.setTheme(...)`.
|
|
106
|
-
*/
|
|
107
|
-
theme?: ThemeConfig | true;
|
|
108
|
-
}
|
|
109
|
-
/** Result of {@link renderHandler}. */
|
|
110
|
-
export interface RenderHandlerResult {
|
|
111
|
-
/**
|
|
112
|
-
* The deserialized RSC the handler returned, as an inspectable React element
|
|
113
|
-
* tree — `undefined` when the handler returned or threw a `Response`. Use
|
|
114
|
-
* `findClientBoundaries` (from testing/flight) to locate client islands.
|
|
115
|
-
*/
|
|
116
|
-
tree: unknown;
|
|
117
|
-
/** The raw Flight wire string; `undefined` when the handler produced a `Response`. */
|
|
118
|
-
flight: string | undefined;
|
|
119
|
-
/** The value the handler THREW (a `redirect()`/`notFound()` Response), captured not re-thrown. */
|
|
120
|
-
thrown: unknown;
|
|
121
|
-
/** The merged Response (status + headers + Set-Cookie); a thrown/returned redirect merged with accumulated effects. */
|
|
122
|
-
response: Response;
|
|
123
|
-
/** Effective cookie view after the handler ran, as `{ name: value }`. */
|
|
124
|
-
cookies: Record<string, string>;
|
|
125
|
-
/** Response headers as `{ name: value }` (excludes set-cookie; includes a redirect Location). */
|
|
126
|
-
headers: Record<string, string>;
|
|
127
|
-
/**
|
|
128
|
-
* The resolved rango state cookie name this run seeded (default
|
|
129
|
-
* `rango-state_router_0`, or composed from `opts.stateCookie`). Assert the
|
|
130
|
-
* `invalidateClientCache()` rotation against it without recomputing:
|
|
131
|
-
* `response.headers.getSetCookie().some((c) => c.startsWith(stateCookieName + "="))`.
|
|
132
|
-
*/
|
|
133
|
-
stateCookieName: string;
|
|
134
|
-
/** Location state the handler set (`ctx.setLocationState`/`redirect({ state })`), as `{ key: value }`. */
|
|
135
|
-
locationState: Record<string, unknown>;
|
|
136
|
-
/** What the handler pushed via `ctx.use(Handle)(...)` (e.g. Meta, Breadcrumbs), keyed by handle. */
|
|
137
|
-
handles: Map<Handle<any, any>, unknown[]>;
|
|
138
|
-
/**
|
|
139
|
-
* Whether the handler called `ctx.dynamic()` (the PPR shell opt-out). The
|
|
140
|
-
* public way to assert the opt-out without reading the `@internal`
|
|
141
|
-
* `ctx._dynamic`.
|
|
142
|
-
*/
|
|
143
|
-
dynamic: boolean;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Run a route handler with a seeded HandlerContext and return its rendered RSC
|
|
147
|
-
* (deserialized tree) plus the effects it produced. See the module header.
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* // ProductPage is the real handler: (ctx) => <main>{ctx.params.slug}...</main>
|
|
152
|
-
* const { tree, handles } = await renderHandler(ProductPage, {
|
|
153
|
-
* params: { slug: "wine" },
|
|
154
|
-
* loaders: [[ProductLoader, { name: "Wine", price: 9 }]],
|
|
155
|
-
* vars: [[Tenant, tenant]],
|
|
156
|
-
* routeMap: { product: "/p/:slug" },
|
|
157
|
-
* });
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
export declare function renderHandler<TEnv = any>(handler: TestableHandler<TEnv>, opts?: RenderHandlerOptions<TEnv>): Promise<RenderHandlerResult>;
|