@rangojs/router 0.5.1 → 0.5.2
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 +5 -1
- package/dist/types/browser/event-controller.d.ts +6 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +8 -1
- package/dist/types/cache/cf/cf-cache-store.d.ts +15 -1
- package/dist/types/cache/cf/cf-cache-types.d.ts +1 -1
- package/dist/types/cache/cf/cf-kv-utils.d.ts +21 -0
- package/dist/types/handles/is-thenable.d.ts +2 -4
- package/dist/types/rsc/helpers.d.ts +3 -0
- package/dist/types/rsc/render-pipeline.d.ts +9 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +17 -0
- package/dist/types/server/request-context.d.ts +4 -1
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +10 -0
- package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
- package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
- package/dist/types/vite/utils/shared-utils.d.ts +12 -0
- package/dist/vite/index.js +154 -57
- package/package.json +3 -3
- package/skills/caching/SKILL.md +1 -1
- package/skills/mime-routes/SKILL.md +3 -1
- package/skills/response-routes/SKILL.md +4 -2
- package/skills/typesafety/generated-files-and-cli.md +16 -9
- package/skills/typesafety/route-types.md +5 -1
- package/skills/use-cache/SKILL.md +47 -0
- package/src/browser/event-controller.ts +40 -15
- package/src/browser/partial-update.ts +26 -11
- package/src/browser/react/NavigationProvider.tsx +7 -0
- package/src/cache/cache-runtime.ts +89 -15
- package/src/cache/cf/cf-cache-constants.ts +8 -1
- package/src/cache/cf/cf-cache-store.ts +41 -64
- package/src/cache/cf/cf-cache-types.ts +1 -1
- package/src/cache/cf/cf-kv-utils.ts +38 -0
- package/src/cache/segment-codec.ts +21 -5
- package/src/handles/is-thenable.ts +2 -4
- package/src/router/match-middleware/cache-lookup.ts +24 -15
- package/src/rsc/handler.ts +26 -5
- package/src/rsc/helpers.ts +13 -0
- package/src/rsc/progressive-enhancement.ts +247 -70
- package/src/rsc/render-pipeline.ts +68 -24
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +555 -302
- package/src/rsc/server-action.ts +180 -71
- package/src/rsc/shell-capture-constants.ts +18 -0
- package/src/rsc/shell-capture.ts +92 -21
- package/src/server/request-context.ts +6 -0
- package/src/ssr/ssr-root.tsx +1 -0
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/plugins/expose-action-id.ts +2 -2
- package/src/vite/plugins/expose-internal-ids.ts +46 -0
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/rango.ts +9 -0
- package/src/vite/router-discovery.ts +21 -2
- package/src/vite/utils/shared-utils.ts +12 -7
- 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,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the current include() mount path.
|
|
3
|
-
*
|
|
4
|
-
* Inside `include("/articles", blogPatterns)`, returns "/articles".
|
|
5
|
-
* For nested includes, returns the nearest mount path.
|
|
6
|
-
* At root level (no include), returns "/".
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* "use client";
|
|
11
|
-
* import { useMount, href } from "@rangojs/router/client";
|
|
12
|
-
*
|
|
13
|
-
* function BlogNav({ slug }: { slug: string }) {
|
|
14
|
-
* const mount = useMount(); // "/articles"
|
|
15
|
-
* return (
|
|
16
|
-
* <>
|
|
17
|
-
* <Link to={href("/", mount)}>Blog Home</Link>
|
|
18
|
-
* <Link to={href(`/${slug}`, mount)}>Post</Link>
|
|
19
|
-
* </>
|
|
20
|
-
* );
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function useMount(): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PublicNavigationState } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access reactive navigation state with optional selector for performance.
|
|
4
|
-
*
|
|
5
|
-
* Returns state only. For actions (push, replace, refresh, prefetch),
|
|
6
|
-
* use useRouter() instead.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* const { state, location } = useNavigation();
|
|
11
|
-
* const isLoading = useNavigation(nav => nav.state === 'loading');
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare function useNavigation(): PublicNavigationState;
|
|
15
|
-
export declare function useNavigation<T>(selector: (state: PublicNavigationState) => T): T;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to access the current route params.
|
|
3
|
-
*
|
|
4
|
-
* Returns the merged route params from the matched route.
|
|
5
|
-
* Updates when navigation completes, not during pending navigation.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* // Route: /products/:productId
|
|
10
|
-
* const params = useParams();
|
|
11
|
-
* // { productId: "123" }
|
|
12
|
-
*
|
|
13
|
-
* // Annotate the expected shape via a generic
|
|
14
|
-
* const { productId } = useParams<{ productId: string }>();
|
|
15
|
-
*
|
|
16
|
-
* // With selector
|
|
17
|
-
* const productId = useParams(p => p.productId);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function useParams<T extends object = Record<string, string | undefined>>(): Readonly<T>;
|
|
21
|
-
export declare function useParams<T>(selector: (params: Record<string, string | undefined>) => T): T;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to access the current pathname.
|
|
3
|
-
*
|
|
4
|
-
* Returns the committed pathname string (excludes search params and hash).
|
|
5
|
-
* Updates when navigation completes, not during pending navigation.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* const pathname = usePathname();
|
|
10
|
-
* // "/products/123"
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function usePathname(): string;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { LocalReverseFunction } from "../../reverse.js";
|
|
2
|
-
type RouteEntry = string | {
|
|
3
|
-
readonly path: string;
|
|
4
|
-
};
|
|
5
|
-
type LocalRouteMap = Readonly<Record<string, RouteEntry>>;
|
|
6
|
-
/**
|
|
7
|
-
* Mount-aware reverse function for a locally-imported `routes` map.
|
|
8
|
-
*
|
|
9
|
-
* The `routes` map you pass IS the scope: `reverse("name")` looks the name up
|
|
10
|
-
* in that map (verbatim), prefixes the result with the surrounding `include()`
|
|
11
|
-
* mount path via `useMount()`, and substitutes params — auto-filling from the
|
|
12
|
-
* current matched route's params, with explicit params overriding. A module's
|
|
13
|
-
* components can therefore reverse their own routes without knowing where the
|
|
14
|
-
* module is mounted: include it under any prefix and the URLs resolve correctly.
|
|
15
|
-
*
|
|
16
|
-
* The leading dot is optional and cosmetic: `reverse("post")` and
|
|
17
|
-
* `reverse(".post")` resolve identically. The dot exists only as a readability
|
|
18
|
-
* convention and for parity with `ctx.reverse(".name")` on the server; here the
|
|
19
|
-
* passed map is the scope, so there is no separate global namespace to
|
|
20
|
-
* disambiguate and the dot carries no meaning.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* "use client";
|
|
25
|
-
* import { Link, useReverse } from "@rangojs/router/client";
|
|
26
|
-
* import { routes as blogRoutes } from "../urls/blog.gen.js";
|
|
27
|
-
*
|
|
28
|
-
* function BlogNav() {
|
|
29
|
-
* const reverse = useReverse(blogRoutes);
|
|
30
|
-
* return (
|
|
31
|
-
* <>
|
|
32
|
-
* <Link to={reverse("index")}>Blog</Link>
|
|
33
|
-
* <Link to={reverse("post", { postId: "hello" })}>Post</Link>
|
|
34
|
-
* </>
|
|
35
|
-
* );
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function useReverse<const TRoutes extends LocalRouteMap>(routes: TRoutes): LocalReverseFunction<TRoutes>;
|
|
40
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { RouterInstance } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access router actions (push, replace, refresh, prefetch, back, forward).
|
|
4
|
-
*
|
|
5
|
-
* Returns a STABLE reference that never changes, so components using
|
|
6
|
-
* useRouter() do not re-render on navigation state changes.
|
|
7
|
-
* For reactive navigation state, use useNavigation() instead.
|
|
8
|
-
*
|
|
9
|
-
* Methods read `basename` from the context on each call. It is set once from
|
|
10
|
-
* the initial payload and is stable within a session — a cross-app navigation
|
|
11
|
-
* is a full document load (X-RSC-Reload), so the target app mounts fresh with
|
|
12
|
-
* its own basename.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const router = useRouter();
|
|
17
|
-
* router.push("/products");
|
|
18
|
-
* router.replace("/login", { scroll: false });
|
|
19
|
-
* router.prefetch("/dashboard");
|
|
20
|
-
* router.back();
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function useRouter(): RouterInstance;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyURLSearchParams } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access the current URL search params.
|
|
4
|
-
*
|
|
5
|
-
* Returns a read-only URLSearchParams object from the committed location.
|
|
6
|
-
* Updates when navigation completes, not during pending navigation.
|
|
7
|
-
*
|
|
8
|
-
* Note: During SSR the search params are not available (the server only sends
|
|
9
|
-
* the pathname). The hook returns empty params during SSR and syncs from
|
|
10
|
-
* the browser URL on mount.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* const searchParams = useSearchParams();
|
|
15
|
-
* const query = searchParams.get("q"); // "react"
|
|
16
|
-
* const page = searchParams.get("page"); // "2"
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function useSearchParams(): ReadonlyURLSearchParams;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Segments state returned by useSegments hook
|
|
3
|
-
*/
|
|
4
|
-
export interface SegmentsState {
|
|
5
|
-
/** URL path segments (e.g., /shop/products/123 → ["shop", "products", "123"]) */
|
|
6
|
-
path: readonly string[];
|
|
7
|
-
/** Matched segment IDs in order (layouts and routes only, e.g., ["L0", "L0L1", "L0L1R0"]) */
|
|
8
|
-
segmentIds: readonly string[];
|
|
9
|
-
/** Current URL location */
|
|
10
|
-
location: URL;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Hook to access current route segments with optional selector for performance
|
|
14
|
-
*
|
|
15
|
-
* Provides information about the current URL path and matched route segments.
|
|
16
|
-
* Uses the event controller for reactive state management.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* // Get full segments state
|
|
21
|
-
* const { path, segmentIds, location } = useSegments();
|
|
22
|
-
*
|
|
23
|
-
* // Use selector for specific values (better performance)
|
|
24
|
-
* const path = useSegments(s => s.path);
|
|
25
|
-
* const isShopRoute = useSegments(s => s.path[0] === "shop");
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function useSegments(): SegmentsState;
|
|
29
|
-
export declare function useSegments<T>(selector: (state: SegmentsState) => T): T;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
type HeaderResult = {
|
|
2
|
-
url: string;
|
|
3
|
-
} | "blocked" | null;
|
|
4
|
-
/**
|
|
5
|
-
* Extract and validate an RSC response header URL (X-RSC-Reload, X-RSC-Redirect).
|
|
6
|
-
* Returns { url } if valid, "blocked" if present but invalid origin, null if absent.
|
|
7
|
-
*/
|
|
8
|
-
export declare function extractRscHeaderUrl(response: Response, header: string): HeaderResult;
|
|
9
|
-
/**
|
|
10
|
-
* Empty 200 response that won't choke Flight parsing.
|
|
11
|
-
* Used when a header URL is blocked by origin validation.
|
|
12
|
-
*/
|
|
13
|
-
export declare function emptyResponse(): Response;
|
|
14
|
-
/**
|
|
15
|
-
* Whether an RSC content response carries a server-stamped router identity
|
|
16
|
-
* (`X-RSC-Router-Id`) that DIFFERS from the id this client expects (its own
|
|
17
|
-
* routerId, also sent as `_rsc_rid`). Pre-decode integrity check: lets a caller
|
|
18
|
-
* refuse a foreign app's payload before `createFromFetch` imports its chunks.
|
|
19
|
-
*
|
|
20
|
-
* True ONLY when both the header and the expected id are present and differ. An
|
|
21
|
-
* absent header (control-only reload/redirect responses are not stamped) or an
|
|
22
|
-
* absent expected id (e.g. before the client is seeded) is a pass-through —
|
|
23
|
-
* never a false reject.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isForeignRouterId(response: Response, expectedId: string | undefined): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Handle the X-RSC-Reload control header (server requests a full page reload on
|
|
28
|
-
* a version mismatch). Returns a short-circuit response when the header is
|
|
29
|
-
* present -- emptyResponse() if the URL was blocked by origin validation, or a
|
|
30
|
-
* never-resolving promise while the page reloads -- and null when absent, so
|
|
31
|
-
* the caller continues processing (e.g. the X-RSC-Redirect check). Scoped to
|
|
32
|
-
* X-RSC-Reload only; redirect handling differs between callers.
|
|
33
|
-
*/
|
|
34
|
-
export declare function handleReloadHeader(response: Response, opts: {
|
|
35
|
-
onBlocked: () => void;
|
|
36
|
-
onReload: (url: string) => void;
|
|
37
|
-
}): Response | Promise<Response> | null;
|
|
38
|
-
/**
|
|
39
|
-
* Tee a response body for RSC parsing and stream completion tracking.
|
|
40
|
-
* Returns a new Response with one branch; the other is consumed to detect
|
|
41
|
-
* end-of-stream, calling onComplete when done.
|
|
42
|
-
*
|
|
43
|
-
* `onComplete` receives `endedCleanly`: true only on a normal EOF drain, false
|
|
44
|
-
* on a read error or an abort (the signal cancelled the reader). Callers that
|
|
45
|
-
* gate a "fully complete" fast path (e.g. prefetch's `entry.complete`) must
|
|
46
|
-
* treat a non-clean end as incomplete — a broken stream is not complete data.
|
|
47
|
-
*
|
|
48
|
-
* If the response has no body, onComplete fires synchronously with `true`
|
|
49
|
-
* (an empty body is a clean, complete stream).
|
|
50
|
-
* If signal is provided, an abort cancels the tracking reader.
|
|
51
|
-
*
|
|
52
|
-
* `silent` suppresses the stream-error log. Prefetch passes it: a speculative,
|
|
53
|
-
* low-priority prefetch that is aborted or never consumed can error its stream
|
|
54
|
-
* benignly, which is not worth surfacing. The fresh-navigation path keeps the
|
|
55
|
-
* log (default), where a stream error reflects a real failed navigation.
|
|
56
|
-
*/
|
|
57
|
-
export declare function teeWithCompletion(response: Response, onComplete: (endedCleanly: boolean) => void, signal?: AbortSignal, silent?: boolean): Response;
|
|
58
|
-
export {};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { RscPayload, RscBrowserDependencies, NavigationStore, NavigationBridge } from "./types.js";
|
|
3
|
-
import type { EventController } from "./event-controller.js";
|
|
4
|
-
import type { ResolvedThemeConfig, Theme } from "../theme/types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Options for initializing the browser app
|
|
7
|
-
*/
|
|
8
|
-
export interface InitBrowserAppOptions {
|
|
9
|
-
/**
|
|
10
|
-
* RSC stream containing the initial payload (from rsc-html-stream/client)
|
|
11
|
-
*/
|
|
12
|
-
rscStream: ReadableStream<Uint8Array>;
|
|
13
|
-
/**
|
|
14
|
-
* RSC browser dependencies from @vitejs/plugin-rsc/browser
|
|
15
|
-
*/
|
|
16
|
-
deps: RscBrowserDependencies;
|
|
17
|
-
/**
|
|
18
|
-
* Optional store configuration
|
|
19
|
-
*/
|
|
20
|
-
storeOptions?: {
|
|
21
|
-
/**
|
|
22
|
-
* Maximum number of history entries to cache
|
|
23
|
-
* @default 10
|
|
24
|
-
*/
|
|
25
|
-
cacheSize?: number;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Enable global link interception for SPA navigation.
|
|
29
|
-
* When enabled, clicks on same-origin anchor elements are intercepted
|
|
30
|
-
* and handled via client-side navigation instead of full page loads.
|
|
31
|
-
*
|
|
32
|
-
* Links rendered with the Link component handle their own navigation
|
|
33
|
-
* regardless of this setting.
|
|
34
|
-
*
|
|
35
|
-
* Set to false to disable global interception and rely solely on
|
|
36
|
-
* Link components for SPA navigation.
|
|
37
|
-
*
|
|
38
|
-
* @default true
|
|
39
|
-
*/
|
|
40
|
-
linkInterception?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Theme configuration from router.
|
|
43
|
-
* When provided, enables theme support via useTheme hook.
|
|
44
|
-
* Pass router.themeConfig here to enable theme features.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```tsx
|
|
48
|
-
* import { router } from "./router.js";
|
|
49
|
-
*
|
|
50
|
-
* await initBrowserApp({
|
|
51
|
-
* rscStream,
|
|
52
|
-
* deps: rscBrowser,
|
|
53
|
-
* themeConfig: router.themeConfig,
|
|
54
|
-
* initialTheme: document.documentElement.className.includes("dark") ? "dark" : "light",
|
|
55
|
-
* });
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
themeConfig?: ResolvedThemeConfig | null;
|
|
59
|
-
/**
|
|
60
|
-
* Initial theme from server (typically read from cookie).
|
|
61
|
-
* Only used when themeConfig is provided.
|
|
62
|
-
*/
|
|
63
|
-
initialTheme?: Theme;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Result from initializing the browser app
|
|
67
|
-
*/
|
|
68
|
-
export interface BrowserAppContext {
|
|
69
|
-
store: NavigationStore;
|
|
70
|
-
eventController: EventController;
|
|
71
|
-
bridge: NavigationBridge;
|
|
72
|
-
initialPayload: RscPayload;
|
|
73
|
-
initialTree: React.ReactNode | Promise<React.ReactNode>;
|
|
74
|
-
/** Theme configuration (null if theme not enabled) */
|
|
75
|
-
themeConfig?: ResolvedThemeConfig | null;
|
|
76
|
-
/** Initial theme from server */
|
|
77
|
-
initialTheme?: Theme;
|
|
78
|
-
/** Whether connection warmup is enabled */
|
|
79
|
-
warmupEnabled?: boolean;
|
|
80
|
-
/** Whether the hydrated tree should be wrapped in React.StrictMode */
|
|
81
|
-
strictMode?: boolean;
|
|
82
|
-
/** App version for prefetch version mismatch detection */
|
|
83
|
-
version?: string;
|
|
84
|
-
/**
|
|
85
|
-
* App-shell ref, read through on each render so renderSegments and the
|
|
86
|
-
* NavigationProvider see rootLayout/basename/version without closing over a
|
|
87
|
-
* stale snapshot. Set once from the initial payload and not swapped within a
|
|
88
|
-
* session: a cross-app navigation is a full document load (X-RSC-Reload), so
|
|
89
|
-
* the target app establishes its own shell on load. Theme, warmup, and
|
|
90
|
-
* prefetch TTL are document-lifetime too (see AppShell).
|
|
91
|
-
*/
|
|
92
|
-
appShellRef?: import("./app-shell.js").AppShellRef;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Initialize the browser app. Must be called before rendering Rango.
|
|
96
|
-
*
|
|
97
|
-
* This function:
|
|
98
|
-
* - Loads the initial RSC payload from the stream
|
|
99
|
-
* - Creates the navigation store and event controller
|
|
100
|
-
* - Sets up action and navigation bridges
|
|
101
|
-
* - Configures HMR support
|
|
102
|
-
*/
|
|
103
|
-
export declare function initBrowserApp(options: InitBrowserAppOptions): Promise<BrowserAppContext>;
|
|
104
|
-
/**
|
|
105
|
-
* Get the browser app context. Throws if initBrowserApp hasn't been called.
|
|
106
|
-
*/
|
|
107
|
-
export declare function getBrowserAppContext(): BrowserAppContext;
|
|
108
|
-
/**
|
|
109
|
-
* Reset the browser app context (for testing)
|
|
110
|
-
*/
|
|
111
|
-
export declare function resetBrowserAppContext(): void;
|
|
112
|
-
/**
|
|
113
|
-
* Props for the Rango component
|
|
114
|
-
*/
|
|
115
|
-
export interface RangoProps {
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Rango component - renders the RSC router with all internal wiring.
|
|
119
|
-
*
|
|
120
|
-
* Must be called after initBrowserApp() has completed.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```tsx
|
|
124
|
-
* import { initBrowserApp, Rango } from "rsc-router/browser";
|
|
125
|
-
* import { rscStream } from "rsc-html-stream/client";
|
|
126
|
-
* import * as rscBrowser from "@vitejs/plugin-rsc/browser";
|
|
127
|
-
*
|
|
128
|
-
* async function main() {
|
|
129
|
-
* await initBrowserApp({ rscStream, deps: rscBrowser });
|
|
130
|
-
*
|
|
131
|
-
* hydrateRoot(
|
|
132
|
-
* document,
|
|
133
|
-
* <React.StrictMode>
|
|
134
|
-
* <Rango />
|
|
135
|
-
* </React.StrictMode>
|
|
136
|
-
* );
|
|
137
|
-
* }
|
|
138
|
-
* main();
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
export declare function Rango(_props: RangoProps): React.ReactElement;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scroll Restoration Module
|
|
3
|
-
*
|
|
4
|
-
* Provides scroll position persistence across navigations, following React Router v7 patterns:
|
|
5
|
-
* - Saves scroll positions to sessionStorage keyed by unique history entry key
|
|
6
|
-
* - Restores scroll on back/forward navigation
|
|
7
|
-
* - Scrolls to top on new navigation (unless scroll: false)
|
|
8
|
-
* - Supports hash link scrolling
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Custom getKey function for determining scroll restoration key
|
|
12
|
-
*/
|
|
13
|
-
type GetScrollKeyFunction = (location: {
|
|
14
|
-
pathname: string;
|
|
15
|
-
search: string;
|
|
16
|
-
hash: string;
|
|
17
|
-
key: string;
|
|
18
|
-
}) => string;
|
|
19
|
-
/**
|
|
20
|
-
* Generate a unique key for the current history entry.
|
|
21
|
-
* Uses history.state.key if available, otherwise generates and stores a new one.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getHistoryStateKey(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Get the scroll restoration key for a location.
|
|
26
|
-
* Uses custom getKey function if set, otherwise uses history state key.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getScrollKey(): string;
|
|
29
|
-
/**
|
|
30
|
-
* Initialize scroll restoration.
|
|
31
|
-
* Sets manual scroll restoration mode and loads saved positions from sessionStorage.
|
|
32
|
-
*/
|
|
33
|
-
export declare function initScrollRestoration(options?: {
|
|
34
|
-
getKey?: GetScrollKeyFunction;
|
|
35
|
-
}): () => void;
|
|
36
|
-
/**
|
|
37
|
-
* Save the current scroll position for the current history entry.
|
|
38
|
-
* Maintains bounded size by evicting oldest entries when the limit is exceeded.
|
|
39
|
-
*/
|
|
40
|
-
export declare function saveCurrentScrollPosition(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Persist scroll positions to sessionStorage.
|
|
43
|
-
* If the write fails (typically QuotaExceededError), evict the oldest ~1/4 of
|
|
44
|
-
* entries ONCE and retry the write a single time; if that still fails, remove
|
|
45
|
-
* our storage key entirely so we don't block other sessionStorage consumers.
|
|
46
|
-
* This is a single evict-then-retry-then-clear ladder, not a loop.
|
|
47
|
-
*
|
|
48
|
-
* Exported so that single eviction/retry/clear ladder is unit-testable directly.
|
|
49
|
-
* The browser drives it from the `pagehide` handler.
|
|
50
|
-
*/
|
|
51
|
-
export declare function persistToSessionStorage(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Get the saved scroll position for a history key
|
|
54
|
-
*/
|
|
55
|
-
export declare function getSavedScrollPosition(key?: string): number | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Cancel any pending scroll restoration polling
|
|
58
|
-
*/
|
|
59
|
-
export declare function cancelScrollRestorationPolling(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Restore scroll position for the current history entry.
|
|
62
|
-
* Returns true if position was fully restored, false otherwise.
|
|
63
|
-
*
|
|
64
|
-
* @param options.retryIfStreaming - If true, poll while streaming until we can scroll to target
|
|
65
|
-
* @param options.isStreaming - Function to check if streaming is in progress
|
|
66
|
-
*/
|
|
67
|
-
export declare function restoreScrollPosition(options?: {
|
|
68
|
-
retryIfStreaming?: boolean;
|
|
69
|
-
isStreaming?: () => boolean;
|
|
70
|
-
}): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Handle hash link scrolling.
|
|
73
|
-
* Scrolls to element with matching ID if hash is present.
|
|
74
|
-
* Returns true if scrolled to element, false otherwise.
|
|
75
|
-
*/
|
|
76
|
-
export declare function scrollToHash(): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Scroll to top of page
|
|
79
|
-
*/
|
|
80
|
-
export declare function scrollToTop(): void;
|
|
81
|
-
/**
|
|
82
|
-
* Handle scroll for a new navigation.
|
|
83
|
-
* - Saves current position before navigating
|
|
84
|
-
* - Ensures new history entry has a key
|
|
85
|
-
*/
|
|
86
|
-
export declare function handleNavigationStart(): void;
|
|
87
|
-
/**
|
|
88
|
-
* Handle scroll after navigation completes.
|
|
89
|
-
* @param options.restore - If true, restore saved position (for popstate)
|
|
90
|
-
* @param options.scroll - If false, don't scroll at all
|
|
91
|
-
* @param options.isStreaming - Function to check if streaming is in progress (for retry logic)
|
|
92
|
-
*/
|
|
93
|
-
export declare function handleNavigationEnd(options: {
|
|
94
|
-
restore?: boolean;
|
|
95
|
-
scroll?: boolean;
|
|
96
|
-
isStreaming?: () => boolean;
|
|
97
|
-
}): void;
|
|
98
|
-
/**
|
|
99
|
-
* Update the history state key after pushState/replaceState.
|
|
100
|
-
* Call this after changing history to ensure new entry has a key.
|
|
101
|
-
*/
|
|
102
|
-
export declare function ensureHistoryKey(): void;
|
|
103
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { ResolvedSegment } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Determines the merging behavior for segment reconciliation.
|
|
4
|
-
*
|
|
5
|
-
* - 'action': From server-action-bridge's own merge. Always merges loaders,
|
|
6
|
-
* always preserves cached loading (even undefined), never clears cached
|
|
7
|
-
* segment loading.
|
|
8
|
-
* - 'navigation': From partial-update during normal navigation. Does NOT merge
|
|
9
|
-
* loaders, preserves cached loading only when defined, clears truthy loading
|
|
10
|
-
* on cached segments not in server diff.
|
|
11
|
-
* - 'stale-revalidation': From partial-update during stale revalidation or
|
|
12
|
-
* action-triggered refetch. Merges loaders, always preserves cached loading
|
|
13
|
-
* (same as action), clears truthy loading on cached segments not in server diff.
|
|
14
|
-
*/
|
|
15
|
-
export type ReconcileActor = "navigation" | "action" | "stale-revalidation";
|
|
16
|
-
export interface ReconcileInput {
|
|
17
|
-
actor: ReconcileActor;
|
|
18
|
-
/** All segment IDs the server expects the client to have (matched array) */
|
|
19
|
-
matched: string[];
|
|
20
|
-
/** Segment IDs that changed (diff array) */
|
|
21
|
-
diff: string[];
|
|
22
|
-
/** Segments returned from server (raw array, keyed internally by ID) */
|
|
23
|
-
serverSegments: ResolvedSegment[];
|
|
24
|
-
/** Cached segments from current page (raw array, keyed internally by ID) */
|
|
25
|
-
cachedSegments: ResolvedSegment[];
|
|
26
|
-
/** When true, diff segments not in matched are inserted after their parent
|
|
27
|
-
* layout. Used during navigation when consolidation fetch returns loader
|
|
28
|
-
* segments that aren't in the matched array. */
|
|
29
|
-
insertMissingDiff?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface ReconcileResult {
|
|
32
|
-
/** All merged segments in matched order (for caching and committing) */
|
|
33
|
-
segments: ResolvedSegment[];
|
|
34
|
-
/** Main segments excluding intercepts (for rendering) */
|
|
35
|
-
mainSegments: ResolvedSegment[];
|
|
36
|
-
/** Intercept segments only (passed via render options) */
|
|
37
|
-
interceptSegments: ResolvedSegment[];
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Single source of truth for merging server segments with cached segments.
|
|
41
|
-
*
|
|
42
|
-
* Replaces the duplicated merge loops in server-action-bridge.ts and
|
|
43
|
-
* partial-update.ts. The actor parameter controls the subtle behavioral
|
|
44
|
-
* differences between action and navigation merging:
|
|
45
|
-
*
|
|
46
|
-
* Loading preservation:
|
|
47
|
-
* - action/stale-revalidation: Always preserves cached loading value when it
|
|
48
|
-
* differs from server (even when cached is undefined). This prevents tree
|
|
49
|
-
* structure changes that would remount components and destroy useActionState
|
|
50
|
-
* during action revalidation or action-triggered refetch.
|
|
51
|
-
* - navigation: Preserves cached loading only when the cached value is defined
|
|
52
|
-
* (not undefined). When cached is undefined, lets server value through
|
|
53
|
-
* because we're building a new tree.
|
|
54
|
-
*
|
|
55
|
-
* Loader merging:
|
|
56
|
-
* - action/stale-revalidation: Merges partial loader data when server returns
|
|
57
|
-
* fewer loaders than cached (revalidation only updated some loaders).
|
|
58
|
-
* - navigation: Does not merge (full navigation fetches complete data).
|
|
59
|
-
*
|
|
60
|
-
* Cached segment handling (segments in matched but not in server response):
|
|
61
|
-
* - action: Returns cached segment as-is (preserve tree structure).
|
|
62
|
-
* - navigation/stale-revalidation: Clears truthy loading to undefined
|
|
63
|
-
* (prevents showing stale skeletons), but preserves loading=false
|
|
64
|
-
* (suppressed boundary is structural).
|
|
65
|
-
*/
|
|
66
|
-
export declare function reconcileSegments(input: ReconcileInput): ReconcileResult;
|
|
67
|
-
/**
|
|
68
|
-
* Reconcile error segments with cached segments.
|
|
69
|
-
*
|
|
70
|
-
* For error responses, the server returns the error boundary segment.
|
|
71
|
-
* This function overlays error segments onto the full cached tree,
|
|
72
|
-
* preserving sibling layouts that aren't in the error parent chain.
|
|
73
|
-
*/
|
|
74
|
-
export declare function reconcileErrorSegments(cachedSegments: ResolvedSegment[], errorSegments: ResolvedSegment[]): ReconcileResult;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ResolvedSegment } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Assert that merging a server segment with a cached segment won't change
|
|
4
|
-
* the React tree structure. Logs a warning in development when a mismatch
|
|
5
|
-
* is detected.
|
|
6
|
-
*
|
|
7
|
-
* This catches the class of bugs where `loading()` with `{ ssr: false }`
|
|
8
|
-
* produces `loading=false` on SSR but `loading=<skeleton>` on actions,
|
|
9
|
-
* causing React to remount LoaderBoundary/RouteContentWrapper and destroy
|
|
10
|
-
* client state (useActionState, refs, etc.).
|
|
11
|
-
*
|
|
12
|
-
* @param cached - The currently cached segment
|
|
13
|
-
* @param incoming - The new segment from server
|
|
14
|
-
* @param context - Where this merge is happening (for the warning message)
|
|
15
|
-
*/
|
|
16
|
-
export declare function assertSegmentStructure(cached: ResolvedSegment, incoming: ResolvedSegment, context: string): void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ServerActionBridge, ServerActionBridgeConfig } from "./types.js";
|
|
2
|
-
import type { EventController } from "./event-controller.js";
|
|
3
|
-
/**
|
|
4
|
-
* Extended configuration for server action bridge with event controller
|
|
5
|
-
*/
|
|
6
|
-
export interface ServerActionBridgeConfigWithController extends ServerActionBridgeConfig {
|
|
7
|
-
eventController: EventController;
|
|
8
|
-
/** Callback to trigger SPA navigation (for action redirects) */
|
|
9
|
-
onNavigate?: (url: string, options?: {
|
|
10
|
-
state?: unknown;
|
|
11
|
-
replace?: boolean;
|
|
12
|
-
_skipCache?: boolean;
|
|
13
|
-
}) => Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Create a server action bridge for handling RSC server actions
|
|
17
|
-
*
|
|
18
|
-
* The bridge registers a callback with the RSC runtime that handles:
|
|
19
|
-
* - Encoding action arguments
|
|
20
|
-
* - Sending action requests to the server
|
|
21
|
-
* - Processing responses and updating UI
|
|
22
|
-
* - Managing concurrent action requests via event controller
|
|
23
|
-
* - HMR resilience (refetching if segments are missing)
|
|
24
|
-
*
|
|
25
|
-
* @param config - Bridge configuration
|
|
26
|
-
* @returns ServerActionBridge instance
|
|
27
|
-
*/
|
|
28
|
-
export declare function createServerActionBridge(config: ServerActionBridgeConfigWithController): ServerActionBridge;
|
|
29
|
-
export { createServerActionBridge as default };
|