@rangojs/router 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/types/browser/event-controller.d.ts +6 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +8 -1
- package/dist/types/cache/cf/cf-cache-store.d.ts +15 -1
- package/dist/types/cache/cf/cf-cache-types.d.ts +1 -1
- package/dist/types/cache/cf/cf-kv-utils.d.ts +21 -0
- package/dist/types/handles/is-thenable.d.ts +2 -4
- package/dist/types/rsc/helpers.d.ts +3 -0
- package/dist/types/rsc/render-pipeline.d.ts +9 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +17 -0
- package/dist/types/server/request-context.d.ts +4 -1
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +10 -0
- package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
- package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
- package/dist/types/vite/utils/shared-utils.d.ts +12 -0
- package/dist/vite/index.js +154 -57
- package/package.json +3 -3
- package/skills/caching/SKILL.md +1 -1
- package/skills/mime-routes/SKILL.md +3 -1
- package/skills/response-routes/SKILL.md +4 -2
- package/skills/typesafety/generated-files-and-cli.md +16 -9
- package/skills/typesafety/route-types.md +5 -1
- package/skills/use-cache/SKILL.md +47 -0
- package/src/browser/event-controller.ts +40 -15
- package/src/browser/partial-update.ts +26 -11
- package/src/browser/react/NavigationProvider.tsx +7 -0
- package/src/cache/cache-runtime.ts +89 -15
- package/src/cache/cf/cf-cache-constants.ts +8 -1
- package/src/cache/cf/cf-cache-store.ts +41 -64
- package/src/cache/cf/cf-cache-types.ts +1 -1
- package/src/cache/cf/cf-kv-utils.ts +38 -0
- package/src/cache/segment-codec.ts +21 -5
- package/src/handles/is-thenable.ts +2 -4
- package/src/router/match-middleware/cache-lookup.ts +24 -15
- package/src/rsc/handler.ts +26 -5
- package/src/rsc/helpers.ts +13 -0
- package/src/rsc/progressive-enhancement.ts +247 -70
- package/src/rsc/render-pipeline.ts +68 -24
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +555 -302
- package/src/rsc/server-action.ts +180 -71
- package/src/rsc/shell-capture-constants.ts +18 -0
- package/src/rsc/shell-capture.ts +92 -21
- package/src/server/request-context.ts +6 -0
- package/src/ssr/ssr-root.tsx +1 -0
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/plugins/expose-action-id.ts +2 -2
- package/src/vite/plugins/expose-internal-ids.ts +46 -0
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/rango.ts +9 -0
- package/src/vite/router-discovery.ts +21 -2
- package/src/vite/utils/shared-utils.ts +12 -7
- package/dist/types.backup/__internal.d.ts +0 -127
- package/dist/types.backup/bin/rango.d.ts +0 -1
- package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
- package/dist/types.backup/browser/action-fence.d.ts +0 -33
- package/dist/types.backup/browser/app-shell.d.ts +0 -34
- package/dist/types.backup/browser/app-version.d.ts +0 -6
- package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
- package/dist/types.backup/browser/cookie-name.d.ts +0 -66
- package/dist/types.backup/browser/event-controller.d.ts +0 -221
- package/dist/types.backup/browser/history-state.d.ts +0 -26
- package/dist/types.backup/browser/index.d.ts +0 -1
- package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
- package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
- package/dist/types.backup/browser/logging.d.ts +0 -33
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
- package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
- package/dist/types.backup/browser/navigation-client.d.ts +0 -17
- package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
- package/dist/types.backup/browser/navigation-store.d.ts +0 -95
- package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
- package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
- package/dist/types.backup/browser/partial-update.d.ts +0 -61
- package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
- package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
- package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
- package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
- package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
- package/dist/types.backup/browser/rango-state.d.ts +0 -52
- package/dist/types.backup/browser/react/Link.d.ts +0 -140
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
- package/dist/types.backup/browser/react/context.d.ts +0 -54
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
- package/dist/types.backup/browser/react/index.d.ts +0 -1
- package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
- package/dist/types.backup/browser/react/location-state.d.ts +0 -29
- package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
- package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
- package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
- package/dist/types.backup/browser/react/use-action.d.ts +0 -61
- package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
- package/dist/types.backup/browser/react/use-href.d.ts +0 -32
- package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
- package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
- package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
- package/dist/types.backup/browser/react/use-params.d.ts +0 -21
- package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
- package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
- package/dist/types.backup/browser/react/use-router.d.ts +0 -23
- package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
- package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
- package/dist/types.backup/browser/response-adapter.d.ts +0 -58
- package/dist/types.backup/browser/rsc-router.d.ts +0 -141
- package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
- package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
- package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
- package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
- package/dist/types.backup/browser/types.d.ts +0 -530
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
- package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
- package/dist/types.backup/build/generate-manifest.d.ts +0 -100
- package/dist/types.backup/build/generate-route-types.d.ts +0 -8
- package/dist/types.backup/build/index.d.ts +0 -21
- package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
- package/dist/types.backup/build/route-trie.d.ts +0 -89
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
- package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
- package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
- package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
- package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
- package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
- package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
- package/dist/types.backup/cache/background-task.d.ts +0 -21
- package/dist/types.backup/cache/cache-error.d.ts +0 -71
- package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
- package/dist/types.backup/cache/cache-policy.d.ts +0 -59
- package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
- package/dist/types.backup/cache/cache-scope.d.ts +0 -134
- package/dist/types.backup/cache/cache-tag.d.ts +0 -79
- package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
- package/dist/types.backup/cache/cf/index.d.ts +0 -3
- package/dist/types.backup/cache/document-cache.d.ts +0 -69
- package/dist/types.backup/cache/handle-capture.d.ts +0 -23
- package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
- package/dist/types.backup/cache/index.d.ts +0 -7
- package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
- package/dist/types.backup/cache/profile-registry.d.ts +0 -40
- package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
- package/dist/types.backup/cache/segment-codec.d.ts +0 -78
- package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
- package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
- package/dist/types.backup/cache/taint.d.ts +0 -71
- package/dist/types.backup/cache/types.d.ts +0 -407
- package/dist/types.backup/cache/vercel/index.d.ts +0 -1
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
- package/dist/types.backup/client.d.ts +0 -184
- package/dist/types.backup/client.rsc.d.ts +0 -39
- package/dist/types.backup/cloudflare/index.d.ts +0 -7
- package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
- package/dist/types.backup/component-utils.d.ts +0 -46
- package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
- package/dist/types.backup/context-var.d.ts +0 -84
- package/dist/types.backup/debug.d.ts +0 -57
- package/dist/types.backup/decode-loader-results.d.ts +0 -5
- package/dist/types.backup/default-error-boundary.d.ts +0 -10
- package/dist/types.backup/defer.d.ts +0 -89
- package/dist/types.backup/deps/browser.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
- package/dist/types.backup/deps/rsc.d.ts +0 -1
- package/dist/types.backup/deps/ssr.d.ts +0 -1
- package/dist/types.backup/encode-kv.d.ts +0 -35
- package/dist/types.backup/errors.d.ts +0 -226
- package/dist/types.backup/escape-script.d.ts +0 -44
- package/dist/types.backup/handle.d.ts +0 -93
- package/dist/types.backup/handles/MetaTags.d.ts +0 -17
- package/dist/types.backup/handles/Scripts.d.ts +0 -38
- package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
- package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
- package/dist/types.backup/handles/is-thenable.d.ts +0 -12
- package/dist/types.backup/handles/meta.d.ts +0 -43
- package/dist/types.backup/handles/script.d.ts +0 -139
- package/dist/types.backup/host/cookie-handler.d.ts +0 -8
- package/dist/types.backup/host/errors.d.ts +0 -40
- package/dist/types.backup/host/index.d.ts +0 -33
- package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
- package/dist/types.backup/host/router.d.ts +0 -12
- package/dist/types.backup/host/testing.d.ts +0 -41
- package/dist/types.backup/host/types.d.ts +0 -148
- package/dist/types.backup/host/utils.d.ts +0 -20
- package/dist/types.backup/href-client.d.ts +0 -214
- package/dist/types.backup/index.d.ts +0 -112
- package/dist/types.backup/index.rsc.d.ts +0 -51
- package/dist/types.backup/internal-debug.d.ts +0 -1
- package/dist/types.backup/loader-store.d.ts +0 -193
- package/dist/types.backup/loader.d.ts +0 -18
- package/dist/types.backup/loader.rsc.d.ts +0 -18
- package/dist/types.backup/missing-id-error.d.ts +0 -1
- package/dist/types.backup/outlet-context.d.ts +0 -12
- package/dist/types.backup/outlet-provider.d.ts +0 -12
- package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
- package/dist/types.backup/prerender/param-hash.d.ts +0 -6
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
- package/dist/types.backup/prerender/store.d.ts +0 -62
- package/dist/types.backup/prerender.d.ts +0 -292
- package/dist/types.backup/redirect-origin.d.ts +0 -55
- package/dist/types.backup/regex-escape.d.ts +0 -6
- package/dist/types.backup/render-error-thrower.d.ts +0 -13
- package/dist/types.backup/response-utils.d.ts +0 -35
- package/dist/types.backup/reverse.d.ts +0 -206
- package/dist/types.backup/root-error-boundary.d.ts +0 -32
- package/dist/types.backup/route-content-wrapper.d.ts +0 -40
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
- package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
- package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
- package/dist/types.backup/route-definition/index.d.ts +0 -7
- package/dist/types.backup/route-definition/redirect.d.ts +0 -48
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
- package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
- package/dist/types.backup/route-definition.d.ts +0 -1
- package/dist/types.backup/route-map-builder.d.ts +0 -127
- package/dist/types.backup/route-name.d.ts +0 -27
- package/dist/types.backup/route-types.d.ts +0 -172
- package/dist/types.backup/router/basename.d.ts +0 -10
- package/dist/types.backup/router/content-negotiation.d.ts +0 -91
- package/dist/types.backup/router/debug-manifest.d.ts +0 -7
- package/dist/types.backup/router/error-handling.d.ts +0 -76
- package/dist/types.backup/router/find-match.d.ts +0 -19
- package/dist/types.backup/router/handler-context.d.ts +0 -41
- package/dist/types.backup/router/instrument.d.ts +0 -161
- package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
- package/dist/types.backup/router/lazy-includes.d.ts +0 -26
- package/dist/types.backup/router/loader-resolution.d.ts +0 -63
- package/dist/types.backup/router/logging.d.ts +0 -41
- package/dist/types.backup/router/manifest.d.ts +0 -8
- package/dist/types.backup/router/match-api.d.ts +0 -19
- package/dist/types.backup/router/match-context.d.ts +0 -184
- package/dist/types.backup/router/match-handlers.d.ts +0 -49
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
- package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
- package/dist/types.backup/router/match-pipelines.d.ts +0 -103
- package/dist/types.backup/router/match-result.d.ts +0 -114
- package/dist/types.backup/router/metrics.d.ts +0 -6
- package/dist/types.backup/router/middleware-types.d.ts +0 -74
- package/dist/types.backup/router/middleware.d.ts +0 -116
- package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
- package/dist/types.backup/router/params-util.d.ts +0 -8
- package/dist/types.backup/router/parse-pattern.d.ts +0 -38
- package/dist/types.backup/router/pattern-matching.d.ts +0 -169
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
- package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
- package/dist/types.backup/router/prerender-match.d.ts +0 -50
- package/dist/types.backup/router/preview-match.d.ts +0 -22
- package/dist/types.backup/router/request-classification.d.ts +0 -104
- package/dist/types.backup/router/revalidation.d.ts +0 -57
- package/dist/types.backup/router/route-snapshot.d.ts +0 -112
- package/dist/types.backup/router/router-context.d.ts +0 -137
- package/dist/types.backup/router/router-interfaces.d.ts +0 -432
- package/dist/types.backup/router/router-options.d.ts +0 -738
- package/dist/types.backup/router/router-registry.d.ts +0 -15
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
- package/dist/types.backup/router/segment-resolution.d.ts +0 -3
- package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
- package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
- package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
- package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
- package/dist/types.backup/router/telemetry.d.ts +0 -215
- package/dist/types.backup/router/timeout.d.ts +0 -68
- package/dist/types.backup/router/tracing.d.ts +0 -125
- package/dist/types.backup/router/trie-matching.d.ts +0 -32
- package/dist/types.backup/router/types.d.ts +0 -98
- package/dist/types.backup/router/url-params.d.ts +0 -26
- package/dist/types.backup/router.d.ts +0 -7
- package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
- package/dist/types.backup/rsc/full-payload.d.ts +0 -22
- package/dist/types.backup/rsc/handler-context.d.ts +0 -31
- package/dist/types.backup/rsc/handler.d.ts +0 -9
- package/dist/types.backup/rsc/helpers.d.ts +0 -213
- package/dist/types.backup/rsc/index.d.ts +0 -17
- package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
- package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
- package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
- package/dist/types.backup/rsc/nonce.d.ts +0 -28
- package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
- package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
- package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
- package/dist/types.backup/rsc/response-error.d.ts +0 -19
- package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
- package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
- package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
- package/dist/types.backup/rsc/server-action.d.ts +0 -68
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
- package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
- package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
- package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
- package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
- package/dist/types.backup/rsc/types.d.ts +0 -290
- package/dist/types.backup/runtime-env.d.ts +0 -1
- package/dist/types.backup/search-params.d.ts +0 -125
- package/dist/types.backup/segment-content-promise.d.ts +0 -13
- package/dist/types.backup/segment-fragments.d.ts +0 -56
- package/dist/types.backup/segment-loader-promise.d.ts +0 -22
- package/dist/types.backup/segment-system.d.ts +0 -84
- package/dist/types.backup/serialize.d.ts +0 -164
- package/dist/types.backup/server/context.d.ts +0 -494
- package/dist/types.backup/server/cookie-parse.d.ts +0 -10
- package/dist/types.backup/server/cookie-store.d.ts +0 -107
- package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
- package/dist/types.backup/server/handle-store.d.ts +0 -100
- package/dist/types.backup/server/loader-registry.d.ts +0 -32
- package/dist/types.backup/server/request-context.d.ts +0 -596
- package/dist/types.backup/server/root-layout.d.ts +0 -3
- package/dist/types.backup/server.d.ts +0 -15
- package/dist/types.backup/ssr/index.d.ts +0 -233
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
- package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
- package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
- package/dist/types.backup/static-handler.d.ts +0 -57
- package/dist/types.backup/testing/cache-status.d.ts +0 -63
- package/dist/types.backup/testing/collect-handle.d.ts +0 -20
- package/dist/types.backup/testing/dispatch.d.ts +0 -123
- package/dist/types.backup/testing/dom.entry.d.ts +0 -15
- package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
- package/dist/types.backup/testing/e2e/index.d.ts +0 -30
- package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
- package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
- package/dist/types.backup/testing/e2e/server.d.ts +0 -35
- package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
- package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
- package/dist/types.backup/testing/flight-tree.d.ts +0 -192
- package/dist/types.backup/testing/flight.d.ts +0 -115
- package/dist/types.backup/testing/flight.entry.d.ts +0 -27
- package/dist/types.backup/testing/generated-routes.d.ts +0 -66
- package/dist/types.backup/testing/index.d.ts +0 -52
- package/dist/types.backup/testing/internal/context.d.ts +0 -225
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
- package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
- package/dist/types.backup/testing/render-handler.d.ts +0 -160
- package/dist/types.backup/testing/render-route.d.ts +0 -246
- package/dist/types.backup/testing/run-loader.d.ts +0 -186
- package/dist/types.backup/testing/run-middleware.d.ts +0 -132
- package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
- package/dist/types.backup/testing/vitest.d.ts +0 -205
- package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
- package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
- package/dist/types.backup/theme/constants.d.ts +0 -39
- package/dist/types.backup/theme/index.d.ts +0 -29
- package/dist/types.backup/theme/theme-context.d.ts +0 -21
- package/dist/types.backup/theme/theme-script.d.ts +0 -26
- package/dist/types.backup/theme/types.d.ts +0 -162
- package/dist/types.backup/theme/use-theme.d.ts +0 -8
- package/dist/types.backup/types/boundaries.d.ts +0 -93
- package/dist/types.backup/types/cache-types.d.ts +0 -191
- package/dist/types.backup/types/error-types.d.ts +0 -114
- package/dist/types.backup/types/global-namespace.d.ts +0 -90
- package/dist/types.backup/types/handler-context.d.ts +0 -658
- package/dist/types.backup/types/index.d.ts +0 -11
- package/dist/types.backup/types/loader-types.d.ts +0 -182
- package/dist/types.backup/types/request-scope.d.ts +0 -93
- package/dist/types.backup/types/route-config.d.ts +0 -105
- package/dist/types.backup/types/route-entry.d.ts +0 -95
- package/dist/types.backup/types/segments.d.ts +0 -234
- package/dist/types.backup/types.d.ts +0 -1
- package/dist/types.backup/urls/include-helper.d.ts +0 -17
- package/dist/types.backup/urls/include-provider.d.ts +0 -27
- package/dist/types.backup/urls/index.d.ts +0 -6
- package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
- package/dist/types.backup/urls/path-helper.d.ts +0 -12
- package/dist/types.backup/urls/pattern-types.d.ts +0 -166
- package/dist/types.backup/urls/response-types.d.ts +0 -67
- package/dist/types.backup/urls/type-extraction.d.ts +0 -157
- package/dist/types.backup/urls/urls-function.d.ts +0 -24
- package/dist/types.backup/urls.d.ts +0 -1
- package/dist/types.backup/use-loader.d.ts +0 -150
- package/dist/types.backup/vercel/index.d.ts +0 -10
- package/dist/types.backup/vercel/tracing.d.ts +0 -70
- package/dist/types.backup/vite/debug.d.ts +0 -80
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
- package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
- package/dist/types.backup/vite/discovery/state.d.ts +0 -162
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
- package/dist/types.backup/vite/index.d.ts +0 -11
- package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
- package/dist/types.backup/vite/plugin-types.d.ts +0 -298
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
- package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
- package/dist/types.backup/vite/rango.d.ts +0 -29
- package/dist/types.backup/vite/router-discovery.d.ts +0 -23
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
- package/dist/types.backup/vite/utils/banner.d.ts +0 -2
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
- package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
- package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
- package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
package/README.md
CHANGED
|
@@ -439,10 +439,14 @@ For response-aware and path-based utilities (`href()`, `Rango.Path`,
|
|
|
439
439
|
// router.tsx
|
|
440
440
|
const router = createRouter<AppBindings>({}).routes(urlpatterns);
|
|
441
441
|
|
|
442
|
+
// The alias is required: an interface heritage clause cannot take a `typeof`
|
|
443
|
+
// type query directly (TS1109), so extend through a named alias.
|
|
444
|
+
type AppRoutes = typeof router.routeMap;
|
|
445
|
+
|
|
442
446
|
declare global {
|
|
443
447
|
namespace Rango {
|
|
444
448
|
interface Env extends AppEnv {}
|
|
445
|
-
interface RegisteredRoutes extends
|
|
449
|
+
interface RegisteredRoutes extends AppRoutes {}
|
|
446
450
|
}
|
|
447
451
|
}
|
|
448
452
|
```
|
|
@@ -180,6 +180,12 @@ export interface EventController {
|
|
|
180
180
|
subscribe(listener: StateListener): () => void;
|
|
181
181
|
subscribeToAction(actionId: string, listener: ActionStateListener): () => void;
|
|
182
182
|
subscribeToHandles(listener: HandleListener): () => void;
|
|
183
|
+
/**
|
|
184
|
+
* Deliver queued location, params, navigation, and handle notifications now.
|
|
185
|
+
* NavigationProvider calls this inside the payload update so React assigns
|
|
186
|
+
* every route-state hook update to the same normal or transition lane.
|
|
187
|
+
*/
|
|
188
|
+
flushRouteState(): void;
|
|
183
189
|
setHandleData(data: HandleData, matched?: string[], isPartial?: boolean,
|
|
184
190
|
/**
|
|
185
191
|
* Segment ids that were re-resolved on the server this request (the
|
|
@@ -65,8 +65,15 @@ export declare const MAX_REVALIDATION_INTERVAL = 30;
|
|
|
65
65
|
*
|
|
66
66
|
* This is the default; override per store via
|
|
67
67
|
* `CFCacheStoreOptions.edgeLookupTimeoutMs` (<= 0 disables the budget).
|
|
68
|
+
*
|
|
69
|
+
* 25ms, raised from 10: production Workers logs (autobarn pilot) showed the
|
|
70
|
+
* 10ms budget firing frequently on cold colos where the first Cache API touch
|
|
71
|
+
* is slow but healthy — each false positive downgrades a warm L1 HIT to an
|
|
72
|
+
* L2/render round trip that costs far more than the 15ms of extra patience.
|
|
73
|
+
* A genuinely degraded colo still gets cut off; tune per store for
|
|
74
|
+
* shell-critical routes.
|
|
68
75
|
*/
|
|
69
|
-
export declare const EDGE_LOOKUP_TIMEOUT_MS =
|
|
76
|
+
export declare const EDGE_LOOKUP_TIMEOUT_MS = 25;
|
|
70
77
|
/**
|
|
71
78
|
* Maximum time (ms) to wait for the BODY of a matched L1 entry to be read
|
|
72
79
|
* (response.json()) before treating the read as a miss.
|
|
@@ -302,6 +302,19 @@ export declare class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<T
|
|
|
302
302
|
/**
|
|
303
303
|
* Convert string key to KV key string.
|
|
304
304
|
* Uses same version prefix as Cache API for consistent invalidation.
|
|
305
|
+
*
|
|
306
|
+
* Single chokepoint for EVERY KV family (segments, items, shells, documents
|
|
307
|
+
* via toDocKVKey, tag markers via tagMarkerKey): a composed key over
|
|
308
|
+
* Cloudflare KV's 512-byte limit is normalized to a preserved readable
|
|
309
|
+
* prefix plus a SHA-256-derived 128-bit digest of the FULL key. Without
|
|
310
|
+
* this, kv.put/get reject with `414 ... exceeds key length limit of 512`
|
|
311
|
+
* and the entry silently never reaches L2 (observed in production for
|
|
312
|
+
* "use cache" items whose serialized args — e.g. a CMS query object — blow
|
|
313
|
+
* the cap; autobarn pilot). Keys are opaque storage identifiers, so
|
|
314
|
+
* normalization is semantics-preserving as long as distinct logical keys
|
|
315
|
+
* stay distinct: colliding requires an identical 400-byte prefix AND a
|
|
316
|
+
* 128-bit SHA-256 collision. Deterministic, so every family's read, write,
|
|
317
|
+
* and delete paths agree on the stored key.
|
|
305
318
|
* @internal
|
|
306
319
|
*/
|
|
307
320
|
private toKVKey;
|
|
@@ -546,7 +559,8 @@ export declare class CFCacheStore<TEnv = unknown> implements SegmentCacheStore<T
|
|
|
546
559
|
*
|
|
547
560
|
* Durable-write integrity: the in-memory write-through (memo + L1) for a tag
|
|
548
561
|
* runs ONLY after that tag's KV marker write is confirmed. If any KV write
|
|
549
|
-
* fails (transient error
|
|
562
|
+
* fails (transient error; over-limit keys are normalized by toKVKey rather
|
|
563
|
+
* than rejected), this rejects with the
|
|
550
564
|
* failed tags so an awaiting updateTag() surfaces the failure instead of
|
|
551
565
|
* silently reporting success while other requests/colos serve stale data. The
|
|
552
566
|
* eager purge still fires for the whole batch first (it is additive).
|
|
@@ -288,7 +288,7 @@ export interface CFCacheStoreOptions<TEnv = unknown> {
|
|
|
288
288
|
* cannot stall the request; the read then falls through to its normal miss
|
|
289
289
|
* path (L2/KV or render).
|
|
290
290
|
*
|
|
291
|
-
* Defaults to {@link EDGE_LOOKUP_TIMEOUT_MS} (
|
|
291
|
+
* Defaults to {@link EDGE_LOOKUP_TIMEOUT_MS} (25). Set to 0 (or any value
|
|
292
292
|
* <= 0) to disable the budget and always await `match`.
|
|
293
293
|
*/
|
|
294
294
|
edgeLookupTimeoutMs?: number;
|
|
@@ -9,6 +9,27 @@ export declare const KV_MAX_KEY_BYTES = 512;
|
|
|
9
9
|
export declare const KV_MIN_EXPIRATION_TTL = 60;
|
|
10
10
|
/** UTF-8 byte length of a KV key (multibyte tags can exceed the char count). */
|
|
11
11
|
export declare function kvKeyByteLength(key: string): number;
|
|
12
|
+
/**
|
|
13
|
+
* Bytes of a composed key preserved verbatim when an over-limit key is
|
|
14
|
+
* normalized (toKVKey). 400 leaves room for the `~` separator and the 32-hex
|
|
15
|
+
* digest inside KV_MAX_KEY_BYTES while keeping the version prefix and most of
|
|
16
|
+
* the logical key readable (and prefix-listable) in the KV dashboard.
|
|
17
|
+
*/
|
|
18
|
+
export declare const KV_KEY_PRESERVED_PREFIX_BYTES = 400;
|
|
19
|
+
/**
|
|
20
|
+
* Truncate to at most `maxBytes` of UTF-8. A multibyte sequence split at the
|
|
21
|
+
* boundary decodes to U+FFFD, which is stripped — the result is deterministic
|
|
22
|
+
* for a given input, which is all key normalization needs.
|
|
23
|
+
*/
|
|
24
|
+
export declare function truncateToBytes(value: string, maxBytes: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* 128-bit hex digest (SHA-256 truncated) of a composed KV key. WebCrypto is
|
|
27
|
+
* available on workerd and Node alike; SHA-256 (not a fast non-crypto hash)
|
|
28
|
+
* because cache keys embed user-influenced serialized args — an engineered
|
|
29
|
+
* collision between two normalized keys would serve one entry's payload for
|
|
30
|
+
* the other's.
|
|
31
|
+
*/
|
|
32
|
+
export declare function kvKeyDigest(value: string): Promise<string>;
|
|
12
33
|
/**
|
|
13
34
|
* Compute the Cache-Control directive for a stale-path REVALIDATING re-put from
|
|
14
35
|
* the entry's stored hard-expiry deadline (CACHE_EXPIRES_AT_HEADER). Returns the
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* handle entries are deferred (`Promise`) values to await before any consumer
|
|
5
|
-
* sees them, and which pass through verbatim.
|
|
2
|
+
* Shared thenable predicate for framework orchestration. It decides which values
|
|
3
|
+
* participate in promise lifecycles and which pass through synchronously.
|
|
6
4
|
*
|
|
7
5
|
* Requires a CALLABLE `then` (`typeof obj.then === "function"`), not merely a
|
|
8
6
|
* `"then" in obj` membership check, so a non-promise carrying a `then` field
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { RequestContext } from "../server/request-context.js";
|
|
7
7
|
import type { MiddlewareEntry, MiddlewareFn } from "../router/middleware.js";
|
|
8
8
|
import type { RscPayload } from "./types.js";
|
|
9
|
+
import type { HandlerContext } from "./handler-context.js";
|
|
9
10
|
/**
|
|
10
11
|
* Drain ctx._onResponseCallbacks onto a response. Swapping the array before
|
|
11
12
|
* iteration prevents re-entrant registrations from double-firing and matches
|
|
@@ -122,3 +123,5 @@ export declare function mergeStubHeadersAndFinalize(response: Response): Respons
|
|
|
122
123
|
* but still need ctx.onResponse() callbacks to fire.
|
|
123
124
|
*/
|
|
124
125
|
export declare function finalizeResponse(response: Response): Response;
|
|
126
|
+
/** Match and stamp params/routeName on the request context as one operation. */
|
|
127
|
+
export declare function matchAndRecordParams<TEnv>(ctx: HandlerContext<TEnv>, request: Request, env: TEnv): Promise<Awaited<ReturnType<HandlerContext<TEnv>["router"]["match"]>>>;
|
|
@@ -2,6 +2,7 @@ import type { TraceSpan } from "../router/tracing.js";
|
|
|
2
2
|
import type { RenderMode, RenderPhase } from "../router/timeout.js";
|
|
3
3
|
import type { HandlerContext } from "./handler-context.js";
|
|
4
4
|
import type { RscPayload } from "./types.js";
|
|
5
|
+
import type { RoutineTrace } from "./routine-plan.js";
|
|
5
6
|
export type RscRenderMode = RenderMode;
|
|
6
7
|
export type RscRenderPhase = RenderPhase;
|
|
7
8
|
export interface RscRenderStageProgress {
|
|
@@ -135,5 +136,13 @@ export declare function renderRscResponse<TEnv>(input: RscRenderInput<TEnv>, opt
|
|
|
135
136
|
* Standard responses use renderRscResponse so the driver owns every phase.
|
|
136
137
|
*/
|
|
137
138
|
export declare function renderRscFlightStage<TEnv>(input: RscFlightStageInput<TEnv>, init?: ResponseInit): RscFlightStage;
|
|
139
|
+
/**
|
|
140
|
+
* Feed this driver's stage events (flight/html/response) into a routine flow
|
|
141
|
+
* trace as child entries of the currently running plan step. Stages are
|
|
142
|
+
* strictly sequential, so one `current` slot suffices. Depth is captured at
|
|
143
|
+
* creation: the bridge is built while the caller's render step executes, so
|
|
144
|
+
* children sit one level under it.
|
|
145
|
+
*/
|
|
146
|
+
export declare function createRenderStageTraceBridge(trace: RoutineTrace): (event: RscRenderStageEvent) => void;
|
|
138
147
|
export declare function createRscStageDebugSink(log?: (message: string, details?: Record<string, unknown>) => void): (event: RscRenderStageEvent) => void;
|
|
139
148
|
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routine plans — the request-level extension of the render stage driver
|
|
3
|
+
* (docs/design/routine-plans.md; protocol lineage in render-stage-driver.md).
|
|
4
|
+
* A plan is a synchronous generator that EMITS instructions before their work
|
|
5
|
+
* runs; the runner is the only code that executes them. Two effect shapes:
|
|
6
|
+
*
|
|
7
|
+
* step(name, fn) — sequential work; the plan suspends until its result.
|
|
8
|
+
* handoff(name, fn) — background registration (waitUntil-shaped); completes
|
|
9
|
+
* at scheduling and returns nothing.
|
|
10
|
+
*
|
|
11
|
+
* Plans compose by level: `yield* scope(name, plan)` flattens a nested plan
|
|
12
|
+
* into the same instruction stream while the trace records the scope. Tracking
|
|
13
|
+
* is derived, not declared — "what is running" is the instruction in hand.
|
|
14
|
+
*
|
|
15
|
+
* Deliberate boundaries (see the design doc's "Not built yet, on purpose"):
|
|
16
|
+
* the runner opens no observability spans — effects own their own
|
|
17
|
+
* instrumentation, and the render driver keeps PHASES.ssr — and there is no
|
|
18
|
+
* plan.return abort/cleanup path; the render driver's cleanup rules are the
|
|
19
|
+
* template if a caller ever needs one.
|
|
20
|
+
*/
|
|
21
|
+
export type RoutineEffectKind = "step" | "handoff";
|
|
22
|
+
export type RoutineCommand = {
|
|
23
|
+
kind: "step";
|
|
24
|
+
name: string;
|
|
25
|
+
execute: () => unknown;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "handoff";
|
|
28
|
+
name: string;
|
|
29
|
+
execute: () => unknown;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "enter";
|
|
32
|
+
name: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "exit";
|
|
35
|
+
outcome: "done" | "failed";
|
|
36
|
+
error?: unknown;
|
|
37
|
+
};
|
|
38
|
+
export type RoutineCommandResult = {
|
|
39
|
+
kind: "step";
|
|
40
|
+
value: unknown;
|
|
41
|
+
} | {
|
|
42
|
+
kind: "handoff";
|
|
43
|
+
} | {
|
|
44
|
+
kind: "enter";
|
|
45
|
+
} | {
|
|
46
|
+
kind: "exit";
|
|
47
|
+
};
|
|
48
|
+
/** One imperative step: yields a command, returns its typed result. */
|
|
49
|
+
export type RoutineStep<T> = Generator<RoutineCommand, T, RoutineCommandResult>;
|
|
50
|
+
/** A full plan is shaped like a step; the alias marks intent at call sites. */
|
|
51
|
+
export type RoutinePlan<TReturn> = RoutineStep<TReturn>;
|
|
52
|
+
/**
|
|
53
|
+
* Sequential work. The `as Awaited<T>` narrow is the trust boundary with the
|
|
54
|
+
* runner, which resumes with the exact value `execute` produced.
|
|
55
|
+
*/
|
|
56
|
+
export declare function step<T>(name: string, execute: () => T | Promise<T>): RoutineStep<Awaited<T>>;
|
|
57
|
+
/**
|
|
58
|
+
* Background handoff: successful registration completes the foreground step.
|
|
59
|
+
* A synchronous registration failure is thrown back into the plan, matching a
|
|
60
|
+
* direct waitUntil/scheduler call. A returned promise settles in the background;
|
|
61
|
+
* its rejection marks the trace but never fails the foreground response.
|
|
62
|
+
*
|
|
63
|
+
* Settlement tracking follows the RETURNED value: a returned promise is
|
|
64
|
+
* observed until it settles; a scheduler that fires-and-forgets internally
|
|
65
|
+
* (e.g. scheduleShellCapture via runBackground) returns void, so its trace
|
|
66
|
+
* entry settles at the scheduling call, not at background completion. That is
|
|
67
|
+
* deliberate — the plan's contract ends at the handoff.
|
|
68
|
+
*/
|
|
69
|
+
export declare function handoff(name: string, execute: () => unknown): RoutineStep<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Run a nested plan as a named scope. `yield*` flattens its instructions into
|
|
72
|
+
* the parent stream; enter/exit only inform the trace. The scope reports its
|
|
73
|
+
* terminal outcome after internal recovery has either succeeded or escaped.
|
|
74
|
+
*/
|
|
75
|
+
export declare function scope<TReturn>(name: string, plan: RoutinePlan<TReturn>): RoutineStep<TReturn>;
|
|
76
|
+
export interface RoutineTraceEntry {
|
|
77
|
+
name: string;
|
|
78
|
+
kind: RoutineEffectKind | "scope";
|
|
79
|
+
depth: number;
|
|
80
|
+
/** step/scope: running -> done|failed. handoff: pending -> settled|failed. */
|
|
81
|
+
state: "running" | "pending" | "done" | "settled" | "failed";
|
|
82
|
+
startedAt: number;
|
|
83
|
+
endedAt?: number;
|
|
84
|
+
settledAt?: number;
|
|
85
|
+
error?: unknown;
|
|
86
|
+
}
|
|
87
|
+
export interface RoutineTrace {
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly entries: readonly RoutineTraceEntry[];
|
|
90
|
+
enterScope(name: string): void;
|
|
91
|
+
exitScope(outcome: "done" | "failed", error?: unknown): void;
|
|
92
|
+
/** Scope depth entries currently record at. Bridges (e.g. render stage
|
|
93
|
+
* events feeding child entries under a running step) capture this once and
|
|
94
|
+
* pass `depth + 1` explicitly. */
|
|
95
|
+
currentDepth(): number;
|
|
96
|
+
begin(name: string, kind: RoutineEffectKind, depth?: number): RoutineTraceEntry;
|
|
97
|
+
end(entry: RoutineTraceEntry): void;
|
|
98
|
+
fail(entry: RoutineTraceEntry, error: unknown): void;
|
|
99
|
+
settle(entry: RoutineTraceEntry, outcome: {
|
|
100
|
+
status: "fulfilled";
|
|
101
|
+
} | {
|
|
102
|
+
status: "rejected";
|
|
103
|
+
error: unknown;
|
|
104
|
+
}): void;
|
|
105
|
+
/** Running scopes plus the foreground instruction currently in hand. */
|
|
106
|
+
active(): RoutineTraceEntry[];
|
|
107
|
+
format(): string;
|
|
108
|
+
formatActive(entries?: readonly RoutineTraceEntry[], activeAt?: number): string;
|
|
109
|
+
}
|
|
110
|
+
export declare function createRoutineTrace(name: string, now?: () => number): RoutineTrace;
|
|
111
|
+
export interface RoutineTraceOwner {
|
|
112
|
+
_activeRoutine?: RoutineTrace;
|
|
113
|
+
}
|
|
114
|
+
export interface RoutineRunnerOptions {
|
|
115
|
+
trace?: RoutineTrace;
|
|
116
|
+
owner?: RoutineTraceOwner;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Interpret a plan. Invariants shared with driveRscRenderPlan: a command is
|
|
120
|
+
* observable before its work runs, `execute` runs exactly once, results and
|
|
121
|
+
* errors resume the plan with exact identity, and a plan-level try/catch
|
|
122
|
+
* around a step is the recovery mechanism.
|
|
123
|
+
*/
|
|
124
|
+
export declare function runRoutine<TReturn>(plan: RoutinePlan<TReturn>, options?: RoutineRunnerOptions): Promise<TReturn>;
|
|
@@ -25,3 +25,20 @@
|
|
|
25
25
|
* docs/design/ppr-shell-resume.md (Cost model).
|
|
26
26
|
*/
|
|
27
27
|
export declare const SHELL_CAPTURE_MAX_WAIT_MS = 15000;
|
|
28
|
+
/**
|
|
29
|
+
* Hard cap on one capture TASK — runShellCapture end to end (both attempts +
|
|
30
|
+
* the in-place retry delay). SHELL_CAPTURE_MAX_WAIT_MS arms only inside
|
|
31
|
+
* captureShellHTML, AFTER the capture's router.match(); a handler wedged on a
|
|
32
|
+
* never-settling upstream await (autobarn pilot: a 30s+ tarpitting fetch)
|
|
33
|
+
* wedges the task with no deadline in force. The task's settle path releases
|
|
34
|
+
* the per-key stampede guard and the serialized capture-queue slot, so an
|
|
35
|
+
* unbounded task strands BOTH for the isolate's lifetime.
|
|
36
|
+
*
|
|
37
|
+
* 25s: above one full-budget attempt plus overhead (cutting a second attempt
|
|
38
|
+
* short is an acceptable loss — every terminal path backs the key off anyway),
|
|
39
|
+
* and below workerd's ~30s waitUntil grace so the cap timer still fires in a
|
|
40
|
+
* live context. When workerd kills the context BEFORE the cap fires, the timer
|
|
41
|
+
* dies with it — that stranding is healed by scheduleShellCapture's staleness
|
|
42
|
+
* check on the stampede guard, keyed off the same constant.
|
|
43
|
+
*/
|
|
44
|
+
export declare const SHELL_CAPTURE_TASK_HARD_CAP_MS = 25000;
|
|
@@ -26,6 +26,7 @@ import type { TransitionWhenFn } from "../types/segments.js";
|
|
|
26
26
|
import type { ResolvedTracing } from "../router/tracing.js";
|
|
27
27
|
import type { RenderMode, RenderPhase } from "../router/timeout.js";
|
|
28
28
|
import type { LocationStateEntry } from "../browser/react/location-state-shared.js";
|
|
29
|
+
import type { RoutineTrace } from "../rsc/routine-plan.js";
|
|
29
30
|
export interface RenderForegroundCursor {
|
|
30
31
|
mode: RenderMode;
|
|
31
32
|
phase: RenderPhase;
|
|
@@ -542,6 +543,8 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
542
543
|
* loaders and post-commit stream work have separate lifetimes.
|
|
543
544
|
*/
|
|
544
545
|
_renderForeground?: RenderForegroundCursor;
|
|
546
|
+
/** @internal Request routine currently executing, used by timeout diagnostics. */
|
|
547
|
+
_activeRoutine?: RoutineTrace;
|
|
545
548
|
/** @internal Keep the render cursor active for timeout support. */
|
|
546
549
|
_renderDiagnosticsEnabled?: boolean;
|
|
547
550
|
/**
|
|
@@ -585,7 +588,7 @@ export interface RequestContext<TEnv = DefaultEnv, TParams = Record<string, stri
|
|
|
585
588
|
* This is the type exported to library consumers. Internal code should
|
|
586
589
|
* use the full RequestContext interface directly.
|
|
587
590
|
*/
|
|
588
|
-
export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_pprTransitionDecisions" | "_pprReplayPostMatchReason" | "_cacheStore" | "_searchParamsFilter" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_requestMode" | "_cacheSignal" | "_dynamic" | "res">;
|
|
591
|
+
export type PublicRequestContext<TEnv = DefaultEnv, TParams = Record<string, string>> = Omit<RequestContext<TEnv, TParams>, "cookie" | "cookies" | "setCookie" | "deleteCookie" | "_handleStore" | "_transitionWhen" | "_pprTransitionDecisions" | "_pprReplayPostMatchReason" | "_cacheStore" | "_searchParamsFilter" | "_shellCaptureRun" | "_shellImplicitCache" | "_shellLoaderSeed" | "_shellCaptureLoaderRecords" | "_shellCaptureHandleLiveness" | "_shellCaptureLoaderHandleValues" | "_shellFragmentPayload" | "_shellCaptureGuardTripped" | "_shellCaptureGuardTrippedLoaderId" | "_explicitTaggedStores" | "_requestTags" | "_cacheProfiles" | "_onResponseCallbacks" | "_pendingBackgroundTasks" | "_themeConfig" | "_locationState" | "_routeName" | "_prevRouteKey" | "_gateCurrentUrl" | "_gateCurrentParams" | "_gateActionId" | "_gateActionUrl" | "_gateActionResult" | "_gateFormData" | "_inActionRevalidation" | "_reportedErrors" | "_renderBarrier" | "_resolveRenderBarrier" | "_renderBarrierSegmentOrder" | "_treeHasStreaming" | "_renderBarrierWaiters" | "_handlerLoaderDeps" | "_renderBarrierHandleSnapshot" | "_renderBarrierGuardClosed" | "_reportBackgroundError" | "_debugPerformance" | "_metricsStore" | "_renderForeground" | "_activeRoutine" | "_renderDiagnosticsEnabled" | "_handlerStart" | "_tracing" | "_basename" | "_routerId" | "_setStatus" | "_rotateStateCookie" | "_setKeepCacheDirective" | "_variables" | "_classifiedRoute" | "_requestMode" | "_cacheSignal" | "_dynamic" | "res">;
|
|
589
592
|
/**
|
|
590
593
|
* Marker for a waitUntil-scheduled fn whose task promise must NOT enter
|
|
591
594
|
* _pendingBackgroundTasks. Used by the PPR shell capture for its own task:
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
2
|
export { exposeRouterId } from "./expose-ids/router-transform.js";
|
|
3
3
|
export type { ExposeInternalIdsApi } from "./expose-ids/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Stub export-only loader modules before plugin-rsc reduces scan modules to
|
|
6
|
+
* imports. The regular post transform remains authoritative outside scan builds.
|
|
7
|
+
*
|
|
8
|
+
* Handles and location-state definitions are intentionally excluded: handle
|
|
9
|
+
* collect functions run in the browser, and location-state definitions are
|
|
10
|
+
* callable browser objects. Their dependencies must remain visible to non-RSC
|
|
11
|
+
* validation rather than being hidden behind an opaque scan stub.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLoaderScanStubPlugin(): Plugin;
|
|
4
14
|
export declare function exposeInternalIds(options?: {
|
|
5
15
|
forceBuild?: boolean;
|
|
6
16
|
}): Plugin;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Replace dev-style server-reference ids with their production hashes. The temp
|
|
4
|
+
* server renders Static/Prerender in a dev/serve Vite server, so plugin-rsc mints
|
|
5
|
+
* a dev-style id (e.g. "/src/urls/prerender.tsx"); rewriting only the id (group 2)
|
|
6
|
+
* leaves the hoisted function and its trailing encrypted .bind(...) untouched.
|
|
7
|
+
* Exported for testing; used by hashServerRefs. Returns null if nothing changed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function transformServerRefs(code: string, projectRoot: string): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Server-side analog of hashClientRefs. Runs in the build-discovery temp server
|
|
12
|
+
* (a dev/serve Vite server, where plugin-rsc mints dev-style ids), rewriting
|
|
13
|
+
* registerServerReference ids to production hashes AFTER plugin-rsc's
|
|
14
|
+
* rsc:use-server transform (enforce:"post"), so the Flight serializer bakes the
|
|
15
|
+
* production hash into the stored prerender/static payloads.
|
|
16
|
+
*
|
|
17
|
+
* Without this, a server-created action embedded in a prerendered/static Flight
|
|
18
|
+
* is stored with a dev-style id that the production hash-keyed server-references
|
|
19
|
+
* manifest cannot resolve -> "server reference not found" on a build-time-cache
|
|
20
|
+
* hit. Mirrors hashClientRefs, which already does exactly this for the client
|
|
21
|
+
* half of the same payload (which is why client refs in stored Flight are
|
|
22
|
+
* already production hashes while server refs were not).
|
|
23
|
+
*/
|
|
24
|
+
export declare function hashServerRefs(projectRoot: string): Plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerServerReferenceRegex(): RegExp;
|
|
@@ -52,4 +52,16 @@ export declare function createVirtualEntriesPlugin(entries: {
|
|
|
52
52
|
* asset collisions from @vitejs/plugin-rsc copying RSC-env assets to the client bundle.
|
|
53
53
|
*/
|
|
54
54
|
export declare function onwarn(warning: Vite.Rollup.RollupLog, defaultHandler: (warning: Vite.Rollup.RollupLog) => void): void;
|
|
55
|
+
/**
|
|
56
|
+
* All of `browser/prefetch/` belongs to the eager "router" chunk — including
|
|
57
|
+
* the modules reachable only via loader.ts's dynamic import. #766 split those
|
|
58
|
+
* into a separate lazy chunk to trim the eager runtime (~2.3 KB gzip), but
|
|
59
|
+
* production's `defaultPrefetch: "viewport"` loads them on almost every page,
|
|
60
|
+
* so the split became a document -> router -> runtime request waterfall
|
|
61
|
+
* (measured 502 ms critical-path latency in a deployed worker). Same-chunk
|
|
62
|
+
* placement resolves the dynamic import without a network fetch
|
|
63
|
+
* (`Promise.resolve().then(...)` in the emitted chunk), and the merged chunk
|
|
64
|
+
* gzips smaller than the two chunks did apart. Do not re-split without new
|
|
65
|
+
* information (AGENTS.md, Bundle hygiene, rejected optimizations).
|
|
66
|
+
*/
|
|
55
67
|
export declare function getManualChunks(id: string): string | undefined;
|