@rangojs/router 0.0.0-experimental.35 → 0.0.0-experimental.358c376d
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/AGENTS.md +11 -3
- package/README.md +320 -735
- package/dist/bin/rango.js +983 -241
- package/dist/testing/vitest.js +82 -0
- package/dist/types/__internal.d.ts +127 -0
- package/dist/types/bin/rango.d.ts +1 -0
- package/dist/types/browser/action-coordinator.d.ts +57 -0
- package/dist/types/browser/action-fence.d.ts +33 -0
- package/dist/types/browser/app-shell.d.ts +34 -0
- package/dist/types/browser/app-version.d.ts +6 -0
- package/dist/types/browser/connection-warmup.d.ts +31 -0
- package/dist/types/browser/cookie-name.d.ts +66 -0
- package/dist/types/browser/dev-discovery.d.ts +11 -0
- package/dist/types/browser/event-controller.d.ts +231 -0
- package/dist/types/browser/history-state.d.ts +26 -0
- package/dist/types/browser/index.d.ts +1 -0
- package/dist/types/browser/intercept-utils.d.ts +30 -0
- package/dist/types/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types/browser/link-interceptor.d.ts +53 -0
- package/dist/types/browser/logging.d.ts +33 -0
- package/dist/types/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types/browser/navigation-bridge.d.ts +39 -0
- package/dist/types/browser/navigation-client.d.ts +17 -0
- package/dist/types/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types/browser/navigation-store.d.ts +85 -0
- package/dist/types/browser/navigation-transaction.d.ts +75 -0
- package/dist/types/browser/network-error-handler.d.ts +35 -0
- package/dist/types/browser/notify-listeners.d.ts +2 -0
- package/dist/types/browser/partial-update.d.ts +61 -0
- package/dist/types/browser/prefetch/cache.d.ts +224 -0
- package/dist/types/browser/prefetch/default-strategy.d.ts +31 -0
- package/dist/types/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types/browser/prefetch/invalidation.d.ts +6 -0
- package/dist/types/browser/prefetch/loader.d.ts +12 -0
- package/dist/types/browser/prefetch/observer.d.ts +24 -0
- package/dist/types/browser/prefetch/policy.d.ts +13 -0
- package/dist/types/browser/prefetch/queue.d.ts +48 -0
- package/dist/types/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types/browser/prefetch/runtime.d.ts +2 -0
- package/dist/types/browser/rango-state.d.ts +56 -0
- package/dist/types/browser/react/Link.d.ts +132 -0
- package/dist/types/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types/browser/react/context.d.ts +57 -0
- package/dist/types/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types/browser/react/index.d.ts +1 -0
- package/dist/types/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types/browser/react/location-state.d.ts +29 -0
- package/dist/types/browser/react/mount-context.d.ts +23 -0
- package/dist/types/browser/react/nonce-context.d.ts +14 -0
- package/dist/types/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types/browser/react/use-action.d.ts +61 -0
- package/dist/types/browser/react/use-handle.d.ts +21 -0
- package/dist/types/browser/react/use-href.d.ts +32 -0
- package/dist/types/browser/react/use-link-status.d.ts +36 -0
- package/dist/types/browser/react/use-mount.d.ts +24 -0
- package/dist/types/browser/react/use-navigation.d.ts +15 -0
- package/dist/types/browser/react/use-params.d.ts +21 -0
- package/dist/types/browser/react/use-pathname.d.ts +13 -0
- package/dist/types/browser/react/use-reverse.d.ts +40 -0
- package/dist/types/browser/react/use-router.d.ts +23 -0
- package/dist/types/browser/react/use-search-params.d.ts +19 -0
- package/dist/types/browser/react/use-segments.d.ts +29 -0
- package/dist/types/browser/response-adapter.d.ts +58 -0
- package/dist/types/browser/rsc-router.d.ts +146 -0
- package/dist/types/browser/scroll-restoration.d.ts +103 -0
- package/dist/types/browser/segment-reconciler.d.ts +74 -0
- package/dist/types/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types/browser/server-action-bridge.d.ts +29 -0
- package/dist/types/browser/types.d.ts +546 -0
- package/dist/types/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types/build/generate-manifest.d.ts +106 -0
- package/dist/types/build/generate-route-types.d.ts +8 -0
- package/dist/types/build/index.d.ts +21 -0
- package/dist/types/build/merge-full-manifests.d.ts +3 -0
- package/dist/types/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types/build/route-trie.d.ts +20 -0
- package/dist/types/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types/build/route-types/codegen.d.ts +16 -0
- package/dist/types/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types/build/route-types/per-module-writer.d.ts +20 -0
- package/dist/types/build/route-types/router-processing.d.ts +81 -0
- package/dist/types/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types/build/route-types/source-scan.d.ts +13 -0
- package/dist/types/build/runtime-discovery.d.ts +24 -0
- package/dist/types/cache/background-task.d.ts +21 -0
- package/dist/types/cache/cache-error.d.ts +71 -0
- package/dist/types/cache/cache-exec-scope.d.ts +31 -0
- package/dist/types/cache/cache-key-utils.d.ts +43 -0
- package/dist/types/cache/cache-policy.d.ts +59 -0
- package/dist/types/cache/cache-runtime.d.ts +51 -0
- package/dist/types/cache/cache-scope.d.ts +215 -0
- package/dist/types/cache/cache-tag.d.ts +79 -0
- package/dist/types/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +112 -0
- package/dist/types/cache/cf/cf-cache-store.d.ts +616 -0
- package/dist/types/cache/cf/cf-cache-types.d.ts +365 -0
- package/dist/types/cache/cf/cf-kv-utils.d.ts +43 -0
- package/dist/types/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types/cache/cf/cf-zone-purge.d.ts +31 -0
- package/dist/types/cache/cf/index.d.ts +4 -0
- package/dist/types/cache/document-cache.d.ts +71 -0
- package/dist/types/cache/handle-capture.d.ts +23 -0
- package/dist/types/cache/handle-snapshot.d.ts +39 -0
- package/dist/types/cache/index.d.ts +9 -0
- package/dist/types/cache/memory-segment-store.d.ts +163 -0
- package/dist/types/cache/profile-registry.d.ts +40 -0
- package/dist/types/cache/read-through-swr.d.ts +61 -0
- package/dist/types/cache/search-params-filter.d.ts +64 -0
- package/dist/types/cache/segment-codec.d.ts +78 -0
- package/dist/types/cache/shell-snapshot.d.ts +186 -0
- package/dist/types/cache/tag-invalidation.d.ts +74 -0
- package/dist/types/cache/taint.d.ts +77 -0
- package/dist/types/cache/types.d.ts +503 -0
- package/dist/types/cache/vercel/index.d.ts +1 -0
- package/dist/types/cache/vercel/vercel-cache-store.d.ts +268 -0
- package/dist/types/client-urls/client-root.d.ts +38 -0
- package/dist/types/client-urls/client-urls.d.ts +5 -0
- package/dist/types/client-urls/navigation.d.ts +38 -0
- package/dist/types/client-urls/revalidation-protocol.d.ts +25 -0
- package/dist/types/client-urls/server-projection.d.ts +62 -0
- package/dist/types/client-urls/types.d.ts +144 -0
- package/dist/types/client.d.ts +191 -0
- package/dist/types/client.rsc.d.ts +41 -0
- package/dist/types/cloudflare/index.d.ts +7 -0
- package/dist/types/cloudflare/tracing.d.ts +57 -0
- package/dist/types/component-utils.d.ts +46 -0
- package/dist/types/components/DefaultDocument.d.ts +13 -0
- package/dist/types/context-var.d.ts +84 -0
- package/dist/types/debug.d.ts +57 -0
- package/dist/types/decode-loader-results.d.ts +42 -0
- package/dist/types/default-error-boundary.d.ts +10 -0
- package/dist/types/defer.d.ts +89 -0
- package/dist/types/deps/browser.d.ts +1 -0
- package/dist/types/deps/html-stream-client.d.ts +1 -0
- package/dist/types/deps/html-stream-server.d.ts +1 -0
- package/dist/types/deps/rsc.d.ts +1 -0
- package/dist/types/deps/ssr.d.ts +1 -0
- package/dist/types/dev-discovery-protocol.d.ts +5 -0
- package/dist/types/encode-kv.d.ts +35 -0
- package/dist/types/errors.d.ts +227 -0
- package/dist/types/escape-script.d.ts +44 -0
- package/dist/types/handle.d.ts +93 -0
- package/dist/types/handles/MetaTags.d.ts +17 -0
- package/dist/types/handles/Scripts.d.ts +38 -0
- package/dist/types/handles/breadcrumbs.d.ts +43 -0
- package/dist/types/handles/deferred-resolution.d.ts +53 -0
- package/dist/types/handles/is-thenable.d.ts +10 -0
- package/dist/types/handles/meta.d.ts +43 -0
- package/dist/types/handles/script.d.ts +139 -0
- package/dist/types/host/cookie-handler.d.ts +8 -0
- package/dist/types/host/errors.d.ts +40 -0
- package/dist/types/host/index.d.ts +33 -0
- package/dist/types/host/pattern-matcher.d.ts +30 -0
- package/dist/types/host/router.d.ts +12 -0
- package/dist/types/host/testing.d.ts +41 -0
- package/dist/types/host/types.d.ts +148 -0
- package/dist/types/host/utils.d.ts +20 -0
- package/dist/types/href-client.d.ts +214 -0
- package/dist/types/index.d.ts +113 -0
- package/dist/types/index.rsc.d.ts +52 -0
- package/dist/types/internal-debug.d.ts +1 -0
- package/dist/types/loader-redirect.d.ts +18 -0
- package/dist/types/loader-store.d.ts +193 -0
- package/dist/types/loader.d.ts +18 -0
- package/dist/types/loader.rsc.d.ts +18 -0
- package/dist/types/missing-id-error.d.ts +1 -0
- package/dist/types/outlet-context.d.ts +24 -0
- package/dist/types/outlet-provider.d.ts +14 -0
- package/dist/types/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types/prerender/param-hash.d.ts +6 -0
- package/dist/types/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types/prerender/store.d.ts +63 -0
- package/dist/types/prerender.d.ts +292 -0
- package/dist/types/redirect-origin.d.ts +67 -0
- package/dist/types/regex-escape.d.ts +6 -0
- package/dist/types/render-error-thrower.d.ts +13 -0
- package/dist/types/response-utils.d.ts +35 -0
- package/dist/types/reverse.d.ts +206 -0
- package/dist/types/root-error-boundary.d.ts +32 -0
- package/dist/types/route-content-wrapper.d.ts +81 -0
- package/dist/types/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types/route-definition/helper-factories.d.ts +22 -0
- package/dist/types/route-definition/helpers-types.d.ts +404 -0
- package/dist/types/route-definition/index.d.ts +7 -0
- package/dist/types/route-definition/redirect.d.ts +48 -0
- package/dist/types/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types/route-definition/use-item-types.d.ts +1 -0
- package/dist/types/route-definition.d.ts +1 -0
- package/dist/types/route-map-builder.d.ts +102 -0
- package/dist/types/route-name.d.ts +27 -0
- package/dist/types/route-types.d.ts +172 -0
- package/dist/types/router/basename.d.ts +10 -0
- package/dist/types/router/content-negotiation.d.ts +91 -0
- package/dist/types/router/debug-manifest.d.ts +7 -0
- package/dist/types/router/error-handling.d.ts +110 -0
- package/dist/types/router/find-match.d.ts +19 -0
- package/dist/types/router/handler-context.d.ts +41 -0
- package/dist/types/router/instrument.d.ts +191 -0
- package/dist/types/router/intercept-resolution.d.ts +91 -0
- package/dist/types/router/lazy-includes.d.ts +26 -0
- package/dist/types/router/loader-resolution.d.ts +85 -0
- package/dist/types/router/logging.d.ts +41 -0
- package/dist/types/router/manifest.d.ts +8 -0
- package/dist/types/router/match-api.d.ts +19 -0
- package/dist/types/router/match-context.d.ts +184 -0
- package/dist/types/router/match-handlers.d.ts +48 -0
- package/dist/types/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types/router/match-middleware/cache-lookup.d.ts +126 -0
- package/dist/types/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types/router/match-middleware/index.d.ts +80 -0
- package/dist/types/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types/router/match-pipelines.d.ts +103 -0
- package/dist/types/router/match-result.d.ts +114 -0
- package/dist/types/router/metrics.d.ts +6 -0
- package/dist/types/router/middleware-types.d.ts +74 -0
- package/dist/types/router/middleware.d.ts +116 -0
- package/dist/types/router/navigation-snapshot.d.ts +51 -0
- package/dist/types/router/params-util.d.ts +8 -0
- package/dist/types/router/parse-pattern.d.ts +38 -0
- package/dist/types/router/pattern-matching.d.ts +169 -0
- package/dist/types/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types/router/prefetch-default.d.ts +28 -0
- package/dist/types/router/prefetch-limits.d.ts +20 -0
- package/dist/types/router/prerender-match.d.ts +53 -0
- package/dist/types/router/preview-match.d.ts +22 -0
- package/dist/types/router/request-classification.d.ts +104 -0
- package/dist/types/router/revalidation.d.ts +64 -0
- package/dist/types/router/route-snapshot.d.ts +112 -0
- package/dist/types/router/route-trie-builder.d.ts +77 -0
- package/dist/types/router/router-context.d.ts +137 -0
- package/dist/types/router/router-interfaces.d.ts +461 -0
- package/dist/types/router/router-options.d.ts +792 -0
- package/dist/types/router/router-registry.d.ts +15 -0
- package/dist/types/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types/router/segment-resolution/view-transition-default.d.ts +27 -0
- package/dist/types/router/segment-resolution.d.ts +3 -0
- package/dist/types/router/segment-wrappers.d.ts +53 -0
- package/dist/types/router/state-cookie-name.d.ts +1 -0
- package/dist/types/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types/router/telemetry-otel.d.ts +113 -0
- package/dist/types/router/telemetry.d.ts +216 -0
- package/dist/types/router/timeout.d.ts +107 -0
- package/dist/types/router/tracing.d.ts +139 -0
- package/dist/types/router/transition-when.d.ts +13 -0
- package/dist/types/router/trie-matching.d.ts +32 -0
- package/dist/types/router/types.d.ts +98 -0
- package/dist/types/router/url-params.d.ts +26 -0
- package/dist/types/router.d.ts +7 -0
- package/dist/types/rsc/capture-queue.d.ts +49 -0
- package/dist/types/rsc/full-payload.d.ts +22 -0
- package/dist/types/rsc/handler-context.d.ts +32 -0
- package/dist/types/rsc/handler.d.ts +9 -0
- package/dist/types/rsc/helpers.d.ts +127 -0
- package/dist/types/rsc/index.d.ts +17 -0
- package/dist/types/rsc/json-route-result.d.ts +20 -0
- package/dist/types/rsc/loader-fetch.d.ts +14 -0
- package/dist/types/rsc/manifest-init.d.ts +18 -0
- package/dist/types/rsc/nonce.d.ts +28 -0
- package/dist/types/rsc/origin-guard.d.ts +50 -0
- package/dist/types/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types/rsc/redirect-guard.d.ts +37 -0
- package/dist/types/rsc/render-pipeline.d.ts +148 -0
- package/dist/types/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types/rsc/response-error.d.ts +19 -0
- package/dist/types/rsc/response-route-handler.d.ts +29 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/rsc-rendering.d.ts +18 -0
- package/dist/types/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types/rsc/server-action.d.ts +68 -0
- package/dist/types/rsc/shell-build-manifest.d.ts +90 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +44 -0
- package/dist/types/rsc/shell-capture.d.ts +406 -0
- package/dist/types/rsc/shell-serve.d.ts +189 -0
- package/dist/types/rsc/ssr-setup.d.ts +73 -0
- package/dist/types/rsc/stream-idle.d.ts +60 -0
- package/dist/types/rsc/transition-gate.d.ts +23 -0
- package/dist/types/rsc/types.d.ts +328 -0
- package/dist/types/runtime-env.d.ts +1 -0
- package/dist/types/search-params.d.ts +125 -0
- package/dist/types/segment-content-promise.d.ts +13 -0
- package/dist/types/segment-fragments.d.ts +79 -0
- package/dist/types/segment-loader-promise.d.ts +22 -0
- package/dist/types/segment-system.d.ts +86 -0
- package/dist/types/serialize.d.ts +164 -0
- package/dist/types/server/context.d.ts +520 -0
- package/dist/types/server/cookie-parse.d.ts +10 -0
- package/dist/types/server/cookie-store.d.ts +107 -0
- package/dist/types/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types/server/handle-store.d.ts +131 -0
- package/dist/types/server/loader-registry.d.ts +32 -0
- package/dist/types/server/request-context.d.ts +717 -0
- package/dist/types/server/root-layout.d.ts +3 -0
- package/dist/types/server.d.ts +16 -0
- package/dist/types/ssr/index.d.ts +233 -0
- package/dist/types/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types/ssr/ssr-root.d.ts +69 -0
- package/dist/types/static-handler.d.ts +71 -0
- package/dist/types/testing/cache-status.d.ts +63 -0
- package/dist/types/testing/collect-handle.d.ts +20 -0
- package/dist/types/testing/dispatch.d.ts +127 -0
- package/dist/types/testing/dom.entry.d.ts +15 -0
- package/dist/types/testing/e2e/fixture.d.ts +37 -0
- package/dist/types/testing/e2e/index.d.ts +31 -0
- package/dist/types/testing/e2e/matchers.d.ts +17 -0
- package/dist/types/testing/e2e/page-helpers.d.ts +86 -0
- package/dist/types/testing/e2e/parity.d.ts +111 -0
- package/dist/types/testing/e2e/server.d.ts +35 -0
- package/dist/types/testing/flight-matchers.d.ts +55 -0
- package/dist/types/testing/flight-normalize.d.ts +1 -0
- package/dist/types/testing/flight-tree.d.ts +192 -0
- package/dist/types/testing/flight.d.ts +115 -0
- package/dist/types/testing/flight.entry.d.ts +27 -0
- package/dist/types/testing/generated-routes.d.ts +66 -0
- package/dist/types/testing/index.d.ts +54 -0
- package/dist/types/testing/internal/context.d.ts +225 -0
- package/dist/types/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types/testing/render-handler.d.ts +160 -0
- package/dist/types/testing/render-route.d.ts +265 -0
- package/dist/types/testing/run-loader.d.ts +195 -0
- package/dist/types/testing/run-middleware.d.ts +132 -0
- package/dist/types/testing/run-transition-when.d.ts +78 -0
- package/dist/types/testing/shell-status.d.ts +81 -0
- package/dist/types/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types/testing/vitest.d.ts +205 -0
- package/dist/types/theme/ThemeProvider.d.ts +13 -0
- package/dist/types/theme/ThemeScript.d.ts +45 -0
- package/dist/types/theme/constants.d.ts +39 -0
- package/dist/types/theme/index.d.ts +29 -0
- package/dist/types/theme/theme-context.d.ts +21 -0
- package/dist/types/theme/theme-script.d.ts +26 -0
- package/dist/types/theme/types.d.ts +162 -0
- package/dist/types/theme/use-theme.d.ts +8 -0
- package/dist/types/types/boundaries.d.ts +110 -0
- package/dist/types/types/cache-types.d.ts +191 -0
- package/dist/types/types/error-types.d.ts +114 -0
- package/dist/types/types/global-namespace.d.ts +90 -0
- package/dist/types/types/handler-context.d.ts +658 -0
- package/dist/types/types/index.d.ts +11 -0
- package/dist/types/types/loader-types.d.ts +234 -0
- package/dist/types/types/request-scope.d.ts +93 -0
- package/dist/types/types/route-config.d.ts +105 -0
- package/dist/types/types/route-entry.d.ts +98 -0
- package/dist/types/types/segments.d.ts +246 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/urls/include-helper.d.ts +17 -0
- package/dist/types/urls/include-provider.d.ts +27 -0
- package/dist/types/urls/index.d.ts +6 -0
- package/dist/types/urls/path-helper-types.d.ts +203 -0
- package/dist/types/urls/path-helper.d.ts +12 -0
- package/dist/types/urls/pattern-types.d.ts +166 -0
- package/dist/types/urls/response-types.d.ts +67 -0
- package/dist/types/urls/type-extraction.d.ts +157 -0
- package/dist/types/urls/urls-function.d.ts +24 -0
- package/dist/types/urls.d.ts +1 -0
- package/dist/types/use-loader.d.ts +150 -0
- package/dist/types/vercel/index.d.ts +10 -0
- package/dist/types/vercel/tracing.d.ts +71 -0
- package/dist/types/vite/debug.d.ts +80 -0
- package/dist/types/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types/vite/discovery/client-urls-projection.d.ts +53 -0
- package/dist/types/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types/vite/discovery/state.d.ts +170 -0
- package/dist/types/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/index.d.ts +11 -0
- package/dist/types/vite/inject-client-debug.d.ts +56 -0
- package/dist/types/vite/plugin-types.d.ts +298 -0
- package/dist/types/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +16 -0
- package/dist/types/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types/vite/plugins/refresh-cmd.d.ts +20 -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/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types/vite/rango.d.ts +29 -0
- package/dist/types/vite/router-discovery.d.ts +23 -0
- package/dist/types/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types/vite/utils/banner.d.ts +2 -0
- package/dist/types/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types/vite/utils/shared-utils.d.ts +67 -0
- package/dist/types.backup/__internal.d.ts +127 -0
- package/dist/types.backup/bin/rango.d.ts +1 -0
- package/dist/types.backup/browser/action-coordinator.d.ts +57 -0
- package/dist/types.backup/browser/action-fence.d.ts +33 -0
- package/dist/types.backup/browser/app-shell.d.ts +34 -0
- package/dist/types.backup/browser/app-version.d.ts +6 -0
- package/dist/types.backup/browser/connection-warmup.d.ts +31 -0
- package/dist/types.backup/browser/cookie-name.d.ts +66 -0
- package/dist/types.backup/browser/event-controller.d.ts +221 -0
- package/dist/types.backup/browser/history-state.d.ts +26 -0
- package/dist/types.backup/browser/index.d.ts +1 -0
- package/dist/types.backup/browser/intercept-utils.d.ts +30 -0
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +17 -0
- package/dist/types.backup/browser/link-interceptor.d.ts +43 -0
- package/dist/types.backup/browser/logging.d.ts +33 -0
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +38 -0
- package/dist/types.backup/browser/navigation-bridge.d.ts +27 -0
- package/dist/types.backup/browser/navigation-client.d.ts +17 -0
- package/dist/types.backup/browser/navigation-store-handle.d.ts +25 -0
- package/dist/types.backup/browser/navigation-store.d.ts +95 -0
- package/dist/types.backup/browser/navigation-transaction.d.ts +75 -0
- package/dist/types.backup/browser/network-error-handler.d.ts +35 -0
- package/dist/types.backup/browser/partial-update.d.ts +61 -0
- package/dist/types.backup/browser/prefetch/cache.d.ts +183 -0
- package/dist/types.backup/browser/prefetch/fetch.d.ts +52 -0
- package/dist/types.backup/browser/prefetch/observer.d.ts +27 -0
- package/dist/types.backup/browser/prefetch/policy.d.ts +13 -0
- package/dist/types.backup/browser/prefetch/queue.d.ts +48 -0
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +28 -0
- package/dist/types.backup/browser/rango-state.d.ts +52 -0
- package/dist/types.backup/browser/react/Link.d.ts +140 -0
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +88 -0
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +78 -0
- package/dist/types.backup/browser/react/context.d.ts +54 -0
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +35 -0
- package/dist/types.backup/browser/react/index.d.ts +1 -0
- package/dist/types.backup/browser/react/location-state-shared.d.ts +162 -0
- package/dist/types.backup/browser/react/location-state.d.ts +29 -0
- package/dist/types.backup/browser/react/mount-context.d.ts +23 -0
- package/dist/types.backup/browser/react/nonce-context.d.ts +14 -0
- package/dist/types.backup/browser/react/shallow-equal.d.ts +5 -0
- package/dist/types.backup/browser/react/use-action.d.ts +61 -0
- package/dist/types.backup/browser/react/use-handle.d.ts +21 -0
- package/dist/types.backup/browser/react/use-href.d.ts +32 -0
- package/dist/types.backup/browser/react/use-link-status.d.ts +36 -0
- package/dist/types.backup/browser/react/use-mount.d.ts +24 -0
- package/dist/types.backup/browser/react/use-navigation.d.ts +15 -0
- package/dist/types.backup/browser/react/use-params.d.ts +21 -0
- package/dist/types.backup/browser/react/use-pathname.d.ts +13 -0
- package/dist/types.backup/browser/react/use-reverse.d.ts +40 -0
- package/dist/types.backup/browser/react/use-router.d.ts +23 -0
- package/dist/types.backup/browser/react/use-search-params.d.ts +19 -0
- package/dist/types.backup/browser/react/use-segments.d.ts +29 -0
- package/dist/types.backup/browser/response-adapter.d.ts +58 -0
- package/dist/types.backup/browser/rsc-router.d.ts +141 -0
- package/dist/types.backup/browser/scroll-restoration.d.ts +103 -0
- package/dist/types.backup/browser/segment-reconciler.d.ts +74 -0
- package/dist/types.backup/browser/segment-structure-assert.d.ts +16 -0
- package/dist/types.backup/browser/server-action-bridge.d.ts +29 -0
- package/dist/types.backup/browser/types.d.ts +530 -0
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +28 -0
- package/dist/types.backup/build/collect-fallback-refs.d.ts +5 -0
- package/dist/types.backup/build/generate-manifest.d.ts +100 -0
- package/dist/types.backup/build/generate-route-types.d.ts +8 -0
- package/dist/types.backup/build/index.d.ts +21 -0
- package/dist/types.backup/build/prefix-tree-utils.d.ts +56 -0
- package/dist/types.backup/build/route-trie.d.ts +89 -0
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +3 -0
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/codegen.d.ts +16 -0
- package/dist/types.backup/build/route-types/include-resolution.d.ts +74 -0
- package/dist/types.backup/build/route-types/param-extraction.d.ts +13 -0
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +18 -0
- package/dist/types.backup/build/route-types/router-processing.d.ts +82 -0
- package/dist/types.backup/build/route-types/scan-filter.d.ts +17 -0
- package/dist/types.backup/build/route-types/source-scan.d.ts +13 -0
- package/dist/types.backup/build/runtime-discovery.d.ts +24 -0
- package/dist/types.backup/cache/background-task.d.ts +21 -0
- package/dist/types.backup/cache/cache-error.d.ts +71 -0
- package/dist/types.backup/cache/cache-key-utils.d.ts +35 -0
- package/dist/types.backup/cache/cache-policy.d.ts +59 -0
- package/dist/types.backup/cache/cache-runtime.d.ts +51 -0
- package/dist/types.backup/cache/cache-scope.d.ts +134 -0
- package/dist/types.backup/cache/cache-tag.d.ts +79 -0
- package/dist/types.backup/cache/cf/cf-base64.d.ts +4 -0
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +105 -0
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +481 -0
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +300 -0
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +22 -0
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +15 -0
- package/dist/types.backup/cache/cf/index.d.ts +3 -0
- package/dist/types.backup/cache/document-cache.d.ts +69 -0
- package/dist/types.backup/cache/handle-capture.d.ts +23 -0
- package/dist/types.backup/cache/handle-snapshot.d.ts +39 -0
- package/dist/types.backup/cache/index.d.ts +7 -0
- package/dist/types.backup/cache/memory-segment-store.d.ts +163 -0
- package/dist/types.backup/cache/profile-registry.d.ts +40 -0
- package/dist/types.backup/cache/read-through-swr.d.ts +60 -0
- package/dist/types.backup/cache/segment-codec.d.ts +78 -0
- package/dist/types.backup/cache/shell-snapshot.d.ts +162 -0
- package/dist/types.backup/cache/tag-invalidation.d.ts +74 -0
- package/dist/types.backup/cache/taint.d.ts +71 -0
- package/dist/types.backup/cache/types.d.ts +407 -0
- package/dist/types.backup/cache/vercel/index.d.ts +1 -0
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +267 -0
- package/dist/types.backup/client.d.ts +184 -0
- package/dist/types.backup/client.rsc.d.ts +39 -0
- package/dist/types.backup/cloudflare/index.d.ts +7 -0
- package/dist/types.backup/cloudflare/tracing.d.ts +53 -0
- package/dist/types.backup/component-utils.d.ts +46 -0
- package/dist/types.backup/components/DefaultDocument.d.ts +13 -0
- package/dist/types.backup/context-var.d.ts +84 -0
- package/dist/types.backup/debug.d.ts +57 -0
- package/dist/types.backup/decode-loader-results.d.ts +5 -0
- package/dist/types.backup/default-error-boundary.d.ts +10 -0
- package/dist/types.backup/defer.d.ts +89 -0
- package/dist/types.backup/deps/browser.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-client.d.ts +1 -0
- package/dist/types.backup/deps/html-stream-server.d.ts +1 -0
- package/dist/types.backup/deps/rsc.d.ts +1 -0
- package/dist/types.backup/deps/ssr.d.ts +1 -0
- package/dist/types.backup/encode-kv.d.ts +35 -0
- package/dist/types.backup/errors.d.ts +226 -0
- package/dist/types.backup/escape-script.d.ts +44 -0
- package/dist/types.backup/handle.d.ts +93 -0
- package/dist/types.backup/handles/MetaTags.d.ts +17 -0
- package/dist/types.backup/handles/Scripts.d.ts +38 -0
- package/dist/types.backup/handles/breadcrumbs.d.ts +43 -0
- package/dist/types.backup/handles/deferred-resolution.d.ts +53 -0
- package/dist/types.backup/handles/is-thenable.d.ts +12 -0
- package/dist/types.backup/handles/meta.d.ts +43 -0
- package/dist/types.backup/handles/script.d.ts +139 -0
- package/dist/types.backup/host/cookie-handler.d.ts +8 -0
- package/dist/types.backup/host/errors.d.ts +40 -0
- package/dist/types.backup/host/index.d.ts +33 -0
- package/dist/types.backup/host/pattern-matcher.d.ts +30 -0
- package/dist/types.backup/host/router.d.ts +12 -0
- package/dist/types.backup/host/testing.d.ts +41 -0
- package/dist/types.backup/host/types.d.ts +148 -0
- package/dist/types.backup/host/utils.d.ts +20 -0
- package/dist/types.backup/href-client.d.ts +214 -0
- package/dist/types.backup/index.d.ts +112 -0
- package/dist/types.backup/index.rsc.d.ts +51 -0
- package/dist/types.backup/internal-debug.d.ts +1 -0
- package/dist/types.backup/loader-store.d.ts +193 -0
- package/dist/types.backup/loader.d.ts +18 -0
- package/dist/types.backup/loader.rsc.d.ts +18 -0
- package/dist/types.backup/missing-id-error.d.ts +1 -0
- package/dist/types.backup/outlet-context.d.ts +12 -0
- package/dist/types.backup/outlet-provider.d.ts +12 -0
- package/dist/types.backup/prerender/build-shell-capture.d.ts +104 -0
- package/dist/types.backup/prerender/param-hash.d.ts +6 -0
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +18 -0
- package/dist/types.backup/prerender/store.d.ts +62 -0
- package/dist/types.backup/prerender.d.ts +292 -0
- package/dist/types.backup/redirect-origin.d.ts +55 -0
- package/dist/types.backup/regex-escape.d.ts +6 -0
- package/dist/types.backup/render-error-thrower.d.ts +13 -0
- package/dist/types.backup/response-utils.d.ts +35 -0
- package/dist/types.backup/reverse.d.ts +206 -0
- package/dist/types.backup/root-error-boundary.d.ts +32 -0
- package/dist/types.backup/route-content-wrapper.d.ts +40 -0
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +130 -0
- package/dist/types.backup/route-definition/helper-factories.d.ts +22 -0
- package/dist/types.backup/route-definition/helpers-types.d.ts +392 -0
- package/dist/types.backup/route-definition/index.d.ts +7 -0
- package/dist/types.backup/route-definition/redirect.d.ts +48 -0
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +19 -0
- package/dist/types.backup/route-definition/use-item-types.d.ts +1 -0
- package/dist/types.backup/route-definition.d.ts +1 -0
- package/dist/types.backup/route-map-builder.d.ts +127 -0
- package/dist/types.backup/route-name.d.ts +27 -0
- package/dist/types.backup/route-types.d.ts +172 -0
- package/dist/types.backup/router/basename.d.ts +10 -0
- package/dist/types.backup/router/content-negotiation.d.ts +91 -0
- package/dist/types.backup/router/debug-manifest.d.ts +7 -0
- package/dist/types.backup/router/error-handling.d.ts +76 -0
- package/dist/types.backup/router/find-match.d.ts +19 -0
- package/dist/types.backup/router/handler-context.d.ts +41 -0
- package/dist/types.backup/router/instrument.d.ts +161 -0
- package/dist/types.backup/router/intercept-resolution.d.ts +79 -0
- package/dist/types.backup/router/lazy-includes.d.ts +26 -0
- package/dist/types.backup/router/loader-resolution.d.ts +63 -0
- package/dist/types.backup/router/logging.d.ts +41 -0
- package/dist/types.backup/router/manifest.d.ts +8 -0
- package/dist/types.backup/router/match-api.d.ts +19 -0
- package/dist/types.backup/router/match-context.d.ts +184 -0
- package/dist/types.backup/router/match-handlers.d.ts +49 -0
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +113 -0
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +112 -0
- package/dist/types.backup/router/match-middleware/index.d.ts +80 -0
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +116 -0
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +94 -0
- package/dist/types.backup/router/match-pipelines.d.ts +103 -0
- package/dist/types.backup/router/match-result.d.ts +114 -0
- package/dist/types.backup/router/metrics.d.ts +6 -0
- package/dist/types.backup/router/middleware-types.d.ts +74 -0
- package/dist/types.backup/router/middleware.d.ts +116 -0
- package/dist/types.backup/router/navigation-snapshot.d.ts +22 -0
- package/dist/types.backup/router/params-util.d.ts +8 -0
- package/dist/types.backup/router/parse-pattern.d.ts +38 -0
- package/dist/types.backup/router/pattern-matching.d.ts +169 -0
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +27 -0
- package/dist/types.backup/router/prefetch-limits.d.ts +20 -0
- package/dist/types.backup/router/prerender-match.d.ts +50 -0
- package/dist/types.backup/router/preview-match.d.ts +22 -0
- package/dist/types.backup/router/request-classification.d.ts +104 -0
- package/dist/types.backup/router/revalidation.d.ts +57 -0
- package/dist/types.backup/router/route-snapshot.d.ts +112 -0
- package/dist/types.backup/router/router-context.d.ts +137 -0
- package/dist/types.backup/router/router-interfaces.d.ts +432 -0
- package/dist/types.backup/router/router-options.d.ts +738 -0
- package/dist/types.backup/router/router-registry.d.ts +15 -0
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +55 -0
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +93 -0
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +33 -0
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +44 -0
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +90 -0
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +53 -0
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +85 -0
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +17 -0
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +16 -0
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +28 -0
- package/dist/types.backup/router/segment-resolution.d.ts +3 -0
- package/dist/types.backup/router/segment-wrappers.d.ts +53 -0
- package/dist/types.backup/router/state-cookie-name.d.ts +1 -0
- package/dist/types.backup/router/substitute-pattern-params.d.ts +23 -0
- package/dist/types.backup/router/telemetry-otel.d.ts +113 -0
- package/dist/types.backup/router/telemetry.d.ts +215 -0
- package/dist/types.backup/router/timeout.d.ts +68 -0
- package/dist/types.backup/router/tracing.d.ts +125 -0
- package/dist/types.backup/router/trie-matching.d.ts +32 -0
- package/dist/types.backup/router/types.d.ts +98 -0
- package/dist/types.backup/router/url-params.d.ts +26 -0
- package/dist/types.backup/router.d.ts +7 -0
- package/dist/types.backup/rsc/capture-queue.d.ts +6 -0
- package/dist/types.backup/rsc/full-payload.d.ts +22 -0
- package/dist/types.backup/rsc/handler-context.d.ts +31 -0
- package/dist/types.backup/rsc/handler.d.ts +9 -0
- package/dist/types.backup/rsc/helpers.d.ts +213 -0
- package/dist/types.backup/rsc/index.d.ts +17 -0
- package/dist/types.backup/rsc/json-route-result.d.ts +20 -0
- package/dist/types.backup/rsc/loader-fetch.d.ts +14 -0
- package/dist/types.backup/rsc/manifest-init.d.ts +18 -0
- package/dist/types.backup/rsc/nonce.d.ts +28 -0
- package/dist/types.backup/rsc/origin-guard.d.ts +50 -0
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +19 -0
- package/dist/types.backup/rsc/redirect-guard.d.ts +35 -0
- package/dist/types.backup/rsc/response-cache-serve.d.ts +46 -0
- package/dist/types.backup/rsc/response-error.d.ts +19 -0
- package/dist/types.backup/rsc/response-route-handler.d.ts +29 -0
- package/dist/types.backup/rsc/rsc-rendering.d.ts +23 -0
- package/dist/types.backup/rsc/runtime-warnings.d.ts +22 -0
- package/dist/types.backup/rsc/server-action.d.ts +68 -0
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +84 -0
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +27 -0
- package/dist/types.backup/rsc/shell-capture.d.ts +374 -0
- package/dist/types.backup/rsc/shell-serve.d.ts +136 -0
- package/dist/types.backup/rsc/ssr-setup.d.ts +48 -0
- package/dist/types.backup/rsc/transition-gate.d.ts +27 -0
- package/dist/types.backup/rsc/types.d.ts +290 -0
- package/dist/types.backup/runtime-env.d.ts +1 -0
- package/dist/types.backup/search-params.d.ts +125 -0
- package/dist/types.backup/segment-content-promise.d.ts +13 -0
- package/dist/types.backup/segment-fragments.d.ts +56 -0
- package/dist/types.backup/segment-loader-promise.d.ts +22 -0
- package/dist/types.backup/segment-system.d.ts +84 -0
- package/dist/types.backup/serialize.d.ts +164 -0
- package/dist/types.backup/server/context.d.ts +494 -0
- package/dist/types.backup/server/cookie-parse.d.ts +10 -0
- package/dist/types.backup/server/cookie-store.d.ts +107 -0
- package/dist/types.backup/server/fetchable-loader-store.d.ts +20 -0
- package/dist/types.backup/server/handle-store.d.ts +100 -0
- package/dist/types.backup/server/loader-registry.d.ts +32 -0
- package/dist/types.backup/server/request-context.d.ts +596 -0
- package/dist/types.backup/server/root-layout.d.ts +3 -0
- package/dist/types.backup/server.d.ts +15 -0
- package/dist/types.backup/ssr/index.d.ts +233 -0
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +3 -0
- package/dist/types.backup/ssr/preinit-client-references.d.ts +71 -0
- package/dist/types.backup/ssr/ssr-root.d.ts +69 -0
- package/dist/types.backup/static-handler.d.ts +57 -0
- package/dist/types.backup/testing/cache-status.d.ts +63 -0
- package/dist/types.backup/testing/collect-handle.d.ts +20 -0
- package/dist/types.backup/testing/dispatch.d.ts +123 -0
- package/dist/types.backup/testing/dom.entry.d.ts +15 -0
- package/dist/types.backup/testing/e2e/fixture.d.ts +37 -0
- package/dist/types.backup/testing/e2e/index.d.ts +30 -0
- package/dist/types.backup/testing/e2e/matchers.d.ts +17 -0
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +62 -0
- package/dist/types.backup/testing/e2e/parity.d.ts +111 -0
- package/dist/types.backup/testing/e2e/server.d.ts +35 -0
- package/dist/types.backup/testing/flight-matchers.d.ts +55 -0
- package/dist/types.backup/testing/flight-normalize.d.ts +1 -0
- package/dist/types.backup/testing/flight-tree.d.ts +192 -0
- package/dist/types.backup/testing/flight.d.ts +115 -0
- package/dist/types.backup/testing/flight.entry.d.ts +27 -0
- package/dist/types.backup/testing/generated-routes.d.ts +66 -0
- package/dist/types.backup/testing/index.d.ts +52 -0
- package/dist/types.backup/testing/internal/context.d.ts +225 -0
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +1 -0
- package/dist/types.backup/testing/internal/seed-vars.d.ts +30 -0
- package/dist/types.backup/testing/render-handler.d.ts +160 -0
- package/dist/types.backup/testing/render-route.d.ts +246 -0
- package/dist/types.backup/testing/run-loader.d.ts +186 -0
- package/dist/types.backup/testing/run-middleware.d.ts +132 -0
- package/dist/types.backup/testing/run-transition-when.d.ts +77 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +6 -0
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +13 -0
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +7 -0
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +1 -0
- package/dist/types.backup/testing/vitest.d.ts +205 -0
- package/dist/types.backup/theme/ThemeProvider.d.ts +13 -0
- package/dist/types.backup/theme/ThemeScript.d.ts +45 -0
- package/dist/types.backup/theme/constants.d.ts +39 -0
- package/dist/types.backup/theme/index.d.ts +29 -0
- package/dist/types.backup/theme/theme-context.d.ts +21 -0
- package/dist/types.backup/theme/theme-script.d.ts +26 -0
- package/dist/types.backup/theme/types.d.ts +162 -0
- package/dist/types.backup/theme/use-theme.d.ts +8 -0
- package/dist/types.backup/types/boundaries.d.ts +93 -0
- package/dist/types.backup/types/cache-types.d.ts +191 -0
- package/dist/types.backup/types/error-types.d.ts +114 -0
- package/dist/types.backup/types/global-namespace.d.ts +90 -0
- package/dist/types.backup/types/handler-context.d.ts +658 -0
- package/dist/types.backup/types/index.d.ts +11 -0
- package/dist/types.backup/types/loader-types.d.ts +182 -0
- package/dist/types.backup/types/request-scope.d.ts +93 -0
- package/dist/types.backup/types/route-config.d.ts +105 -0
- package/dist/types.backup/types/route-entry.d.ts +95 -0
- package/dist/types.backup/types/segments.d.ts +234 -0
- package/dist/types.backup/types.d.ts +1 -0
- package/dist/types.backup/urls/include-helper.d.ts +17 -0
- package/dist/types.backup/urls/include-provider.d.ts +27 -0
- package/dist/types.backup/urls/index.d.ts +6 -0
- package/dist/types.backup/urls/path-helper-types.d.ts +197 -0
- package/dist/types.backup/urls/path-helper.d.ts +12 -0
- package/dist/types.backup/urls/pattern-types.d.ts +166 -0
- package/dist/types.backup/urls/response-types.d.ts +67 -0
- package/dist/types.backup/urls/type-extraction.d.ts +157 -0
- package/dist/types.backup/urls/urls-function.d.ts +24 -0
- package/dist/types.backup/urls.d.ts +1 -0
- package/dist/types.backup/use-loader.d.ts +150 -0
- package/dist/types.backup/vercel/index.d.ts +10 -0
- package/dist/types.backup/vercel/tracing.d.ts +70 -0
- package/dist/types.backup/vite/debug.d.ts +80 -0
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +12 -0
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +65 -0
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +17 -0
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +113 -0
- package/dist/types.backup/vite/discovery/gate-state.d.ts +79 -0
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +24 -0
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +32 -0
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +22 -0
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +40 -0
- package/dist/types.backup/vite/discovery/state.d.ts +162 -0
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +15 -0
- package/dist/types.backup/vite/index.d.ts +11 -0
- package/dist/types.backup/vite/inject-client-debug.d.ts +56 -0
- package/dist/types.backup/vite/plugin-types.d.ts +298 -0
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +6 -0
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +40 -0
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +35 -0
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +64 -0
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +18 -0
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +37 -0
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +19 -0
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +10 -0
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +8 -0
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +13 -0
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +29 -0
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +6 -0
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +25 -0
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +20 -0
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +20 -0
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +85 -0
- package/dist/types.backup/vite/plugins/version-injector.d.ts +21 -0
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +19 -0
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +36 -0
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +7 -0
- package/dist/types.backup/vite/rango.d.ts +29 -0
- package/dist/types.backup/vite/router-discovery.d.ts +23 -0
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +64 -0
- package/dist/types.backup/vite/utils/banner.d.ts +2 -0
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +28 -0
- package/dist/types.backup/vite/utils/client-chunks.d.ts +55 -0
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +16 -0
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +37 -0
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +7 -0
- package/dist/types.backup/vite/utils/package-resolution.d.ts +6 -0
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +32 -0
- package/dist/types.backup/vite/utils/shared-utils.d.ts +55 -0
- package/dist/vite/index.js +10725 -3898
- package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/package.json +129 -46
- package/skills/api-client/SKILL.md +211 -0
- package/skills/breadcrumbs/SKILL.md +117 -8
- package/skills/bundle-analysis/SKILL.md +159 -0
- package/skills/cache-guide/SKILL.md +255 -25
- package/skills/caching/SKILL.md +414 -17
- package/skills/catalog.json +289 -0
- package/skills/client-urls/SKILL.md +307 -0
- package/skills/cloudflare/SKILL.md +151 -0
- package/skills/cloudflare/agents/openai.yaml +4 -0
- package/skills/cloudflare/references/d1-and-local-dev.md +131 -0
- package/skills/cloudflare/references/streaming-and-deploy.md +107 -0
- package/skills/cloudflare/references/webhooks-and-crypto.md +147 -0
- package/skills/comparison/SKILL.md +50 -0
- package/skills/comparison/agents/openai.yaml +4 -0
- package/skills/comparison/references/framework-comparison.md +858 -0
- package/skills/composability/SKILL.md +124 -4
- package/skills/css/SKILL.md +76 -0
- package/skills/debug-manifest/SKILL.md +5 -11
- package/skills/defer-hydration/SKILL.md +235 -0
- package/skills/deployment-caching/SKILL.md +176 -0
- package/skills/document-cache/SKILL.md +116 -58
- package/skills/fonts/SKILL.md +1 -1
- package/skills/handler-use/SKILL.md +364 -0
- package/skills/hooks/SKILL.md +73 -691
- package/skills/hooks/data.md +282 -0
- package/skills/hooks/handle-and-actions.md +110 -0
- package/skills/hooks/navigation.md +110 -0
- package/skills/hooks/outlets.md +62 -0
- package/skills/hooks/state.md +228 -0
- package/skills/hooks/urls.md +135 -0
- package/skills/host-router/SKILL.md +129 -27
- package/skills/i18n/SKILL.md +276 -0
- package/skills/intercept/SKILL.md +94 -18
- package/skills/layout/SKILL.md +62 -19
- package/skills/links/SKILL.md +285 -17
- package/skills/loader/SKILL.md +415 -55
- package/skills/middleware/SKILL.md +92 -16
- package/skills/migrate-nextjs/SKILL.md +852 -0
- package/skills/migrate-nextjs/backend-host-swap.md +120 -0
- package/skills/migrate-react-router/SKILL.md +189 -0
- package/skills/migrate-react-router/component-migration.md +201 -0
- package/skills/migrate-react-router/data-and-actions.md +236 -0
- package/skills/migrate-react-router/route-mapping.md +284 -0
- package/skills/mime-routes/SKILL.md +55 -18
- package/skills/observability/SKILL.md +231 -0
- package/skills/parallel/SKILL.md +245 -10
- package/skills/ppr/SKILL.md +914 -0
- package/skills/prerender/SKILL.md +243 -135
- package/skills/rango/SKILL.md +325 -24
- package/skills/react-compiler/SKILL.md +168 -0
- package/skills/response-routes/SKILL.md +180 -52
- package/skills/route/SKILL.md +181 -9
- package/skills/router-setup/SKILL.md +154 -11
- package/skills/scripts/SKILL.md +189 -0
- package/skills/server-actions/SKILL.md +776 -0
- package/skills/shell-manifest/SKILL.md +194 -0
- package/skills/streams-and-websockets/SKILL.md +283 -0
- package/skills/tailwind/SKILL.md +28 -4
- package/skills/testing/SKILL.md +131 -0
- package/skills/testing/bindings.md +103 -0
- package/skills/testing/cache-prerender.md +172 -0
- package/skills/testing/client-components.md +131 -0
- package/skills/testing/e2e-parity.md +125 -0
- package/skills/testing/flight.md +91 -0
- package/skills/testing/handles.md +153 -0
- package/skills/testing/loader.md +130 -0
- package/skills/testing/middleware.md +99 -0
- package/skills/testing/render-handler.md +122 -0
- package/skills/testing/response-routes.md +95 -0
- package/skills/testing/reverse-and-types.md +85 -0
- package/skills/testing/server-actions.md +107 -0
- package/skills/testing/server-tree.md +128 -0
- package/skills/testing/setup.md +123 -0
- package/skills/theme/SKILL.md +9 -6
- package/skills/typesafety/SKILL.md +45 -616
- package/skills/typesafety/env-and-bindings.md +254 -0
- package/skills/typesafety/generated-files-and-cli.md +342 -0
- package/skills/typesafety/params-and-search.md +153 -0
- package/skills/typesafety/route-types.md +213 -0
- package/skills/use-cache/SKILL.md +121 -15
- package/skills/vercel/SKILL.md +149 -0
- package/skills/view-transitions/SKILL.md +341 -0
- package/src/__augment-tests__/augment.ts +81 -0
- package/src/__augment-tests__/augmented.check.ts +116 -0
- package/src/__internal.ts +1 -66
- package/src/browser/action-coordinator.ts +53 -36
- package/src/browser/action-fence.ts +47 -0
- package/src/browser/app-shell.ts +39 -0
- package/src/browser/app-version.ts +14 -0
- package/src/browser/connection-warmup.ts +134 -0
- package/src/browser/cookie-name.ts +140 -0
- package/src/browser/dev-discovery.ts +66 -0
- package/src/browser/event-controller.ts +405 -168
- package/src/browser/history-state.ts +21 -0
- package/src/browser/index.ts +3 -3
- package/src/browser/invalidate-client-cache.ts +52 -0
- package/src/browser/link-interceptor.ts +469 -20
- package/src/browser/logging.ts +28 -0
- package/src/browser/merge-segment-loaders.ts +6 -4
- package/src/browser/navigation-bridge.ts +209 -40
- package/src/browser/navigation-client.ts +284 -73
- package/src/browser/navigation-store-handle.ts +38 -0
- package/src/browser/navigation-store.ts +208 -329
- package/src/browser/navigation-transaction.ts +18 -66
- package/src/browser/network-error-handler.ts +34 -7
- package/src/browser/notify-listeners.ts +22 -0
- package/src/browser/partial-update.ts +278 -126
- package/src/browser/prefetch/cache.ts +362 -51
- package/src/browser/prefetch/default-strategy.ts +74 -0
- package/src/browser/prefetch/fetch.ts +453 -40
- package/src/browser/prefetch/invalidation.ts +30 -0
- package/src/browser/prefetch/loader.ts +111 -0
- package/src/browser/prefetch/observer.ts +50 -22
- package/src/browser/prefetch/policy.ts +6 -0
- package/src/browser/prefetch/queue.ts +144 -23
- package/src/browser/prefetch/resource-ready.ts +77 -0
- package/src/browser/prefetch/runtime.ts +6 -0
- package/src/browser/rango-state.ts +178 -75
- package/src/browser/react/Link.tsx +187 -75
- package/src/browser/react/NavigationProvider.tsx +249 -123
- package/src/browser/react/ScrollRestoration.tsx +10 -6
- package/src/browser/react/context.ts +11 -2
- package/src/browser/react/filter-segment-order.ts +66 -7
- package/src/browser/react/index.ts +0 -48
- package/src/browser/react/location-state-shared.ts +178 -8
- package/src/browser/react/location-state.ts +39 -14
- package/src/browser/react/use-action.ts +6 -15
- package/src/browser/react/use-handle.ts +23 -69
- package/src/browser/react/use-href.tsx +8 -1
- package/src/browser/react/use-link-status.ts +33 -8
- package/src/browser/react/use-navigation.ts +32 -7
- package/src/browser/react/use-params.ts +20 -10
- package/src/browser/react/use-reverse.ts +106 -0
- package/src/browser/react/use-router.ts +47 -12
- package/src/browser/react/use-search-params.ts +0 -5
- package/src/browser/react/use-segments.ts +11 -21
- package/src/browser/response-adapter.ts +99 -8
- package/src/browser/rsc-router.tsx +375 -84
- package/src/browser/scroll-restoration.ts +61 -47
- package/src/browser/segment-reconciler.ts +44 -7
- package/src/browser/segment-structure-assert.ts +2 -2
- package/src/browser/server-action-bridge.ts +270 -71
- package/src/browser/types.ts +166 -37
- package/src/browser/validate-redirect-origin.ts +43 -16
- package/src/build/collect-fallback-refs.ts +107 -0
- package/src/build/generate-manifest.ts +217 -188
- package/src/build/generate-route-types.ts +6 -1
- package/src/build/index.ts +11 -3
- package/src/build/merge-full-manifests.ts +161 -0
- package/src/build/prefix-tree-utils.ts +123 -0
- package/src/build/route-trie.ts +43 -254
- package/src/build/route-types/ast-route-extraction.ts +15 -8
- package/src/build/route-types/codegen.ts +16 -5
- package/src/build/route-types/include-resolution.ts +521 -65
- package/src/build/route-types/param-extraction.ts +6 -3
- package/src/build/route-types/per-module-writer.ts +33 -12
- package/src/build/route-types/router-processing.ts +411 -154
- package/src/build/route-types/scan-filter.ts +9 -2
- package/src/build/route-types/source-scan.ts +216 -0
- package/src/build/runtime-discovery.ts +32 -29
- package/src/cache/cache-error.ts +104 -0
- package/src/cache/cache-exec-scope.ts +47 -0
- package/src/cache/cache-key-utils.ts +73 -15
- package/src/cache/cache-policy.ts +108 -34
- package/src/cache/cache-runtime.ts +566 -117
- package/src/cache/cache-scope.ts +431 -112
- package/src/cache/cache-tag.ts +149 -0
- package/src/cache/cf/cf-base64.ts +33 -0
- package/src/cache/cf/cf-cache-constants.ts +134 -0
- package/src/cache/cf/cf-cache-store.ts +3250 -173
- package/src/cache/cf/cf-cache-types.ts +417 -0
- package/src/cache/cf/cf-kv-utils.ts +84 -0
- package/src/cache/cf/cf-tag-marker-memo.ts +108 -0
- package/src/cache/cf/cf-zone-purge.ts +101 -0
- package/src/cache/cf/index.ts +16 -17
- package/src/cache/document-cache.ts +202 -61
- package/src/cache/handle-snapshot.ts +92 -1
- package/src/cache/index.ts +33 -20
- package/src/cache/memory-segment-store.ts +286 -37
- package/src/cache/profile-registry.ts +46 -31
- package/src/cache/read-through-swr.ts +66 -16
- package/src/cache/search-params-filter.ts +118 -0
- package/src/cache/segment-codec.ts +80 -25
- package/src/cache/shell-snapshot.ts +516 -0
- package/src/cache/tag-invalidation.ts +230 -0
- package/src/cache/taint.ts +83 -9
- package/src/cache/types.ts +323 -100
- package/src/cache/vercel/index.ts +11 -0
- package/src/cache/vercel/vercel-cache-store.ts +1264 -0
- package/src/client-urls/client-root.tsx +161 -0
- package/src/client-urls/client-urls.ts +698 -0
- package/src/client-urls/navigation.ts +237 -0
- package/src/client-urls/revalidation-protocol.ts +56 -0
- package/src/client-urls/server-projection.ts +579 -0
- package/src/client-urls/types.ts +195 -0
- package/src/client.rsc.tsx +48 -21
- package/src/client.tsx +158 -294
- package/src/cloudflare/index.ts +11 -0
- package/src/cloudflare/tracing.ts +112 -0
- package/src/component-utils.ts +19 -0
- package/src/components/DefaultDocument.tsx +8 -2
- package/src/context-var.ts +84 -2
- package/src/debug.ts +2 -2
- package/src/decode-loader-results.ts +160 -0
- package/src/defer.ts +185 -0
- package/src/deps/ssr.ts +4 -2
- package/src/dev-discovery-protocol.ts +11 -0
- package/src/encode-kv.ts +49 -0
- package/src/errors.ts +44 -4
- package/src/escape-script.ts +52 -0
- package/src/handle.ts +104 -34
- package/src/handles/MetaTags.tsx +24 -53
- package/src/handles/Scripts.tsx +183 -0
- package/src/handles/breadcrumbs.ts +35 -8
- package/src/handles/deferred-resolution.ts +134 -0
- package/src/handles/is-thenable.ts +16 -0
- package/src/handles/meta.ts +14 -40
- package/src/handles/script.ts +244 -0
- package/src/host/cookie-handler.ts +9 -60
- package/src/host/errors.ts +13 -22
- package/src/host/index.ts +9 -2
- package/src/host/pattern-matcher.ts +23 -52
- package/src/host/router.ts +107 -99
- package/src/host/testing.ts +40 -27
- package/src/host/types.ts +37 -4
- package/src/host/utils.ts +1 -1
- package/src/href-client.ts +137 -22
- package/src/index.rsc.ts +111 -13
- package/src/index.ts +151 -19
- package/src/internal-debug.ts +11 -10
- package/src/loader-redirect.tsx +47 -0
- package/src/loader-store.ts +500 -0
- package/src/loader.rsc.ts +20 -13
- package/src/loader.ts +12 -11
- package/src/missing-id-error.ts +68 -0
- package/src/outlet-context.ts +13 -1
- package/src/outlet-provider.tsx +16 -6
- package/src/prerender/build-shell-capture.ts +453 -0
- package/src/prerender/param-hash.ts +16 -16
- package/src/prerender/shell-manifest-key.ts +20 -0
- package/src/prerender/store.ts +52 -42
- package/src/prerender.ts +215 -86
- package/src/redirect-origin.ts +143 -0
- package/src/regex-escape.ts +8 -0
- package/src/render-error-thrower.tsx +20 -0
- package/src/response-utils.ts +62 -0
- package/src/reverse.ts +65 -15
- package/src/root-error-boundary.tsx +1 -19
- package/src/route-content-wrapper.tsx +112 -78
- package/src/route-definition/dsl-helpers.ts +519 -307
- package/src/route-definition/helper-factories.ts +28 -140
- package/src/route-definition/helpers-types.ts +169 -78
- package/src/route-definition/index.ts +4 -2
- package/src/route-definition/redirect.ts +53 -12
- package/src/route-definition/resolve-handler-use.ts +160 -0
- package/src/route-definition/use-item-types.ts +29 -0
- package/src/route-map-builder.ts +102 -68
- package/src/route-types.ts +37 -46
- package/src/router/basename.ts +14 -0
- package/src/router/content-negotiation.ts +211 -22
- package/src/router/error-handling.ts +110 -29
- package/src/router/find-match.ts +130 -29
- package/src/router/handler-context.ts +105 -45
- package/src/router/instrument.ts +401 -0
- package/src/router/intercept-resolution.ts +108 -24
- package/src/router/lazy-includes.ts +90 -63
- package/src/router/loader-resolution.ts +529 -57
- package/src/router/logging.ts +5 -8
- package/src/router/manifest.ts +105 -56
- package/src/router/match-api.ts +190 -219
- package/src/router/match-context.ts +0 -22
- package/src/router/match-handlers.ts +268 -171
- package/src/router/match-middleware/background-revalidation.ts +66 -22
- package/src/router/match-middleware/cache-lookup.ts +368 -277
- package/src/router/match-middleware/cache-store.ts +175 -50
- package/src/router/match-middleware/intercept-resolution.ts +8 -28
- package/src/router/match-middleware/segment-resolution.ts +52 -18
- package/src/router/match-pipelines.ts +1 -42
- package/src/router/match-result.ts +135 -44
- package/src/router/metrics.ts +22 -36
- package/src/router/middleware-types.ts +26 -138
- package/src/router/middleware.ts +305 -177
- package/src/router/navigation-snapshot.ts +173 -0
- package/src/router/params-util.ts +23 -0
- package/src/router/parse-pattern.ts +115 -0
- package/src/router/pattern-matching.ts +181 -150
- package/src/router/prefetch-cache-ttl.ts +51 -0
- package/src/router/prefetch-default.ts +59 -0
- package/src/router/prefetch-limits.ts +37 -0
- package/src/router/prerender-match.ts +250 -60
- package/src/router/preview-match.ts +35 -103
- package/src/router/request-classification.ts +291 -0
- package/src/router/revalidation.ts +146 -83
- package/src/router/route-snapshot.ts +256 -0
- package/src/router/route-trie-builder.ts +334 -0
- package/src/router/router-context.ts +11 -29
- package/src/router/router-interfaces.ts +199 -37
- package/src/router/router-options.ts +271 -21
- package/src/router/router-registry.ts +2 -5
- package/src/router/segment-resolution/fresh.ts +367 -78
- package/src/router/segment-resolution/helpers.ts +116 -33
- package/src/router/segment-resolution/loader-cache.ts +188 -39
- package/src/router/segment-resolution/loader-mask.ts +60 -0
- package/src/router/segment-resolution/loader-snapshot.ts +259 -0
- package/src/router/segment-resolution/mask-nested.ts +99 -0
- package/src/router/segment-resolution/revalidation.ts +520 -385
- package/src/router/segment-resolution/static-store.ts +55 -15
- package/src/router/segment-resolution/streamed-handler-telemetry.ts +52 -0
- package/src/router/segment-resolution/view-transition-default.ts +60 -0
- package/src/router/segment-resolution.ts +5 -1
- package/src/router/segment-wrappers.ts +8 -5
- package/src/router/state-cookie-name.ts +33 -0
- package/src/router/substitute-pattern-params.ts +75 -0
- package/src/router/telemetry-otel.ts +171 -200
- package/src/router/telemetry.ts +106 -20
- package/src/router/timeout.ts +53 -22
- package/src/router/tracing.ts +235 -0
- package/src/router/transition-when.ts +76 -0
- package/src/router/trie-matching.ts +171 -59
- package/src/router/types.ts +10 -63
- package/src/router/url-params.ts +57 -0
- package/src/router.ts +301 -78
- package/src/rsc/capture-queue.ts +218 -0
- package/src/rsc/full-payload.ts +77 -0
- package/src/rsc/handler-context.ts +4 -2
- package/src/rsc/handler.ts +901 -519
- package/src/rsc/helpers.ts +245 -47
- package/src/rsc/index.ts +2 -5
- package/src/rsc/json-route-result.ts +38 -0
- package/src/rsc/loader-fetch.ts +129 -33
- package/src/rsc/manifest-init.ts +55 -52
- package/src/rsc/nonce.ts +10 -1
- package/src/rsc/origin-guard.ts +39 -25
- package/src/rsc/progressive-enhancement.ts +381 -74
- package/src/rsc/redirect-guard.ts +102 -0
- package/src/rsc/render-pipeline.ts +611 -0
- package/src/rsc/response-cache-serve.ts +259 -0
- package/src/rsc/response-error.ts +79 -12
- package/src/rsc/response-route-handler.ts +80 -206
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +1625 -156
- package/src/rsc/runtime-warnings.ts +23 -10
- package/src/rsc/server-action.ts +424 -133
- package/src/rsc/shell-build-manifest.ts +336 -0
- package/src/rsc/shell-capture-constants.ts +45 -0
- package/src/rsc/shell-capture.ts +2063 -0
- package/src/rsc/shell-serve.ts +337 -0
- package/src/rsc/ssr-setup.ts +113 -18
- package/src/rsc/stream-idle.ts +137 -0
- package/src/rsc/transition-gate.ts +86 -0
- package/src/rsc/types.ts +100 -6
- package/src/runtime-env.ts +18 -0
- package/src/search-params.ts +35 -30
- package/src/segment-content-promise.ts +67 -0
- package/src/segment-fragments.ts +165 -0
- package/src/segment-loader-promise.ts +167 -0
- package/src/segment-system.tsx +507 -133
- package/src/serialize.ts +243 -0
- package/src/server/context.ts +581 -61
- package/src/server/cookie-parse.ts +32 -0
- package/src/server/cookie-store.ts +162 -15
- package/src/server/handle-store.ts +209 -70
- package/src/server/loader-registry.ts +38 -46
- package/src/server/request-context.ts +961 -186
- package/src/server.ts +7 -2
- package/src/ssr/index.tsx +631 -179
- package/src/ssr/inject-rsc-eager.ts +167 -0
- package/src/ssr/preinit-client-references.ts +106 -0
- package/src/ssr/ssr-root.tsx +262 -0
- package/src/static-handler.ts +45 -20
- package/src/testing/cache-status.ts +162 -0
- package/src/testing/collect-handle.ts +46 -0
- package/src/testing/dispatch.ts +951 -0
- package/src/testing/dom.entry.ts +22 -0
- package/src/testing/e2e/fixture.ts +188 -0
- package/src/testing/e2e/index.ts +147 -0
- package/src/testing/e2e/matchers.ts +35 -0
- package/src/testing/e2e/page-helpers.ts +319 -0
- package/src/testing/e2e/parity.ts +400 -0
- package/src/testing/e2e/server.ts +195 -0
- package/src/testing/flight-matchers.ts +97 -0
- package/src/testing/flight-normalize.ts +11 -0
- package/src/testing/flight-runtime.d.ts +57 -0
- package/src/testing/flight-tree.ts +682 -0
- package/src/testing/flight.entry.ts +52 -0
- package/src/testing/flight.ts +257 -0
- package/src/testing/generated-routes.ts +199 -0
- package/src/testing/index.ts +121 -0
- package/src/testing/internal/context.ts +380 -0
- package/src/testing/internal/flight-client-globals.ts +30 -0
- package/src/testing/internal/seed-vars.ts +54 -0
- package/src/testing/render-handler.ts +371 -0
- package/src/testing/render-route.tsx +667 -0
- package/src/testing/run-loader.ts +423 -0
- package/src/testing/run-middleware.ts +219 -0
- package/src/testing/run-transition-when.ts +197 -0
- package/src/testing/shell-status.ts +206 -0
- package/src/testing/vitest-stubs/cloudflare-email.ts +9 -0
- package/src/testing/vitest-stubs/cloudflare-workers.ts +21 -0
- package/src/testing/vitest-stubs/plugin-rsc.ts +16 -0
- package/src/testing/vitest-stubs/version.ts +5 -0
- package/src/testing/vitest.ts +305 -0
- package/src/theme/ThemeProvider.tsx +56 -84
- package/src/theme/ThemeScript.tsx +7 -9
- package/src/theme/constants.ts +52 -13
- package/src/theme/index.ts +0 -7
- package/src/theme/theme-context.ts +1 -5
- package/src/theme/theme-script.ts +22 -21
- package/src/theme/use-theme.ts +0 -3
- package/src/types/boundaries.ts +15 -35
- package/src/types/cache-types.ts +17 -8
- package/src/types/error-types.ts +30 -90
- package/src/types/global-namespace.ts +54 -41
- package/src/types/handler-context.ts +244 -81
- package/src/types/index.ts +4 -10
- package/src/types/loader-types.ts +99 -15
- package/src/types/request-scope.ts +112 -0
- package/src/types/route-config.ts +20 -52
- package/src/types/route-entry.ts +22 -7
- package/src/types/segments.ts +149 -14
- package/src/urls/include-helper.ts +59 -75
- package/src/urls/include-provider.ts +71 -0
- package/src/urls/index.ts +2 -11
- package/src/urls/path-helper-types.ts +118 -26
- package/src/urls/path-helper.ts +70 -115
- package/src/urls/pattern-types.ts +113 -19
- package/src/urls/response-types.ts +25 -22
- package/src/urls/type-extraction.ts +98 -154
- package/src/urls/urls-function.ts +1 -19
- package/src/use-loader.tsx +404 -86
- package/src/vercel/index.ts +11 -0
- package/src/vercel/tracing.ts +89 -0
- package/src/vite/debug.ts +185 -0
- package/src/vite/discovery/bundle-postprocess.ts +46 -45
- package/src/vite/discovery/client-urls-projection.ts +322 -0
- package/src/vite/discovery/dev-prerender-cache.ts +117 -0
- package/src/vite/discovery/discover-routers.ts +178 -147
- package/src/vite/discovery/discovery-errors.ts +255 -0
- package/src/vite/discovery/gate-state.ts +171 -0
- package/src/vite/discovery/prerender-collection.ts +243 -134
- package/src/vite/discovery/route-types-writer.ts +40 -84
- package/src/vite/discovery/self-gen-tracking.ts +27 -1
- package/src/vite/discovery/shell-prerender-phase.ts +397 -0
- package/src/vite/discovery/state.ts +116 -11
- package/src/vite/discovery/virtual-module-codegen.ts +226 -87
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/index.ts +16 -0
- package/src/vite/inject-client-debug.ts +88 -0
- package/src/vite/plugin-types.ts +267 -62
- package/src/vite/plugins/cjs-to-esm.ts +16 -19
- package/src/vite/plugins/client-ref-dedup.ts +16 -11
- package/src/vite/plugins/client-ref-hashing.ts +28 -15
- package/src/vite/plugins/cloudflare-protocol-loader-hook.d.mts +23 -0
- package/src/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/src/vite/plugins/cloudflare-protocol-stub.ts +194 -0
- package/src/vite/plugins/expose-action-id.ts +51 -100
- package/src/vite/plugins/expose-id-utils.ts +96 -51
- package/src/vite/plugins/expose-ids/export-analysis.ts +101 -34
- package/src/vite/plugins/expose-ids/handler-transform.ts +15 -64
- package/src/vite/plugins/expose-ids/loader-transform.ts +14 -24
- package/src/vite/plugins/expose-ids/router-transform.ts +118 -29
- package/src/vite/plugins/expose-internal-ids.ts +599 -317
- package/src/vite/plugins/performance-tracks.ts +89 -0
- package/src/vite/plugins/refresh-cmd.ts +89 -27
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/plugins/use-cache-transform.ts +73 -83
- package/src/vite/plugins/vercel-output.ts +384 -0
- package/src/vite/plugins/version-injector.ts +39 -29
- package/src/vite/plugins/version-plugin.ts +54 -37
- package/src/vite/plugins/virtual-entries.ts +193 -30
- package/src/vite/rango.ts +403 -304
- package/src/vite/router-discovery.ts +1802 -187
- package/src/vite/utils/ast-handler-extract.ts +26 -35
- package/src/vite/utils/banner.ts +4 -4
- package/src/vite/utils/bundle-analysis.ts +10 -15
- package/src/vite/utils/client-chunks.ts +184 -0
- package/src/vite/utils/directive-prologue.ts +40 -0
- package/src/vite/utils/forward-user-plugins.ts +171 -0
- package/src/vite/utils/manifest-utils.ts +1 -59
- package/src/vite/utils/package-resolution.ts +21 -52
- package/src/vite/utils/prerender-utils.ts +123 -44
- package/src/vite/utils/shared-utils.ts +158 -44
- package/src/browser/action-response-classifier.ts +0 -99
- package/src/browser/react/use-client-cache.ts +0 -58
- package/src/browser/shallow.ts +0 -40
- package/src/handles/index.ts +0 -7
- package/src/network-error-thrower.tsx +0 -23
- package/src/router/middleware-cookies.ts +0 -55
package/src/server/context.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
ShouldRevalidateFn,
|
|
11
11
|
TransitionConfig,
|
|
12
12
|
} from "../types";
|
|
13
|
-
import { invariant } from "../errors";
|
|
13
|
+
import { invariant, DslContextError } from "../errors";
|
|
14
14
|
import type { DefaultRouteName } from "../types/global-namespace.js";
|
|
15
15
|
|
|
16
16
|
// ============================================================================
|
|
@@ -27,6 +27,7 @@ export interface PerformanceMetric {
|
|
|
27
27
|
duration: number; // milliseconds
|
|
28
28
|
startTime: number; // relative to request start
|
|
29
29
|
depth?: number; // nesting level for hierarchical display (0 = top-level)
|
|
30
|
+
desc?: string; // free-form outcome detail, emitted as Server-Timing desc="..."
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -40,7 +41,7 @@ export interface MetricsStore {
|
|
|
40
41
|
metrics: PerformanceMetric[];
|
|
41
42
|
}
|
|
42
43
|
// ============================================================================
|
|
43
|
-
//
|
|
44
|
+
// Rango Context
|
|
44
45
|
// ============================================================================
|
|
45
46
|
|
|
46
47
|
/**
|
|
@@ -71,6 +72,10 @@ export type EntryPropCommon = {
|
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
/**
|
|
75
|
+
* Attachments resolved by walking the parent chain, not owned by the entry:
|
|
76
|
+
* middleware composes downward; revalidate and the error/notFound boundaries are
|
|
77
|
+
* resolved by nearest-ancestor lookup. Inherited, not a single execution chain.
|
|
78
|
+
*
|
|
74
79
|
* @internal This type is an implementation detail and may change without notice.
|
|
75
80
|
*/
|
|
76
81
|
export type EntryPropDatas = {
|
|
@@ -80,6 +85,16 @@ export type EntryPropDatas = {
|
|
|
80
85
|
notFoundBoundary: (ReactNode | NotFoundBoundaryHandler)[];
|
|
81
86
|
};
|
|
82
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Render-time presentation fields shared by every entry variant.
|
|
90
|
+
*
|
|
91
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
92
|
+
*/
|
|
93
|
+
export type EntryPropRender = {
|
|
94
|
+
loading?: ReactNode | false;
|
|
95
|
+
transition?: TransitionConfig;
|
|
96
|
+
};
|
|
97
|
+
|
|
83
98
|
/**
|
|
84
99
|
* Loader entry stored in EntryData
|
|
85
100
|
* Contains the loader definition and its revalidation rules
|
|
@@ -91,6 +106,16 @@ export type LoaderEntry = {
|
|
|
91
106
|
revalidate: ShouldRevalidateFn<any, any>[];
|
|
92
107
|
/** Cache config for this specific loader (loaders are NOT cached by default) */
|
|
93
108
|
cache?: EntryCacheConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Document renders await this loader before segment resolution returns
|
|
111
|
+
* (loader(Def, { stream: "navigation" })), so its data, handle pushes, and
|
|
112
|
+
* thrown notFound()/redirect() deterministically precede first flush.
|
|
113
|
+
* Resolved at DSL-evaluation time from ctx.isSSR — entries are cached
|
|
114
|
+
* per-isSSR (router/manifest.ts cache key), so the flag is already
|
|
115
|
+
* request-mode-correct when resolveLoaders (fresh.ts) reads it and never
|
|
116
|
+
* appears on navigation-lane entries.
|
|
117
|
+
*/
|
|
118
|
+
awaitBeforeFlush?: true;
|
|
94
119
|
};
|
|
95
120
|
|
|
96
121
|
/**
|
|
@@ -136,6 +161,19 @@ export type InterceptWhenFn<TEnv = any> = (
|
|
|
136
161
|
ctx: InterceptSelectorContext<TEnv>,
|
|
137
162
|
) => boolean;
|
|
138
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Config object passed to intercept() (its 4th argument). `when` gates whether
|
|
166
|
+
* the intercept activates on a soft navigation — a single match-time selector or
|
|
167
|
+
* an array of them (ALL must return true; omit to always activate). This is the
|
|
168
|
+
* intercept counterpart to transition({ when }); both express conditional
|
|
169
|
+
* behavior as a config field rather than a separate DSL helper.
|
|
170
|
+
*
|
|
171
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
172
|
+
*/
|
|
173
|
+
export interface InterceptConfig<TEnv = any> {
|
|
174
|
+
when?: InterceptWhenFn<TEnv> | InterceptWhenFn<TEnv>[];
|
|
175
|
+
}
|
|
176
|
+
|
|
139
177
|
/**
|
|
140
178
|
* Intercept entry stored in EntryData
|
|
141
179
|
* Contains the slot name, route to intercept, and handler
|
|
@@ -157,10 +195,29 @@ export type InterceptEntry = {
|
|
|
157
195
|
when: InterceptWhenFn[]; // Selector conditions - all must return true to intercept
|
|
158
196
|
};
|
|
159
197
|
|
|
198
|
+
export interface ParallelEntryData
|
|
199
|
+
extends EntryPropCommon, EntryPropDatas, EntryPropSegments, EntryPropRender {
|
|
200
|
+
type: "parallel";
|
|
201
|
+
handler: Record<`@${string}`, Handler<any, any, any> | ReactNode>;
|
|
202
|
+
/** Set when any parallel slot is a Static definition */
|
|
203
|
+
isStaticPrerender?: true;
|
|
204
|
+
/** Per-slot static handler $$ids for build-time store lookup */
|
|
205
|
+
staticHandlerIds?: Record<string, string>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export type ParallelEntries = Partial<Record<`@${string}`, ParallelEntryData>>;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* This entry's own structural children plus its owned loaders. `loader` lives
|
|
212
|
+
* here (not in EntryPropDatas) because loaders are owned by the entry, not
|
|
213
|
+
* inherited from ancestors.
|
|
214
|
+
*
|
|
215
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
216
|
+
*/
|
|
160
217
|
export type EntryPropSegments = {
|
|
161
218
|
loader: LoaderEntry[];
|
|
162
219
|
layout: EntryData[];
|
|
163
|
-
parallel:
|
|
220
|
+
parallel: ParallelEntries; // slot -> parallel entry (same entry may back multiple slots)
|
|
164
221
|
intercept: InterceptEntry[]; // intercept definitions for soft navigation
|
|
165
222
|
};
|
|
166
223
|
|
|
@@ -168,8 +225,6 @@ export type EntryData =
|
|
|
168
225
|
| ({
|
|
169
226
|
type: "route";
|
|
170
227
|
handler: Handler<any, any, any>;
|
|
171
|
-
loading?: ReactNode | false;
|
|
172
|
-
transition?: TransitionConfig;
|
|
173
228
|
/** URL pattern for this route (used by path() in urls()) */
|
|
174
229
|
pattern?: string;
|
|
175
230
|
/** Set when handler is a Prerender definition */
|
|
@@ -177,50 +232,49 @@ export type EntryData =
|
|
|
177
232
|
/** Original PrerenderHandlerDefinition (for build-time getParams access) */
|
|
178
233
|
prerenderDef?: {
|
|
179
234
|
getParams?: (ctx: any) => Promise<any[]> | any[];
|
|
180
|
-
options?: {
|
|
235
|
+
options?: { concurrency?: number };
|
|
181
236
|
};
|
|
237
|
+
/** Set when route is wrapped with Passthrough() — has a separate live handler */
|
|
238
|
+
isPassthrough?: true;
|
|
239
|
+
/** Live handler for runtime fallback (only set on Passthrough routes) */
|
|
240
|
+
liveHandler?: Handler<any, any, any>;
|
|
182
241
|
/** Set when handler is a Static definition (build-time only) */
|
|
183
242
|
isStaticPrerender?: true;
|
|
184
243
|
/** Static handler $$id for build-time store lookup */
|
|
185
244
|
staticHandlerId?: string;
|
|
186
245
|
/** Response type for non-RSC routes (json, text, image, any) */
|
|
187
246
|
responseType?: string;
|
|
247
|
+
/**
|
|
248
|
+
* PPR (partial pre-rendering) opt-in from the path() `ppr` option. A
|
|
249
|
+
* document-level property of the page route: `true` uses the default
|
|
250
|
+
* shell policy, an object carries ttl/swr/tags. Read by the integrated
|
|
251
|
+
* PPR serve path (rsc/shell-serve.ts resolvePprConfig).
|
|
252
|
+
*/
|
|
253
|
+
ppr?: boolean | import("../urls/pattern-types.js").PartialPrerenderProps;
|
|
188
254
|
} & EntryPropCommon &
|
|
189
255
|
EntryPropDatas &
|
|
190
|
-
EntryPropSegments
|
|
256
|
+
EntryPropSegments &
|
|
257
|
+
EntryPropRender)
|
|
191
258
|
| ({
|
|
192
259
|
type: "layout";
|
|
193
260
|
handler: ReactNode | Handler<any, any, any>;
|
|
194
|
-
loading?: ReactNode | false;
|
|
195
|
-
transition?: TransitionConfig;
|
|
196
261
|
/** Set when handler is a Static definition (build-time only) */
|
|
197
262
|
isStaticPrerender?: true;
|
|
198
263
|
/** Static handler $$id for build-time store lookup */
|
|
199
264
|
staticHandlerId?: string;
|
|
200
265
|
} & EntryPropCommon &
|
|
201
266
|
EntryPropDatas &
|
|
202
|
-
EntryPropSegments
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
handler: Record<`@${string}`, Handler<any, any, any> | ReactNode>;
|
|
206
|
-
loading?: ReactNode | false;
|
|
207
|
-
transition?: TransitionConfig;
|
|
208
|
-
/** Set when any parallel slot is a Static definition */
|
|
209
|
-
isStaticPrerender?: true;
|
|
210
|
-
/** Per-slot static handler $$ids for build-time store lookup */
|
|
211
|
-
staticHandlerIds?: Record<string, string>;
|
|
212
|
-
} & EntryPropCommon &
|
|
213
|
-
EntryPropDatas &
|
|
214
|
-
EntryPropSegments)
|
|
267
|
+
EntryPropSegments &
|
|
268
|
+
EntryPropRender)
|
|
269
|
+
| ParallelEntryData
|
|
215
270
|
| ({
|
|
216
271
|
type: "cache";
|
|
217
272
|
/** Cache entries create cache boundaries and render like layouts (with Outlet) */
|
|
218
273
|
handler: ReactNode | Handler<any, any, any>;
|
|
219
|
-
loading?: ReactNode | false;
|
|
220
|
-
transition?: TransitionConfig;
|
|
221
274
|
} & EntryPropCommon &
|
|
222
275
|
EntryPropDatas &
|
|
223
|
-
EntryPropSegments
|
|
276
|
+
EntryPropSegments &
|
|
277
|
+
EntryPropRender);
|
|
224
278
|
|
|
225
279
|
/**
|
|
226
280
|
* Tracked include info for build-time manifest generation
|
|
@@ -233,6 +287,17 @@ export interface TrackedInclude {
|
|
|
233
287
|
lazy: boolean;
|
|
234
288
|
}
|
|
235
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Cached response-header write scope (issue #713). `kind` selects the error
|
|
292
|
+
* wording; `routeKey` names the route in the error.
|
|
293
|
+
*
|
|
294
|
+
* @internal This type is an implementation detail and may change without notice.
|
|
295
|
+
*/
|
|
296
|
+
export type CachedHeaderScope = {
|
|
297
|
+
kind: "cache" | "ppr";
|
|
298
|
+
routeKey?: string;
|
|
299
|
+
};
|
|
300
|
+
|
|
236
301
|
/**
|
|
237
302
|
* Context stored in AsyncLocalStorage
|
|
238
303
|
*/
|
|
@@ -243,6 +308,10 @@ interface HelperContext {
|
|
|
243
308
|
counters: Record<string, number>;
|
|
244
309
|
forRoute?: string;
|
|
245
310
|
mountIndex?: number;
|
|
311
|
+
/** Owning router id, when known (threaded by generateManifestFull). Scopes
|
|
312
|
+
* the search-schema/root-scope registries so same-named routes in
|
|
313
|
+
* different routers don't clobber each other (route-map-builder.ts). */
|
|
314
|
+
routerId?: string;
|
|
246
315
|
metrics?: MetricsStore;
|
|
247
316
|
/** True when rendering for SSR (document requests) */
|
|
248
317
|
isSSR?: boolean;
|
|
@@ -270,6 +339,32 @@ interface HelperContext {
|
|
|
270
339
|
string,
|
|
271
340
|
import("../cache/profile-registry.js").CacheProfile
|
|
272
341
|
>;
|
|
342
|
+
/** True when resolving handlers inside a cache() DSL boundary.
|
|
343
|
+
* Read by ctx.get() to guard non-cacheable variable reads. */
|
|
344
|
+
insideCacheScope?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* RULE (issue #713): in any cached scenario ONLY MIDDLEWARE writes response
|
|
347
|
+
* headers. Latched by the segment funnels, consulted by
|
|
348
|
+
* assertCachedHeaderWriteAllowed(); full doctrine in
|
|
349
|
+
* docs/design/ppr-shell-resume.md "The header doctrine".
|
|
350
|
+
*/
|
|
351
|
+
cachedHeaderScope?: CachedHeaderScope;
|
|
352
|
+
/**
|
|
353
|
+
* Include scope string applied to direct-descendant shortCodes.
|
|
354
|
+
*
|
|
355
|
+
* Each `include(...)` call allocates a sibling-positional token like `I0`,
|
|
356
|
+
* `I1` from its parent's include counter and stores the composed scope
|
|
357
|
+
* (`${parentScope}I${idx}`) in its lazyContext. When the include's handler
|
|
358
|
+
* evaluates lazily, the store's `includeScope` is set from that context so
|
|
359
|
+
* every direct-descendant shortCode is generated as
|
|
360
|
+
* `${parent.shortCode}${includeScope}${prefix}${index}` — preventing
|
|
361
|
+
* collisions with siblings declared outside the include.
|
|
362
|
+
*
|
|
363
|
+
* The scope is NOT propagated through `store.run(...)`, so layouts /
|
|
364
|
+
* parallels / caches inside the include absorb the scope into their own
|
|
365
|
+
* shortCodes and their children start fresh.
|
|
366
|
+
*/
|
|
367
|
+
includeScope?: string;
|
|
273
368
|
}
|
|
274
369
|
// Use a global symbol key so the AsyncLocalStorage instance survives HMR
|
|
275
370
|
// module re-evaluation. Without this, Vite's RSC module runner may create
|
|
@@ -277,10 +372,28 @@ interface HelperContext {
|
|
|
277
372
|
// hold references to the old instance — causing getStore() to return
|
|
278
373
|
// undefined even inside a run() callback.
|
|
279
374
|
const RSC_CONTEXT_KEY = Symbol.for("rangojs-router:rsc-context");
|
|
280
|
-
export const
|
|
375
|
+
export const RangoContext: AsyncLocalStorage<HelperContext> = ((
|
|
281
376
|
globalThis as any
|
|
282
377
|
)[RSC_CONTEXT_KEY] ??= new AsyncLocalStorage<HelperContext>());
|
|
283
378
|
|
|
379
|
+
/** shortCode prefix letter per entry type (e.g. "L0", "R2", "M1C0"). */
|
|
380
|
+
const SHORT_CODE_PREFIX: Record<
|
|
381
|
+
"layout" | "parallel" | "route" | "loader" | "cache",
|
|
382
|
+
string
|
|
383
|
+
> = {
|
|
384
|
+
layout: "L",
|
|
385
|
+
parallel: "P",
|
|
386
|
+
route: "R",
|
|
387
|
+
loader: "D",
|
|
388
|
+
cache: "C",
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/** Post-increment a named per-store counter, returning the prior value. */
|
|
392
|
+
function bumpCounter(store: HelperContext, key: string): number {
|
|
393
|
+
store.counters[key] ??= 0;
|
|
394
|
+
return store.counters[key]++;
|
|
395
|
+
}
|
|
396
|
+
|
|
284
397
|
export const getContext = (): {
|
|
285
398
|
context: AsyncLocalStorage<HelperContext>;
|
|
286
399
|
getStore: () => HelperContext;
|
|
@@ -304,12 +417,12 @@ export const getContext = (): {
|
|
|
304
417
|
callback: (...args: any[]) => T,
|
|
305
418
|
) => T;
|
|
306
419
|
} => {
|
|
307
|
-
const context =
|
|
420
|
+
const context = RangoContext;
|
|
308
421
|
|
|
309
422
|
return {
|
|
310
423
|
context,
|
|
311
424
|
getOrCreateStore: (forRoute?: string): HelperContext => {
|
|
312
|
-
let store =
|
|
425
|
+
let store = RangoContext.getStore();
|
|
313
426
|
if (!store) {
|
|
314
427
|
store = {
|
|
315
428
|
manifest: new Map<string, EntryData>(),
|
|
@@ -329,7 +442,7 @@ export const getContext = (): {
|
|
|
329
442
|
const store = context.getStore();
|
|
330
443
|
if (!store) {
|
|
331
444
|
throw new Error(
|
|
332
|
-
"
|
|
445
|
+
"Rango context store is not available. Make sure to run within Rango context.",
|
|
333
446
|
);
|
|
334
447
|
}
|
|
335
448
|
return store;
|
|
@@ -346,48 +459,36 @@ export const getContext = (): {
|
|
|
346
459
|
type: (string & {}) | "layout" | "parallel" | "middleware" | "revalidate",
|
|
347
460
|
) => {
|
|
348
461
|
const store = context.getStore();
|
|
349
|
-
invariant(store, "No context
|
|
350
|
-
store
|
|
351
|
-
const index = store.counters[type];
|
|
352
|
-
store.counters[type] = index + 1;
|
|
353
|
-
return `$${type}.${index}`;
|
|
462
|
+
invariant(store, "No context RangoContext available");
|
|
463
|
+
return `$${type}.${bumpCounter(store, type)}`;
|
|
354
464
|
},
|
|
355
465
|
getShortCode: (
|
|
356
466
|
type: "layout" | "parallel" | "route" | "loader" | "cache",
|
|
357
467
|
) => {
|
|
358
468
|
const store = context.getStore();
|
|
359
|
-
invariant(store, "No context
|
|
469
|
+
invariant(store, "No context RangoContext available");
|
|
360
470
|
|
|
361
471
|
const parent = store.parent;
|
|
362
|
-
const prefix =
|
|
363
|
-
type === "layout"
|
|
364
|
-
? "L"
|
|
365
|
-
: type === "parallel"
|
|
366
|
-
? "P"
|
|
367
|
-
: type === "loader"
|
|
368
|
-
? "D"
|
|
369
|
-
: type === "cache"
|
|
370
|
-
? "C"
|
|
371
|
-
: "R";
|
|
472
|
+
const prefix = SHORT_CODE_PREFIX[type];
|
|
372
473
|
const mountPrefix =
|
|
373
474
|
store.mountIndex !== undefined ? `M${store.mountIndex}` : "";
|
|
374
475
|
|
|
476
|
+
const includeScope = store.includeScope ?? "";
|
|
477
|
+
|
|
375
478
|
if (!parent) {
|
|
376
479
|
// Root entry: prefix with mount index and use mount-scoped counter
|
|
377
480
|
const counterKey = mountPrefix
|
|
378
481
|
? `${mountPrefix}_root_${type}`
|
|
379
482
|
: `root_${type}`;
|
|
380
|
-
store
|
|
381
|
-
const index = store.counters[counterKey];
|
|
382
|
-
store.counters[counterKey] = index + 1;
|
|
383
|
-
return `${mountPrefix}${prefix}${index}`;
|
|
483
|
+
return `${mountPrefix}${prefix}${bumpCounter(store, counterKey)}`;
|
|
384
484
|
} else {
|
|
385
|
-
// Child entry: use parent-scoped counter
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
485
|
+
// Child entry: use parent-scoped counter with includeScope appended.
|
|
486
|
+
// When we're evaluating a lazy include's direct children, includeScope
|
|
487
|
+
// is a per-include token like "I0" / "I1I0" that partitions the
|
|
488
|
+
// parent's counter namespace so routes inside one include cannot
|
|
489
|
+
// collide with siblings declared outside it.
|
|
490
|
+
const counterKey = `${parent.shortCode}${includeScope}_${type}`;
|
|
491
|
+
return `${parent.shortCode}${includeScope}${prefix}${bumpCounter(store, counterKey)}`;
|
|
391
492
|
}
|
|
392
493
|
},
|
|
393
494
|
runWithStore: <T>(
|
|
@@ -404,6 +505,7 @@ export const getContext = (): {
|
|
|
404
505
|
counters: store.counters,
|
|
405
506
|
forRoute: store.forRoute,
|
|
406
507
|
mountIndex: store.mountIndex,
|
|
508
|
+
routerId: store.routerId,
|
|
407
509
|
metrics: store.metrics,
|
|
408
510
|
isSSR: store.isSSR,
|
|
409
511
|
patterns: store.patterns,
|
|
@@ -414,6 +516,10 @@ export const getContext = (): {
|
|
|
414
516
|
rootScoped: store.rootScoped,
|
|
415
517
|
trackedIncludes: store.trackedIncludes,
|
|
416
518
|
cacheProfiles: store.cacheProfiles,
|
|
519
|
+
includeScope: store.includeScope,
|
|
520
|
+
// cachedHeaderScope (and insideCacheScope) deliberately NOT copied —
|
|
521
|
+
// the header guard's middleware exemption depends on the latch dying
|
|
522
|
+
// with the funnel scope (see assertCachedHeaderWriteAllowed).
|
|
417
523
|
},
|
|
418
524
|
callback,
|
|
419
525
|
);
|
|
@@ -442,6 +548,7 @@ export const getContext = (): {
|
|
|
442
548
|
counters,
|
|
443
549
|
forRoute: store?.forRoute,
|
|
444
550
|
mountIndex: store?.mountIndex,
|
|
551
|
+
routerId: store?.routerId,
|
|
445
552
|
metrics: store?.metrics,
|
|
446
553
|
isSSR: store?.isSSR,
|
|
447
554
|
patterns,
|
|
@@ -460,6 +567,31 @@ export const getContext = (): {
|
|
|
460
567
|
};
|
|
461
568
|
};
|
|
462
569
|
|
|
570
|
+
/**
|
|
571
|
+
* Acquire the active DSL build context, throwing `message` if a helper was
|
|
572
|
+
* called outside a urls()/map() builder. Returns the store API and the live
|
|
573
|
+
* HelperContext so callers avoid a second getContext() lookup.
|
|
574
|
+
*/
|
|
575
|
+
export function requireDslContext(message: string): {
|
|
576
|
+
store: ReturnType<typeof getContext>;
|
|
577
|
+
ctx: HelperContext;
|
|
578
|
+
} {
|
|
579
|
+
const store = getContext();
|
|
580
|
+
const ctx = store.context.getStore();
|
|
581
|
+
if (!ctx) {
|
|
582
|
+
// The only reason the store is absent here is that a route-definition helper
|
|
583
|
+
// ran with no active RangoContext — i.e. outside a urls()/map() builder.
|
|
584
|
+
// Record that as the cause so the throw is self-explanatory, not a bare
|
|
585
|
+
// "must be called inside urls()" with no indication of the mechanism.
|
|
586
|
+
throw new DslContextError(message, {
|
|
587
|
+
cause:
|
|
588
|
+
"RangoContext store is undefined: a route-definition helper was called " +
|
|
589
|
+
"outside an active urls()/map() builder.",
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
return { store, ctx };
|
|
593
|
+
}
|
|
594
|
+
|
|
463
595
|
/**
|
|
464
596
|
* Run a callback with specific URL and name prefixes
|
|
465
597
|
* Used by include() to apply prefixes to nested patterns
|
|
@@ -469,7 +601,7 @@ export function runWithPrefixes<T>(
|
|
|
469
601
|
namePrefix: string | undefined,
|
|
470
602
|
callback: () => T,
|
|
471
603
|
): T {
|
|
472
|
-
const store =
|
|
604
|
+
const store = RangoContext.getStore();
|
|
473
605
|
if (!store) {
|
|
474
606
|
throw new Error("runWithPrefixes must be called within router context");
|
|
475
607
|
}
|
|
@@ -514,7 +646,7 @@ export function runWithPrefixes<T>(
|
|
|
514
646
|
? (store.rootScoped ?? false)
|
|
515
647
|
: store.rootScoped;
|
|
516
648
|
|
|
517
|
-
return
|
|
649
|
+
return RangoContext.run(
|
|
518
650
|
{
|
|
519
651
|
...store,
|
|
520
652
|
urlPrefix: combinedUrlPrefix,
|
|
@@ -529,7 +661,7 @@ export function runWithPrefixes<T>(
|
|
|
529
661
|
* Get current URL prefix from context
|
|
530
662
|
*/
|
|
531
663
|
export function getUrlPrefix(): string {
|
|
532
|
-
const store =
|
|
664
|
+
const store = RangoContext.getStore();
|
|
533
665
|
return store?.urlPrefix || "";
|
|
534
666
|
}
|
|
535
667
|
|
|
@@ -537,7 +669,7 @@ export function getUrlPrefix(): string {
|
|
|
537
669
|
* Get current name prefix from context
|
|
538
670
|
*/
|
|
539
671
|
export function getNamePrefix(): string | undefined {
|
|
540
|
-
const store =
|
|
672
|
+
const store = RangoContext.getStore();
|
|
541
673
|
return store?.namePrefix;
|
|
542
674
|
}
|
|
543
675
|
|
|
@@ -546,13 +678,109 @@ export function getNamePrefix(): string | undefined {
|
|
|
546
678
|
* Returns true at root or inside { name: "" } includes, false inside named includes.
|
|
547
679
|
*/
|
|
548
680
|
export function getRootScoped(): boolean {
|
|
549
|
-
const store =
|
|
681
|
+
const store = RangoContext.getStore();
|
|
550
682
|
return store?.rootScoped ?? true;
|
|
551
683
|
}
|
|
552
684
|
|
|
685
|
+
/**
|
|
686
|
+
* Stamp build-time scope identity onto a Static() definition at mount time.
|
|
687
|
+
* The bake collector (prerender-collection.ts) renders defs OUTSIDE any
|
|
688
|
+
* evaluation scope and used to iterate the registry first-non-null, so these
|
|
689
|
+
* are the ONLY reliable carriers of the def's owning router, root-scope, and
|
|
690
|
+
* full route name — a name-keyed registry lookup at bake time reproduces the
|
|
691
|
+
* cross-router collision #757/#762 fixed (and the collector's historical
|
|
692
|
+
* `$$routePrefix` argument is a name PREFIX, which the root-scope registry
|
|
693
|
+
* never contains, silently degrading to the dot-heuristic).
|
|
694
|
+
* A definition mounted more than once is stamped each time; the last mount wins.
|
|
695
|
+
*/
|
|
696
|
+
export function stampStaticDefScope(
|
|
697
|
+
handler: unknown,
|
|
698
|
+
routeName?: string,
|
|
699
|
+
): void {
|
|
700
|
+
const store = RangoContext.getStore();
|
|
701
|
+
const def = handler as Record<string, unknown>;
|
|
702
|
+
if (routeName !== undefined) def.$$routeName = routeName;
|
|
703
|
+
def.$$rootScoped = getRootScoped();
|
|
704
|
+
if (store?.routerId !== undefined) def.$$routerId = store.routerId;
|
|
705
|
+
}
|
|
706
|
+
|
|
553
707
|
// Export HelperContext type for use in other modules
|
|
554
708
|
export type { HelperContext };
|
|
555
709
|
|
|
710
|
+
/**
|
|
711
|
+
* Return an isolated copy of a lazy include's captured parent entry.
|
|
712
|
+
*
|
|
713
|
+
* DSL helpers (loader(), middleware(), etc.) mutate ctx.parent in place.
|
|
714
|
+
* Multiple include() scopes capture the *same* syntheticMapRoot as their
|
|
715
|
+
* parent, so without isolation one include's loaders/middleware leak into
|
|
716
|
+
* every other route that shares that root.
|
|
717
|
+
*
|
|
718
|
+
* The clone is shallow: only the mutable arrays are copied so each
|
|
719
|
+
* include pushes to its own list. The rest of the entry (id, shortCode,
|
|
720
|
+
* parent pointer, handler) stays shared, which is correct and cheap.
|
|
721
|
+
*/
|
|
722
|
+
export function getIsolatedLazyParent(
|
|
723
|
+
captured: EntryData | null | undefined,
|
|
724
|
+
): EntryData | null {
|
|
725
|
+
if (!captured) return null;
|
|
726
|
+
return {
|
|
727
|
+
...captured,
|
|
728
|
+
loader: [...captured.loader],
|
|
729
|
+
middleware: [...captured.middleware],
|
|
730
|
+
revalidate: [...captured.revalidate],
|
|
731
|
+
errorBoundary: [...captured.errorBoundary],
|
|
732
|
+
notFoundBoundary: [...captured.notFoundBoundary],
|
|
733
|
+
layout: [...captured.layout],
|
|
734
|
+
parallel: { ...captured.parallel },
|
|
735
|
+
intercept: [...captured.intercept],
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export function getParallelEntries(
|
|
740
|
+
parallels: ParallelEntries | EntryData[] | undefined,
|
|
741
|
+
): ParallelEntryData[] {
|
|
742
|
+
if (!parallels) return [];
|
|
743
|
+
if (Array.isArray(parallels)) {
|
|
744
|
+
return parallels.filter(
|
|
745
|
+
(entry): entry is ParallelEntryData => entry.type === "parallel",
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
return Object.values(parallels).filter(
|
|
749
|
+
(entry): entry is ParallelEntryData => !!entry,
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export function getParallelSlotEntries(
|
|
754
|
+
parallels: ParallelEntries | EntryData[] | undefined,
|
|
755
|
+
): Array<{ slot: `@${string}`; entry: ParallelEntryData }> {
|
|
756
|
+
if (!parallels) return [];
|
|
757
|
+
|
|
758
|
+
if (Array.isArray(parallels)) {
|
|
759
|
+
return getParallelEntries(parallels).flatMap((entry) =>
|
|
760
|
+
(Object.keys(entry.handler) as `@${string}`[]).map((slot) => ({
|
|
761
|
+
slot,
|
|
762
|
+
entry,
|
|
763
|
+
})),
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
return Object.entries(parallels)
|
|
768
|
+
.filter(([, entry]) => !!entry)
|
|
769
|
+
.map(([slot, entry]) => ({
|
|
770
|
+
slot: slot as `@${string}`,
|
|
771
|
+
entry: entry!,
|
|
772
|
+
}));
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
export function getParallelSlotCount(
|
|
776
|
+
parallels: ParallelEntries | EntryData[] | undefined,
|
|
777
|
+
): number {
|
|
778
|
+
if (!parallels) return 0;
|
|
779
|
+
return Array.isArray(parallels)
|
|
780
|
+
? parallels.filter((entry) => entry?.type === "parallel").length
|
|
781
|
+
: Object.keys(parallels).length;
|
|
782
|
+
}
|
|
783
|
+
|
|
556
784
|
// ============================================================================
|
|
557
785
|
// Performance Metrics Helpers
|
|
558
786
|
// ============================================================================
|
|
@@ -569,7 +797,7 @@ export type { HelperContext };
|
|
|
569
797
|
* ```
|
|
570
798
|
*/
|
|
571
799
|
export function track(label: string, depth?: number): () => void {
|
|
572
|
-
const store =
|
|
800
|
+
const store = RangoContext.getStore();
|
|
573
801
|
|
|
574
802
|
// No-op if context unavailable or metrics not enabled
|
|
575
803
|
if (!store?.metrics?.enabled) {
|
|
@@ -589,3 +817,295 @@ export function track(label: string, depth?: number): () => void {
|
|
|
589
817
|
});
|
|
590
818
|
};
|
|
591
819
|
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Separate ALS for tracking loader execution scope.
|
|
823
|
+
* Uses a dedicated ALS (not RangoContext) to avoid issues with
|
|
824
|
+
* nested RangoContext.run() calls in Vite's module runner.
|
|
825
|
+
*/
|
|
826
|
+
const LOADER_SCOPE_KEY = Symbol.for("rangojs-router:loader-scope");
|
|
827
|
+
const loaderScopeALS: AsyncLocalStorage<{ active: true }> = ((
|
|
828
|
+
globalThis as any
|
|
829
|
+
)[LOADER_SCOPE_KEY] ??= new AsyncLocalStorage<{ active: true }>());
|
|
830
|
+
|
|
831
|
+
// Purity-only scope: marks that a loader FUNCTION BODY is executing, regardless
|
|
832
|
+
// of how the loader was invoked (DSL via runInsideLoaderScope, or handler-
|
|
833
|
+
// invoked via ctx.use). Consulted by isInsideCacheScope() to exempt
|
|
834
|
+
// request-scoped reads, by getCurrentLoaderBodyId() for guard-warning
|
|
835
|
+
// attribution, and by isInsideHandlerInvokedLoaderBody() for the
|
|
836
|
+
// consumption-lane rule (the shell-capture guard exemption). It deliberately
|
|
837
|
+
// does NOT affect isInsideLoaderScope(), so rendered()/barrier/deadlock
|
|
838
|
+
// gating (which must distinguish DSL from handler-invoked loaders) is
|
|
839
|
+
// unchanged.
|
|
840
|
+
const LOADER_BODY_SCOPE_KEY = Symbol.for("rangojs-router:loader-body-scope");
|
|
841
|
+
const loaderBodyScopeALS: AsyncLocalStorage<{
|
|
842
|
+
active: true;
|
|
843
|
+
loaderId?: string;
|
|
844
|
+
handlerInvoked?: boolean;
|
|
845
|
+
}> = ((globalThis as any)[LOADER_BODY_SCOPE_KEY] ??= new AsyncLocalStorage<{
|
|
846
|
+
active: true;
|
|
847
|
+
loaderId?: string;
|
|
848
|
+
handlerInvoked?: boolean;
|
|
849
|
+
}>());
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Check if the current execution is inside a cache() DSL boundary.
|
|
853
|
+
* Returns false inside loader execution — loaders are always fresh
|
|
854
|
+
* (never cached), so non-cacheable reads are safe.
|
|
855
|
+
*/
|
|
856
|
+
export function isInsideCacheScope(): boolean {
|
|
857
|
+
if (RangoContext.getStore()?.insideCacheScope !== true) return false;
|
|
858
|
+
// Request-scoped READS are exempt in any loader body — DSL loaders re-run on
|
|
859
|
+
// every request (including cache() HITs via resolveLoadersOnly), and a
|
|
860
|
+
// handler-invoked loader body, though skipped with its handler on a HIT,
|
|
861
|
+
// yields a BAKED shared copy in the cached artifact — an accepted
|
|
862
|
+
// consumption-lane tradeoff (#672/#674). This is deliberately BROADER than
|
|
863
|
+
// the WRITE guard (assertCachedHeaderWriteAllowed narrows the cache()
|
|
864
|
+
// exemption to DSL scope, #725): a read bakes-and-accepts, a Set-Cookie/header
|
|
865
|
+
// write drops-and-throws because it has no baked-copy semantics on a HIT.
|
|
866
|
+
if (isInsideAnyLoaderScope()) return false;
|
|
867
|
+
return true;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Check if the current execution is inside a DSL loader scope
|
|
872
|
+
* (wrapped by runInsideLoaderScope). Used by rendered() barrier
|
|
873
|
+
* to distinguish DSL loaders from handler-invoked loaders.
|
|
874
|
+
*/
|
|
875
|
+
export function isInsideLoaderScope(): boolean {
|
|
876
|
+
return loaderScopeALS.getStore()?.active === true;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Latch the cached header-write scope for the current request. First latch
|
|
881
|
+
* wins: a ppr route latched at the funnel top is not downgraded by a nested
|
|
882
|
+
* cache() entry (the document-scoped wording is the more useful one).
|
|
883
|
+
* Takes scalars so the already-latched path allocates nothing.
|
|
884
|
+
*/
|
|
885
|
+
export function latchCachedHeaderScope(
|
|
886
|
+
kind: CachedHeaderScope["kind"],
|
|
887
|
+
routeKey?: string,
|
|
888
|
+
): void {
|
|
889
|
+
const store = RangoContext.getStore();
|
|
890
|
+
if (store && !store.cachedHeaderScope) {
|
|
891
|
+
store.cachedHeaderScope = { kind, routeKey };
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/** True inside ANY loader execution — DSL loader scope or a loader body
|
|
896
|
+
* (however invoked). The "loaders always re-run fresh" exemptions key off
|
|
897
|
+
* this. */
|
|
898
|
+
function isInsideAnyLoaderScope(): boolean {
|
|
899
|
+
return (
|
|
900
|
+
loaderScopeALS.getStore()?.active === true ||
|
|
901
|
+
loaderBodyScopeALS.getStore()?.active === true
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* The one ppr opt-in predicate: a page route entry that DECLARED `ppr`
|
|
907
|
+
* (`false` and undefined mean plain axis 1). Shared by the serve path
|
|
908
|
+
* (rsc/shell-serve.ts resolvePprConfig) and the header-write latch below so
|
|
909
|
+
* the two layers can never drift on what counts as a ppr route.
|
|
910
|
+
*/
|
|
911
|
+
export function isPprEntry(entry: EntryData): entry is EntryData & {
|
|
912
|
+
type: "route";
|
|
913
|
+
ppr: true | import("../urls/pattern-types.js").PartialPrerenderProps;
|
|
914
|
+
} {
|
|
915
|
+
return (
|
|
916
|
+
entry.type === "route" && entry.ppr !== undefined && entry.ppr !== false
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Latch the ppr header-write scope when the entry chain about to resolve is a
|
|
922
|
+
* `ppr` page route's. Called at the TOP of every segment funnel — unlike
|
|
923
|
+
* cache() (positional: ancestors before the boundary stay writable), ppr is
|
|
924
|
+
* document-scoped: the root layout down to the page bakes into the shared
|
|
925
|
+
* shell, so the whole funnel is cached territory.
|
|
926
|
+
*
|
|
927
|
+
* Checks the LEAF entry only: `entries` is the traverseBack chain
|
|
928
|
+
* [root, ..., manifestEntry], and the serve path reads `ppr` off the same
|
|
929
|
+
* leaf (rsc-rendering.ts: resolvePprConfig(manifestEntry)) — guard and serve
|
|
930
|
+
* share the predicate (isPprEntry) AND the input, so they cannot drift.
|
|
931
|
+
*/
|
|
932
|
+
export function latchPprHeaderScopeForEntries(
|
|
933
|
+
entries: EntryData[],
|
|
934
|
+
routeKey?: string,
|
|
935
|
+
): void {
|
|
936
|
+
const store = RangoContext.getStore();
|
|
937
|
+
if (!store || store.cachedHeaderScope) return;
|
|
938
|
+
const leaf = entries[entries.length - 1];
|
|
939
|
+
if (leaf !== undefined && isPprEntry(leaf)) {
|
|
940
|
+
store.cachedHeaderScope = { kind: "ppr", routeKey };
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Clear the ppr header-write latch for the remainder of this render (issue
|
|
946
|
+
* #735). Called by ctx.dynamic(): a dynamic() render opts off the SHELL axis
|
|
947
|
+
* (rsc-rendering.ts skips both the HIT commit and the MISS capture on
|
|
948
|
+
* `_dynamic`), so it is ALWAYS live — every request re-runs the handler and its
|
|
949
|
+
* header write lands identically each time. The guard's reason to forbid it
|
|
950
|
+
* (MISS/HIT divergence) evaporates, so the write is re-permitted.
|
|
951
|
+
*
|
|
952
|
+
* ONLY the ppr (shell) axis is dropped — dynamic() does NOT opt off the CACHE
|
|
953
|
+
* axis. Two cases:
|
|
954
|
+
* - Pure ppr funnel (no cache() boundary): clear the latch → writes re-permit.
|
|
955
|
+
* - ppr route nested under a cache() boundary: fresh.ts latches "ppr" at the
|
|
956
|
+
* funnel top (first-wins), which MASKS the positional cache() latch, but the
|
|
957
|
+
* handler still runs inside the cache scope (`insideCacheScope`). A cache()
|
|
958
|
+
* HIT skips that handler, so the write is still non-deterministic — UNMASK to
|
|
959
|
+
* "cache" instead of clearing, so the guard keeps throwing (accurate cache()
|
|
960
|
+
* wording). This is why the check keys off `insideCacheScope`, not just kind.
|
|
961
|
+
*
|
|
962
|
+
* A subsequent cache() entered AFTER dynamic() on a pure-ppr funnel re-latches
|
|
963
|
+
* "cache" via latchCachedHeaderScope's `!store.cachedHeaderScope` guard (the
|
|
964
|
+
* field is undefined again once cleared). No-op when there is no funnel store or
|
|
965
|
+
* no ppr latch (dynamic() from middleware runs outside the funnel Store.run
|
|
966
|
+
* scope, so nothing is latched — the middleware exemption is unchanged).
|
|
967
|
+
*/
|
|
968
|
+
export function clearPprHeaderScope(): void {
|
|
969
|
+
const store = RangoContext.getStore();
|
|
970
|
+
if (store?.cachedHeaderScope?.kind !== "ppr") return;
|
|
971
|
+
store.cachedHeaderScope = store.insideCacheScope
|
|
972
|
+
? { kind: "cache", routeKey: store.cachedHeaderScope.routeKey }
|
|
973
|
+
: undefined;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* RULE (issue #713): in any cached scenario ONLY MIDDLEWARE writes response
|
|
978
|
+
* headers — handler and loader writes throw while a scope is latched; the one
|
|
979
|
+
* exemption is DSL (registered) loaders under plain cache(). A handler-invoked
|
|
980
|
+
* loader body (ctx.use from a handler, never registered with loader()) is
|
|
981
|
+
* skipped with its handler on a HIT and throws like a handler write (#725).
|
|
982
|
+
* A ctx.dynamic() render clears the ppr latch (clearPprHeaderScope, #735) so
|
|
983
|
+
* its always-live handler header writes are re-permitted. Full layer rules and
|
|
984
|
+
* rationale: docs/design/ppr-shell-resume.md "The header doctrine".
|
|
985
|
+
*/
|
|
986
|
+
export function assertCachedHeaderWriteAllowed(
|
|
987
|
+
surface: string,
|
|
988
|
+
surfaceProp?: string | symbol,
|
|
989
|
+
): void {
|
|
990
|
+
const scope = RangoContext.getStore()?.cachedHeaderScope;
|
|
991
|
+
if (!scope) return;
|
|
992
|
+
// Exempt DSL loaders (loaderScopeALS) ONLY. A registered loader re-runs on
|
|
993
|
+
// every cache HIT (fresh.ts runInsideLoaderScope -> cache-lookup.ts
|
|
994
|
+
// resolveLoadersOnly), so its header/cookie writes merge into every response
|
|
995
|
+
// with no MISS/HIT divergence. A handler-invoked loader body has
|
|
996
|
+
// loaderBodyScopeALS active but loaderScopeALS unset (loader-resolution.ts
|
|
997
|
+
// derives isDslLoader from isInsideLoaderScope()); on a HIT the handler is
|
|
998
|
+
// skipped so that loader never re-runs and its write would land only on the
|
|
999
|
+
// MISS — throw it. isInsideLoaderScope() (not isInsideAnyLoaderScope) is the
|
|
1000
|
+
// discriminator; the DSL scope ALS survives nested ctx.use bodies, so a
|
|
1001
|
+
// handler-invoked loader nested under a DSL loader stays exempt (its DSL
|
|
1002
|
+
// parent re-invokes it on every HIT). This is the exempt fast path, so the
|
|
1003
|
+
// broad predicate for the error label is deferred to the throw path below.
|
|
1004
|
+
if (scope.kind === "cache" && isInsideLoaderScope()) return;
|
|
1005
|
+
// Everything below runs only on the throw path — `surfaceProp` exists so
|
|
1006
|
+
// callers pass constants and the success path allocates nothing (the full
|
|
1007
|
+
// surface, e.g. "ctx.headers.set()", is assembled here). isInsideAnyLoaderScope
|
|
1008
|
+
// (broad) labels a now-throwing handler-invoked loader body "loader".
|
|
1009
|
+
const fullSurface =
|
|
1010
|
+
surfaceProp === undefined ? surface : `${surface}.${String(surfaceProp)}()`;
|
|
1011
|
+
const layer = isInsideAnyLoaderScope() ? "loader" : "handler";
|
|
1012
|
+
const route = scope.routeKey ? ` (route "${scope.routeKey}")` : "";
|
|
1013
|
+
const where =
|
|
1014
|
+
scope.kind === "ppr"
|
|
1015
|
+
? `on a ppr route${route} — the document shell is cached and replayed`
|
|
1016
|
+
: `inside a cache() boundary${route}`;
|
|
1017
|
+
// ppr loader writes fail by physics (headers flush before loaders settle);
|
|
1018
|
+
// every other throw — a handler, or a handler-invoked loader under cache() —
|
|
1019
|
+
// fails because the handler is skipped on a HIT, so key the reason on the
|
|
1020
|
+
// scope kind, not the layer.
|
|
1021
|
+
const why =
|
|
1022
|
+
scope.kind === "ppr" && layer === "loader"
|
|
1023
|
+
? "The response headers flush with the shell before loaders settle, so this write is dropped on cache hits."
|
|
1024
|
+
: "On a cache hit the handler is skipped, so this write would silently vanish.";
|
|
1025
|
+
throw new Error(
|
|
1026
|
+
`${fullSurface} cannot be called from a ${layer} ${where}. ${why} ` +
|
|
1027
|
+
"Set response headers in route middleware instead — middleware runs " +
|
|
1028
|
+
"on every request, including cache hits.",
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Run `fn` inside a loader scope. While active, cache-scope guards
|
|
1034
|
+
* are bypassed because loaders are always fresh (never cached) and
|
|
1035
|
+
* their side effects (setCookie, header, etc.) are safe.
|
|
1036
|
+
*/
|
|
1037
|
+
export function runInsideLoaderScope<T>(fn: () => T): T {
|
|
1038
|
+
return loaderScopeALS.run({ active: true }, fn);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Run `fn` inside a loader BODY scope. Marks loader-function execution for the
|
|
1043
|
+
* cache-purity guard only (isInsideCacheScope), WITHOUT affecting
|
|
1044
|
+
* isInsideLoaderScope()/rendered() gating. Applied to every loader body (DSL
|
|
1045
|
+
* and handler-invoked via ctx.use) so request-scoped reads inside a loader
|
|
1046
|
+
* never trip the cache-scope guards — loaders always run fresh.
|
|
1047
|
+
*/
|
|
1048
|
+
export function runInsideLoaderBodyScope<T>(
|
|
1049
|
+
fn: () => T,
|
|
1050
|
+
loaderId?: string,
|
|
1051
|
+
handlerInvoked?: boolean,
|
|
1052
|
+
): T {
|
|
1053
|
+
return loaderBodyScopeALS.run({ active: true, loaderId, handlerInvoked }, fn);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* The $$id of the loader whose body is currently executing, or undefined
|
|
1058
|
+
* outside any loader body. Used by the shell-capture identity guard
|
|
1059
|
+
* (cookie-store.ts) so its refusal warning can name the loader that read
|
|
1060
|
+
* cookies()/headers() instead of blaming a lane it cannot see — the old
|
|
1061
|
+
* hardcoded "bake-lane loader" text misled a live-lane debugging session
|
|
1062
|
+
* (issue #672, secondary).
|
|
1063
|
+
*/
|
|
1064
|
+
export function getCurrentLoaderBodyId(): string | undefined {
|
|
1065
|
+
return loaderBodyScopeALS.getStore()?.loaderId;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* True while a HANDLER-invoked loader body (`await ctx.use(Loader)` from a
|
|
1070
|
+
* handler, not the DSL segment funnel) is executing. The consumption-lane
|
|
1071
|
+
* rule keys off this: handler consumption yields a BAKED copy in every shared
|
|
1072
|
+
* artifact — cache(), "use cache", and the PPR shell — so the shell-capture
|
|
1073
|
+
* identity guard (cookie-store.ts) permits cookies()/headers() here, exactly
|
|
1074
|
+
* like the cache-purity guards do. DSL segment loaders (live lane masked at
|
|
1075
|
+
* capture, bake lane guarded) never set the flag.
|
|
1076
|
+
*/
|
|
1077
|
+
export function isInsideHandlerInvokedLoaderBody(): boolean {
|
|
1078
|
+
return loaderBodyScopeALS.getStore()?.handlerInvoked === true;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
// Scope for handle PUSH CALLBACKS (push(() => ...), including async ones).
|
|
1082
|
+
// A push callback's value is stored as-is; if it is a promise it is NOT tracked
|
|
1083
|
+
// by handleStore.settled and does not block segment resolution, so a
|
|
1084
|
+
// ctx.use(loader) made from inside such a callback can never form a rendered()
|
|
1085
|
+
// deadlock. This is an ALS (not a plain boolean) so the exemption survives the
|
|
1086
|
+
// callback's own awaits — an async push callback that resumes after `await`
|
|
1087
|
+
// still reads as "inside a push callback" and stays out of the deadlock guard.
|
|
1088
|
+
const PUSH_CALLBACK_SCOPE_KEY = Symbol.for(
|
|
1089
|
+
"rangojs-router:push-callback-scope",
|
|
1090
|
+
);
|
|
1091
|
+
const pushCallbackScopeALS: AsyncLocalStorage<{ active: true }> = ((
|
|
1092
|
+
globalThis as any
|
|
1093
|
+
)[PUSH_CALLBACK_SCOPE_KEY] ??= new AsyncLocalStorage<{ active: true }>());
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Check if the current execution is inside a handle push callback (sync or an
|
|
1097
|
+
* async callback's continuation). Used by the handler-to-loader deadlock guard
|
|
1098
|
+
* to exempt push-callback continuations.
|
|
1099
|
+
*/
|
|
1100
|
+
export function isInsidePushCallbackScope(): boolean {
|
|
1101
|
+
return pushCallbackScopeALS.getStore()?.active === true;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Run `fn` inside a push-callback scope. Wraps the invocation of a handle push
|
|
1106
|
+
* callback so that any ctx.use(loader) it makes — including after one of its own
|
|
1107
|
+
* awaits — is exempt from the deadlock guard.
|
|
1108
|
+
*/
|
|
1109
|
+
export function runInsidePushCallbackScope<T>(fn: () => T): T {
|
|
1110
|
+
return pushCallbackScopeALS.run({ active: true }, fn);
|
|
1111
|
+
}
|