@rangojs/router 0.0.0-experimental.121 → 0.0.0-experimental.122
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/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/skills/cache-guide/SKILL.md +8 -6
- package/skills/caching/SKILL.md +146 -0
- package/skills/migrate-nextjs/SKILL.md +35 -15
- package/skills/rango/SKILL.md +15 -15
- package/skills/use-cache/SKILL.md +9 -7
- package/src/cache/cache-error.ts +104 -0
- package/src/cache/cache-policy.ts +95 -1
- package/src/cache/cache-runtime.ts +79 -13
- package/src/cache/cache-scope.ts +55 -4
- package/src/cache/cache-tag.ts +135 -0
- package/src/cache/cf/cf-cache-store.ts +2058 -223
- package/src/cache/cf/index.ts +15 -1
- package/src/cache/document-cache.ts +63 -7
- package/src/cache/index.ts +17 -0
- package/src/cache/memory-segment-store.ts +158 -14
- package/src/cache/tag-invalidation.ts +230 -0
- package/src/cache/types.ts +27 -0
- package/src/index.rsc.ts +7 -0
- package/src/index.ts +12 -0
- package/src/router/prerender-match.ts +2 -0
- package/src/router/segment-resolution/loader-cache.ts +8 -17
- package/src/rsc/handler.ts +10 -1
- package/src/rsc/response-route-handler.ts +8 -1
- package/src/server/request-context.ts +36 -2
- package/src/types/cache-types.ts +13 -4
- package/src/types/error-types.ts +5 -1
- package/dist/__internal.d.ts +0 -83
- package/dist/__internal.d.ts.map +0 -1
- package/dist/__internal.js +0 -19
- package/dist/__internal.js.map +0 -1
- package/dist/__mocks__/version.d.ts +0 -7
- package/dist/__mocks__/version.d.ts.map +0 -1
- package/dist/__mocks__/version.js +0 -7
- package/dist/__mocks__/version.js.map +0 -1
- package/dist/__tests__/client-href.test.d.ts +0 -2
- package/dist/__tests__/client-href.test.d.ts.map +0 -1
- package/dist/__tests__/client-href.test.js +0 -74
- package/dist/__tests__/client-href.test.js.map +0 -1
- package/dist/__tests__/component-utils.test.d.ts +0 -2
- package/dist/__tests__/component-utils.test.d.ts.map +0 -1
- package/dist/__tests__/component-utils.test.js +0 -51
- package/dist/__tests__/component-utils.test.js.map +0 -1
- package/dist/__tests__/event-controller.test.d.ts +0 -2
- package/dist/__tests__/event-controller.test.d.ts.map +0 -1
- package/dist/__tests__/event-controller.test.js +0 -538
- package/dist/__tests__/event-controller.test.js.map +0 -1
- package/dist/__tests__/helpers/route-tree.d.ts +0 -118
- package/dist/__tests__/helpers/route-tree.d.ts.map +0 -1
- package/dist/__tests__/helpers/route-tree.js +0 -374
- package/dist/__tests__/helpers/route-tree.js.map +0 -1
- package/dist/__tests__/match-result.test.d.ts +0 -2
- package/dist/__tests__/match-result.test.d.ts.map +0 -1
- package/dist/__tests__/match-result.test.js +0 -154
- package/dist/__tests__/match-result.test.js.map +0 -1
- package/dist/__tests__/navigation-store.test.d.ts +0 -2
- package/dist/__tests__/navigation-store.test.d.ts.map +0 -1
- package/dist/__tests__/navigation-store.test.js +0 -440
- package/dist/__tests__/navigation-store.test.js.map +0 -1
- package/dist/__tests__/partial-update.test.d.ts +0 -2
- package/dist/__tests__/partial-update.test.d.ts.map +0 -1
- package/dist/__tests__/partial-update.test.js +0 -1009
- package/dist/__tests__/partial-update.test.js.map +0 -1
- package/dist/__tests__/reverse-types.test.d.ts +0 -8
- package/dist/__tests__/reverse-types.test.d.ts.map +0 -1
- package/dist/__tests__/reverse-types.test.js +0 -656
- package/dist/__tests__/reverse-types.test.js.map +0 -1
- package/dist/__tests__/route-definition.test.d.ts +0 -2
- package/dist/__tests__/route-definition.test.d.ts.map +0 -1
- package/dist/__tests__/route-definition.test.js +0 -55
- package/dist/__tests__/route-definition.test.js.map +0 -1
- package/dist/__tests__/router-helpers.test.d.ts +0 -2
- package/dist/__tests__/router-helpers.test.d.ts.map +0 -1
- package/dist/__tests__/router-helpers.test.js +0 -377
- package/dist/__tests__/router-helpers.test.js.map +0 -1
- package/dist/__tests__/router-integration-2.test.d.ts +0 -2
- package/dist/__tests__/router-integration-2.test.d.ts.map +0 -1
- package/dist/__tests__/router-integration-2.test.js +0 -426
- package/dist/__tests__/router-integration-2.test.js.map +0 -1
- package/dist/__tests__/router-integration.test.d.ts +0 -2
- package/dist/__tests__/router-integration.test.d.ts.map +0 -1
- package/dist/__tests__/router-integration.test.js +0 -1051
- package/dist/__tests__/router-integration.test.js.map +0 -1
- package/dist/__tests__/search-params.test.d.ts +0 -5
- package/dist/__tests__/search-params.test.d.ts.map +0 -1
- package/dist/__tests__/search-params.test.js +0 -306
- package/dist/__tests__/search-params.test.js.map +0 -1
- package/dist/__tests__/segment-system.test.d.ts +0 -2
- package/dist/__tests__/segment-system.test.d.ts.map +0 -1
- package/dist/__tests__/segment-system.test.js +0 -627
- package/dist/__tests__/segment-system.test.js.map +0 -1
- package/dist/__tests__/static-handler-types.test.d.ts +0 -8
- package/dist/__tests__/static-handler-types.test.d.ts.map +0 -1
- package/dist/__tests__/static-handler-types.test.js +0 -63
- package/dist/__tests__/static-handler-types.test.js.map +0 -1
- package/dist/__tests__/urls.test.d.ts +0 -2
- package/dist/__tests__/urls.test.d.ts.map +0 -1
- package/dist/__tests__/urls.test.js +0 -421
- package/dist/__tests__/urls.test.js.map +0 -1
- package/dist/__tests__/use-mount.test.d.ts +0 -2
- package/dist/__tests__/use-mount.test.d.ts.map +0 -1
- package/dist/__tests__/use-mount.test.js +0 -35
- package/dist/__tests__/use-mount.test.js.map +0 -1
- package/dist/bin/rango.d.ts +0 -2
- package/dist/bin/rango.d.ts.map +0 -1
- package/dist/bin/rango.js.map +0 -1
- package/dist/browser/event-controller.d.ts +0 -191
- package/dist/browser/event-controller.d.ts.map +0 -1
- package/dist/browser/event-controller.js +0 -559
- package/dist/browser/event-controller.js.map +0 -1
- package/dist/browser/index.d.ts +0 -2
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -14
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/link-interceptor.d.ts +0 -38
- package/dist/browser/link-interceptor.d.ts.map +0 -1
- package/dist/browser/link-interceptor.js +0 -99
- package/dist/browser/link-interceptor.js.map +0 -1
- package/dist/browser/logging.d.ts +0 -10
- package/dist/browser/logging.d.ts.map +0 -1
- package/dist/browser/logging.js +0 -29
- package/dist/browser/logging.js.map +0 -1
- package/dist/browser/lru-cache.d.ts +0 -17
- package/dist/browser/lru-cache.d.ts.map +0 -1
- package/dist/browser/lru-cache.js +0 -50
- package/dist/browser/lru-cache.js.map +0 -1
- package/dist/browser/merge-segment-loaders.d.ts +0 -39
- package/dist/browser/merge-segment-loaders.d.ts.map +0 -1
- package/dist/browser/merge-segment-loaders.js +0 -102
- package/dist/browser/merge-segment-loaders.js.map +0 -1
- package/dist/browser/navigation-bridge.d.ts +0 -102
- package/dist/browser/navigation-bridge.d.ts.map +0 -1
- package/dist/browser/navigation-bridge.js +0 -708
- package/dist/browser/navigation-bridge.js.map +0 -1
- package/dist/browser/navigation-client.d.ts +0 -25
- package/dist/browser/navigation-client.d.ts.map +0 -1
- package/dist/browser/navigation-client.js +0 -157
- package/dist/browser/navigation-client.js.map +0 -1
- package/dist/browser/navigation-store.d.ts +0 -101
- package/dist/browser/navigation-store.d.ts.map +0 -1
- package/dist/browser/navigation-store.js +0 -625
- package/dist/browser/navigation-store.js.map +0 -1
- package/dist/browser/partial-update.d.ts +0 -75
- package/dist/browser/partial-update.d.ts.map +0 -1
- package/dist/browser/partial-update.js +0 -426
- package/dist/browser/partial-update.js.map +0 -1
- package/dist/browser/react/Link.d.ts +0 -86
- package/dist/browser/react/Link.d.ts.map +0 -1
- package/dist/browser/react/Link.js +0 -128
- package/dist/browser/react/Link.js.map +0 -1
- package/dist/browser/react/NavigationProvider.d.ts +0 -63
- package/dist/browser/react/NavigationProvider.d.ts.map +0 -1
- package/dist/browser/react/NavigationProvider.js +0 -216
- package/dist/browser/react/NavigationProvider.js.map +0 -1
- package/dist/browser/react/ScrollRestoration.d.ts +0 -75
- package/dist/browser/react/ScrollRestoration.d.ts.map +0 -1
- package/dist/browser/react/ScrollRestoration.js +0 -57
- package/dist/browser/react/ScrollRestoration.js.map +0 -1
- package/dist/browser/react/context.d.ts +0 -46
- package/dist/browser/react/context.d.ts.map +0 -1
- package/dist/browser/react/context.js +0 -10
- package/dist/browser/react/context.js.map +0 -1
- package/dist/browser/react/index.d.ts +0 -11
- package/dist/browser/react/index.d.ts.map +0 -1
- package/dist/browser/react/index.js +0 -22
- package/dist/browser/react/index.js.map +0 -1
- package/dist/browser/react/location-state-shared.d.ts +0 -63
- package/dist/browser/react/location-state-shared.d.ts.map +0 -1
- package/dist/browser/react/location-state-shared.js +0 -81
- package/dist/browser/react/location-state-shared.js.map +0 -1
- package/dist/browser/react/location-state.d.ts +0 -23
- package/dist/browser/react/location-state.d.ts.map +0 -1
- package/dist/browser/react/location-state.js +0 -29
- package/dist/browser/react/location-state.js.map +0 -1
- package/dist/browser/react/mount-context.d.ts +0 -24
- package/dist/browser/react/mount-context.d.ts.map +0 -1
- package/dist/browser/react/mount-context.js +0 -24
- package/dist/browser/react/mount-context.js.map +0 -1
- package/dist/browser/react/use-action.d.ts +0 -64
- package/dist/browser/react/use-action.d.ts.map +0 -1
- package/dist/browser/react/use-action.js +0 -134
- package/dist/browser/react/use-action.js.map +0 -1
- package/dist/browser/react/use-client-cache.d.ts +0 -41
- package/dist/browser/react/use-client-cache.d.ts.map +0 -1
- package/dist/browser/react/use-client-cache.js +0 -39
- package/dist/browser/react/use-client-cache.js.map +0 -1
- package/dist/browser/react/use-handle.d.ts +0 -31
- package/dist/browser/react/use-handle.d.ts.map +0 -1
- package/dist/browser/react/use-handle.js +0 -144
- package/dist/browser/react/use-handle.js.map +0 -1
- package/dist/browser/react/use-href.d.ts +0 -33
- package/dist/browser/react/use-href.d.ts.map +0 -1
- package/dist/browser/react/use-href.js +0 -39
- package/dist/browser/react/use-href.js.map +0 -1
- package/dist/browser/react/use-link-status.d.ts +0 -37
- package/dist/browser/react/use-link-status.d.ts.map +0 -1
- package/dist/browser/react/use-link-status.js +0 -99
- package/dist/browser/react/use-link-status.js.map +0 -1
- package/dist/browser/react/use-mount.d.ts +0 -25
- package/dist/browser/react/use-mount.d.ts.map +0 -1
- package/dist/browser/react/use-mount.js +0 -30
- package/dist/browser/react/use-mount.js.map +0 -1
- package/dist/browser/react/use-navigation.d.ts +0 -27
- package/dist/browser/react/use-navigation.d.ts.map +0 -1
- package/dist/browser/react/use-navigation.js +0 -87
- package/dist/browser/react/use-navigation.js.map +0 -1
- package/dist/browser/react/use-segments.d.ts +0 -38
- package/dist/browser/react/use-segments.d.ts.map +0 -1
- package/dist/browser/react/use-segments.js +0 -130
- package/dist/browser/react/use-segments.js.map +0 -1
- package/dist/browser/request-controller.d.ts +0 -26
- package/dist/browser/request-controller.d.ts.map +0 -1
- package/dist/browser/request-controller.js +0 -147
- package/dist/browser/request-controller.js.map +0 -1
- package/dist/browser/rsc-router.d.ts +0 -129
- package/dist/browser/rsc-router.d.ts.map +0 -1
- package/dist/browser/rsc-router.js +0 -195
- package/dist/browser/rsc-router.js.map +0 -1
- package/dist/browser/scroll-restoration.d.ts +0 -93
- package/dist/browser/scroll-restoration.d.ts.map +0 -1
- package/dist/browser/scroll-restoration.js +0 -321
- package/dist/browser/scroll-restoration.js.map +0 -1
- package/dist/browser/segment-structure-assert.d.ts +0 -17
- package/dist/browser/segment-structure-assert.d.ts.map +0 -1
- package/dist/browser/segment-structure-assert.js +0 -59
- package/dist/browser/segment-structure-assert.js.map +0 -1
- package/dist/browser/server-action-bridge.d.ts +0 -26
- package/dist/browser/server-action-bridge.d.ts.map +0 -1
- package/dist/browser/server-action-bridge.js +0 -668
- package/dist/browser/server-action-bridge.js.map +0 -1
- package/dist/browser/shallow.d.ts +0 -12
- package/dist/browser/shallow.d.ts.map +0 -1
- package/dist/browser/shallow.js +0 -34
- package/dist/browser/shallow.js.map +0 -1
- package/dist/browser/types.d.ts +0 -369
- package/dist/browser/types.d.ts.map +0 -1
- package/dist/browser/types.js +0 -2
- package/dist/browser/types.js.map +0 -1
- package/dist/build/__tests__/generate-cli.test.d.ts +0 -2
- package/dist/build/__tests__/generate-cli.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-cli.test.js +0 -237
- package/dist/build/__tests__/generate-cli.test.js.map +0 -1
- package/dist/build/__tests__/generate-manifest.test.d.ts +0 -2
- package/dist/build/__tests__/generate-manifest.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-manifest.test.js +0 -119
- package/dist/build/__tests__/generate-manifest.test.js.map +0 -1
- package/dist/build/__tests__/generate-route-types.test.d.ts +0 -2
- package/dist/build/__tests__/generate-route-types.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-route-types.test.js +0 -620
- package/dist/build/__tests__/generate-route-types.test.js.map +0 -1
- package/dist/build/__tests__/per-router-manifest.test.d.ts +0 -2
- package/dist/build/__tests__/per-router-manifest.test.d.ts.map +0 -1
- package/dist/build/__tests__/per-router-manifest.test.js +0 -308
- package/dist/build/__tests__/per-router-manifest.test.js.map +0 -1
- package/dist/build/generate-manifest.d.ts +0 -81
- package/dist/build/generate-manifest.d.ts.map +0 -1
- package/dist/build/generate-manifest.js +0 -276
- package/dist/build/generate-manifest.js.map +0 -1
- package/dist/build/generate-route-types.d.ts +0 -115
- package/dist/build/generate-route-types.d.ts.map +0 -1
- package/dist/build/generate-route-types.js +0 -740
- package/dist/build/generate-route-types.js.map +0 -1
- package/dist/build/index.d.ts +0 -21
- package/dist/build/index.d.ts.map +0 -1
- package/dist/build/index.js +0 -21
- package/dist/build/index.js.map +0 -1
- package/dist/build/route-trie.d.ts +0 -71
- package/dist/build/route-trie.d.ts.map +0 -1
- package/dist/build/route-trie.js +0 -175
- package/dist/build/route-trie.js.map +0 -1
- package/dist/cache/__tests__/cache-scope.test.d.ts +0 -2
- package/dist/cache/__tests__/cache-scope.test.d.ts.map +0 -1
- package/dist/cache/__tests__/cache-scope.test.js +0 -208
- package/dist/cache/__tests__/cache-scope.test.js.map +0 -1
- package/dist/cache/__tests__/document-cache.test.d.ts +0 -2
- package/dist/cache/__tests__/document-cache.test.d.ts.map +0 -1
- package/dist/cache/__tests__/document-cache.test.js +0 -345
- package/dist/cache/__tests__/document-cache.test.js.map +0 -1
- package/dist/cache/__tests__/memory-segment-store.test.d.ts +0 -2
- package/dist/cache/__tests__/memory-segment-store.test.d.ts.map +0 -1
- package/dist/cache/__tests__/memory-segment-store.test.js +0 -425
- package/dist/cache/__tests__/memory-segment-store.test.js.map +0 -1
- package/dist/cache/__tests__/memory-store.test.d.ts +0 -2
- package/dist/cache/__tests__/memory-store.test.d.ts.map +0 -1
- package/dist/cache/__tests__/memory-store.test.js +0 -367
- package/dist/cache/__tests__/memory-store.test.js.map +0 -1
- package/dist/cache/cache-scope.d.ts +0 -102
- package/dist/cache/cache-scope.d.ts.map +0 -1
- package/dist/cache/cache-scope.js +0 -440
- package/dist/cache/cache-scope.js.map +0 -1
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts +0 -2
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts.map +0 -1
- package/dist/cache/cf/__tests__/cf-cache-store.test.js +0 -330
- package/dist/cache/cf/__tests__/cf-cache-store.test.js.map +0 -1
- package/dist/cache/cf/cf-cache-store.d.ts +0 -165
- package/dist/cache/cf/cf-cache-store.d.ts.map +0 -1
- package/dist/cache/cf/cf-cache-store.js +0 -242
- package/dist/cache/cf/cf-cache-store.js.map +0 -1
- package/dist/cache/cf/index.d.ts +0 -14
- package/dist/cache/cf/index.d.ts.map +0 -1
- package/dist/cache/cf/index.js +0 -17
- package/dist/cache/cf/index.js.map +0 -1
- package/dist/cache/document-cache.d.ts +0 -64
- package/dist/cache/document-cache.d.ts.map +0 -1
- package/dist/cache/document-cache.js +0 -228
- package/dist/cache/document-cache.js.map +0 -1
- package/dist/cache/index.d.ts +0 -19
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/index.js +0 -21
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/memory-segment-store.d.ts +0 -110
- package/dist/cache/memory-segment-store.d.ts.map +0 -1
- package/dist/cache/memory-segment-store.js +0 -117
- package/dist/cache/memory-segment-store.js.map +0 -1
- package/dist/cache/memory-store.d.ts +0 -41
- package/dist/cache/memory-store.d.ts.map +0 -1
- package/dist/cache/memory-store.js +0 -191
- package/dist/cache/memory-store.js.map +0 -1
- package/dist/cache/types.d.ts +0 -317
- package/dist/cache/types.d.ts.map +0 -1
- package/dist/cache/types.js +0 -12
- package/dist/cache/types.js.map +0 -1
- package/dist/client.d.ts +0 -248
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -367
- package/dist/client.js.map +0 -1
- package/dist/client.rsc.d.ts +0 -26
- package/dist/client.rsc.d.ts.map +0 -1
- package/dist/client.rsc.js +0 -46
- package/dist/client.rsc.js.map +0 -1
- package/dist/component-utils.d.ts +0 -36
- package/dist/component-utils.d.ts.map +0 -1
- package/dist/component-utils.js +0 -61
- package/dist/component-utils.js.map +0 -1
- package/dist/components/DefaultDocument.d.ts +0 -13
- package/dist/components/DefaultDocument.d.ts.map +0 -1
- package/dist/components/DefaultDocument.js +0 -15
- package/dist/components/DefaultDocument.js.map +0 -1
- package/dist/debug.d.ts +0 -58
- package/dist/debug.d.ts.map +0 -1
- package/dist/debug.js +0 -157
- package/dist/debug.js.map +0 -1
- package/dist/default-error-boundary.d.ts +0 -11
- package/dist/default-error-boundary.d.ts.map +0 -1
- package/dist/default-error-boundary.js +0 -45
- package/dist/default-error-boundary.js.map +0 -1
- package/dist/deps/browser.d.ts +0 -2
- package/dist/deps/browser.d.ts.map +0 -1
- package/dist/deps/browser.js +0 -3
- package/dist/deps/browser.js.map +0 -1
- package/dist/deps/html-stream-client.d.ts +0 -2
- package/dist/deps/html-stream-client.d.ts.map +0 -1
- package/dist/deps/html-stream-client.js +0 -3
- package/dist/deps/html-stream-client.js.map +0 -1
- package/dist/deps/html-stream-server.d.ts +0 -2
- package/dist/deps/html-stream-server.d.ts.map +0 -1
- package/dist/deps/html-stream-server.js +0 -3
- package/dist/deps/html-stream-server.js.map +0 -1
- package/dist/deps/rsc.d.ts +0 -2
- package/dist/deps/rsc.d.ts.map +0 -1
- package/dist/deps/rsc.js +0 -4
- package/dist/deps/rsc.js.map +0 -1
- package/dist/deps/ssr.d.ts +0 -2
- package/dist/deps/ssr.d.ts.map +0 -1
- package/dist/deps/ssr.js +0 -3
- package/dist/deps/ssr.js.map +0 -1
- package/dist/errors.d.ts +0 -174
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -241
- package/dist/errors.js.map +0 -1
- package/dist/handle.d.ts +0 -78
- package/dist/handle.d.ts.map +0 -1
- package/dist/handle.js +0 -82
- package/dist/handle.js.map +0 -1
- package/dist/handles/MetaTags.d.ts +0 -14
- package/dist/handles/MetaTags.d.ts.map +0 -1
- package/dist/handles/MetaTags.js +0 -136
- package/dist/handles/MetaTags.js.map +0 -1
- package/dist/handles/index.d.ts +0 -6
- package/dist/handles/index.d.ts.map +0 -1
- package/dist/handles/index.js +0 -6
- package/dist/handles/index.js.map +0 -1
- package/dist/handles/meta.d.ts +0 -39
- package/dist/handles/meta.d.ts.map +0 -1
- package/dist/handles/meta.js +0 -202
- package/dist/handles/meta.js.map +0 -1
- package/dist/host/__tests__/errors.test.d.ts +0 -2
- package/dist/host/__tests__/errors.test.d.ts.map +0 -1
- package/dist/host/__tests__/errors.test.js +0 -76
- package/dist/host/__tests__/errors.test.js.map +0 -1
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts +0 -2
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts.map +0 -1
- package/dist/host/__tests__/pattern-comprehensive.test.js +0 -732
- package/dist/host/__tests__/pattern-comprehensive.test.js.map +0 -1
- package/dist/host/__tests__/pattern-matcher.test.d.ts +0 -2
- package/dist/host/__tests__/pattern-matcher.test.d.ts.map +0 -1
- package/dist/host/__tests__/pattern-matcher.test.js +0 -251
- package/dist/host/__tests__/pattern-matcher.test.js.map +0 -1
- package/dist/host/__tests__/router.test.d.ts +0 -2
- package/dist/host/__tests__/router.test.d.ts.map +0 -1
- package/dist/host/__tests__/router.test.js +0 -241
- package/dist/host/__tests__/router.test.js.map +0 -1
- package/dist/host/__tests__/testing.test.d.ts +0 -2
- package/dist/host/__tests__/testing.test.d.ts.map +0 -1
- package/dist/host/__tests__/testing.test.js +0 -64
- package/dist/host/__tests__/testing.test.js.map +0 -1
- package/dist/host/__tests__/utils.test.d.ts +0 -2
- package/dist/host/__tests__/utils.test.d.ts.map +0 -1
- package/dist/host/__tests__/utils.test.js +0 -29
- package/dist/host/__tests__/utils.test.js.map +0 -1
- package/dist/host/cookie-handler.d.ts +0 -34
- package/dist/host/cookie-handler.d.ts.map +0 -1
- package/dist/host/cookie-handler.js +0 -124
- package/dist/host/cookie-handler.js.map +0 -1
- package/dist/host/errors.d.ts +0 -56
- package/dist/host/errors.d.ts.map +0 -1
- package/dist/host/errors.js +0 -79
- package/dist/host/errors.js.map +0 -1
- package/dist/host/index.d.ts +0 -29
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js +0 -32
- package/dist/host/index.js.map +0 -1
- package/dist/host/pattern-matcher.d.ts +0 -36
- package/dist/host/pattern-matcher.d.ts.map +0 -1
- package/dist/host/pattern-matcher.js +0 -172
- package/dist/host/pattern-matcher.js.map +0 -1
- package/dist/host/router.d.ts +0 -26
- package/dist/host/router.d.ts.map +0 -1
- package/dist/host/router.js +0 -218
- package/dist/host/router.js.map +0 -1
- package/dist/host/testing.d.ts +0 -36
- package/dist/host/testing.d.ts.map +0 -1
- package/dist/host/testing.js +0 -55
- package/dist/host/testing.js.map +0 -1
- package/dist/host/types.d.ts +0 -115
- package/dist/host/types.d.ts.map +0 -1
- package/dist/host/types.js +0 -7
- package/dist/host/types.js.map +0 -1
- package/dist/host/utils.d.ts +0 -21
- package/dist/host/utils.d.ts.map +0 -1
- package/dist/host/utils.js +0 -23
- package/dist/host/utils.js.map +0 -1
- package/dist/href-client.d.ts +0 -131
- package/dist/href-client.d.ts.map +0 -1
- package/dist/href-client.js +0 -64
- package/dist/href-client.js.map +0 -1
- package/dist/href-context.d.ts +0 -29
- package/dist/href-context.d.ts.map +0 -1
- package/dist/href-context.js +0 -21
- package/dist/href-context.js.map +0 -1
- package/dist/index.d.ts +0 -73
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -91
- package/dist/index.js.map +0 -1
- package/dist/index.rsc.d.ts +0 -32
- package/dist/index.rsc.d.ts.map +0 -1
- package/dist/index.rsc.js +0 -40
- package/dist/index.rsc.js.map +0 -1
- package/dist/internal-debug.d.ts +0 -2
- package/dist/internal-debug.d.ts.map +0 -1
- package/dist/internal-debug.js +0 -5
- package/dist/internal-debug.js.map +0 -1
- package/dist/loader.d.ts +0 -14
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -20
- package/dist/loader.js.map +0 -1
- package/dist/loader.rsc.d.ts +0 -19
- package/dist/loader.rsc.d.ts.map +0 -1
- package/dist/loader.rsc.js +0 -99
- package/dist/loader.rsc.js.map +0 -1
- package/dist/network-error-thrower.d.ts +0 -17
- package/dist/network-error-thrower.d.ts.map +0 -1
- package/dist/network-error-thrower.js +0 -14
- package/dist/network-error-thrower.js.map +0 -1
- package/dist/outlet-context.d.ts +0 -13
- package/dist/outlet-context.d.ts.map +0 -1
- package/dist/outlet-context.js +0 -3
- package/dist/outlet-context.js.map +0 -1
- package/dist/prerender/__tests__/param-hash.test.d.ts +0 -2
- package/dist/prerender/__tests__/param-hash.test.d.ts.map +0 -1
- package/dist/prerender/__tests__/param-hash.test.js +0 -148
- package/dist/prerender/__tests__/param-hash.test.js.map +0 -1
- package/dist/prerender/param-hash.d.ts +0 -16
- package/dist/prerender/param-hash.d.ts.map +0 -1
- package/dist/prerender/param-hash.js +0 -36
- package/dist/prerender/param-hash.js.map +0 -1
- package/dist/prerender/store.d.ts +0 -38
- package/dist/prerender/store.d.ts.map +0 -1
- package/dist/prerender/store.js +0 -61
- package/dist/prerender/store.js.map +0 -1
- package/dist/prerender.d.ts +0 -66
- package/dist/prerender.d.ts.map +0 -1
- package/dist/prerender.js +0 -57
- package/dist/prerender.js.map +0 -1
- package/dist/reverse.d.ts +0 -196
- package/dist/reverse.d.ts.map +0 -1
- package/dist/reverse.js +0 -78
- package/dist/reverse.js.map +0 -1
- package/dist/root-error-boundary.d.ts +0 -33
- package/dist/root-error-boundary.d.ts.map +0 -1
- package/dist/root-error-boundary.js +0 -165
- package/dist/root-error-boundary.js.map +0 -1
- package/dist/route-content-wrapper.d.ts +0 -46
- package/dist/route-content-wrapper.d.ts.map +0 -1
- package/dist/route-content-wrapper.js +0 -77
- package/dist/route-content-wrapper.js.map +0 -1
- package/dist/route-definition.d.ts +0 -421
- package/dist/route-definition.d.ts.map +0 -1
- package/dist/route-definition.js +0 -868
- package/dist/route-definition.js.map +0 -1
- package/dist/route-map-builder.d.ts +0 -155
- package/dist/route-map-builder.d.ts.map +0 -1
- package/dist/route-map-builder.js +0 -237
- package/dist/route-map-builder.js.map +0 -1
- package/dist/route-types.d.ts +0 -165
- package/dist/route-types.d.ts.map +0 -1
- package/dist/route-types.js +0 -7
- package/dist/route-types.js.map +0 -1
- package/dist/router/__tests__/handler-context.test.d.ts +0 -2
- package/dist/router/__tests__/handler-context.test.d.ts.map +0 -1
- package/dist/router/__tests__/handler-context.test.js +0 -65
- package/dist/router/__tests__/handler-context.test.js.map +0 -1
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts +0 -2
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts.map +0 -1
- package/dist/router/__tests__/loader-cycle-detection.test.js +0 -221
- package/dist/router/__tests__/loader-cycle-detection.test.js.map +0 -1
- package/dist/router/__tests__/match-context.test.d.ts +0 -2
- package/dist/router/__tests__/match-context.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-context.test.js +0 -92
- package/dist/router/__tests__/match-context.test.js.map +0 -1
- package/dist/router/__tests__/match-pipelines.test.d.ts +0 -2
- package/dist/router/__tests__/match-pipelines.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-pipelines.test.js +0 -417
- package/dist/router/__tests__/match-pipelines.test.js.map +0 -1
- package/dist/router/__tests__/match-result.test.d.ts +0 -2
- package/dist/router/__tests__/match-result.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-result.test.js +0 -457
- package/dist/router/__tests__/match-result.test.js.map +0 -1
- package/dist/router/__tests__/on-error.test.d.ts +0 -2
- package/dist/router/__tests__/on-error.test.d.ts.map +0 -1
- package/dist/router/__tests__/on-error.test.js +0 -678
- package/dist/router/__tests__/on-error.test.js.map +0 -1
- package/dist/router/__tests__/pattern-matching.test.d.ts +0 -2
- package/dist/router/__tests__/pattern-matching.test.d.ts.map +0 -1
- package/dist/router/__tests__/pattern-matching.test.js +0 -629
- package/dist/router/__tests__/pattern-matching.test.js.map +0 -1
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts +0 -2
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts.map +0 -1
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js +0 -155
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js.map +0 -1
- package/dist/router/error-handling.d.ts +0 -77
- package/dist/router/error-handling.d.ts.map +0 -1
- package/dist/router/error-handling.js +0 -202
- package/dist/router/error-handling.js.map +0 -1
- package/dist/router/handler-context.d.ts +0 -20
- package/dist/router/handler-context.d.ts.map +0 -1
- package/dist/router/handler-context.js +0 -198
- package/dist/router/handler-context.js.map +0 -1
- package/dist/router/intercept-resolution.d.ts +0 -66
- package/dist/router/intercept-resolution.d.ts.map +0 -1
- package/dist/router/intercept-resolution.js +0 -246
- package/dist/router/intercept-resolution.js.map +0 -1
- package/dist/router/loader-resolution.d.ts +0 -64
- package/dist/router/loader-resolution.d.ts.map +0 -1
- package/dist/router/loader-resolution.js +0 -284
- package/dist/router/loader-resolution.js.map +0 -1
- package/dist/router/logging.d.ts +0 -15
- package/dist/router/logging.d.ts.map +0 -1
- package/dist/router/logging.js +0 -99
- package/dist/router/logging.js.map +0 -1
- package/dist/router/manifest.d.ts +0 -22
- package/dist/router/manifest.d.ts.map +0 -1
- package/dist/router/manifest.js +0 -181
- package/dist/router/manifest.js.map +0 -1
- package/dist/router/match-api.d.ts +0 -35
- package/dist/router/match-api.d.ts.map +0 -1
- package/dist/router/match-api.js +0 -406
- package/dist/router/match-api.js.map +0 -1
- package/dist/router/match-context.d.ts +0 -206
- package/dist/router/match-context.d.ts.map +0 -1
- package/dist/router/match-context.js +0 -17
- package/dist/router/match-context.js.map +0 -1
- package/dist/router/match-middleware/background-revalidation.d.ts +0 -127
- package/dist/router/match-middleware/background-revalidation.d.ts.map +0 -1
- package/dist/router/match-middleware/background-revalidation.js +0 -75
- package/dist/router/match-middleware/background-revalidation.js.map +0 -1
- package/dist/router/match-middleware/cache-lookup.d.ts +0 -112
- package/dist/router/match-middleware/cache-lookup.d.ts.map +0 -1
- package/dist/router/match-middleware/cache-lookup.js +0 -257
- package/dist/router/match-middleware/cache-lookup.js.map +0 -1
- package/dist/router/match-middleware/cache-store.d.ts +0 -113
- package/dist/router/match-middleware/cache-store.d.ts.map +0 -1
- package/dist/router/match-middleware/cache-store.js +0 -108
- package/dist/router/match-middleware/cache-store.js.map +0 -1
- package/dist/router/match-middleware/index.d.ts +0 -81
- package/dist/router/match-middleware/index.d.ts.map +0 -1
- package/dist/router/match-middleware/index.js +0 -80
- package/dist/router/match-middleware/index.js.map +0 -1
- package/dist/router/match-middleware/intercept-resolution.d.ts +0 -117
- package/dist/router/match-middleware/intercept-resolution.d.ts.map +0 -1
- package/dist/router/match-middleware/intercept-resolution.js +0 -134
- package/dist/router/match-middleware/intercept-resolution.js.map +0 -1
- package/dist/router/match-middleware/segment-resolution.d.ts +0 -99
- package/dist/router/match-middleware/segment-resolution.d.ts.map +0 -1
- package/dist/router/match-middleware/segment-resolution.js +0 -53
- package/dist/router/match-middleware/segment-resolution.js.map +0 -1
- package/dist/router/match-pipelines.d.ts +0 -147
- package/dist/router/match-pipelines.d.ts.map +0 -1
- package/dist/router/match-pipelines.js +0 -82
- package/dist/router/match-pipelines.js.map +0 -1
- package/dist/router/match-result.d.ts +0 -126
- package/dist/router/match-result.d.ts.map +0 -1
- package/dist/router/match-result.js +0 -93
- package/dist/router/match-result.js.map +0 -1
- package/dist/router/metrics.d.ts +0 -20
- package/dist/router/metrics.d.ts.map +0 -1
- package/dist/router/metrics.js +0 -47
- package/dist/router/metrics.js.map +0 -1
- package/dist/router/middleware.d.ts +0 -249
- package/dist/router/middleware.d.ts.map +0 -1
- package/dist/router/middleware.js +0 -434
- package/dist/router/middleware.js.map +0 -1
- package/dist/router/middleware.test.d.ts +0 -2
- package/dist/router/middleware.test.d.ts.map +0 -1
- package/dist/router/middleware.test.js +0 -816
- package/dist/router/middleware.test.js.map +0 -1
- package/dist/router/pattern-matching.d.ts +0 -149
- package/dist/router/pattern-matching.d.ts.map +0 -1
- package/dist/router/pattern-matching.js +0 -349
- package/dist/router/pattern-matching.js.map +0 -1
- package/dist/router/revalidation.d.ts +0 -44
- package/dist/router/revalidation.d.ts.map +0 -1
- package/dist/router/revalidation.js +0 -147
- package/dist/router/revalidation.js.map +0 -1
- package/dist/router/router-context.d.ts +0 -135
- package/dist/router/router-context.d.ts.map +0 -1
- package/dist/router/router-context.js +0 -36
- package/dist/router/router-context.js.map +0 -1
- package/dist/router/segment-resolution.d.ts +0 -127
- package/dist/router/segment-resolution.d.ts.map +0 -1
- package/dist/router/segment-resolution.js +0 -919
- package/dist/router/segment-resolution.js.map +0 -1
- package/dist/router/trie-matching.d.ts +0 -40
- package/dist/router/trie-matching.d.ts.map +0 -1
- package/dist/router/trie-matching.js +0 -127
- package/dist/router/trie-matching.js.map +0 -1
- package/dist/router/types.d.ts +0 -136
- package/dist/router/types.d.ts.map +0 -1
- package/dist/router/types.js +0 -7
- package/dist/router/types.js.map +0 -1
- package/dist/router.d.ts +0 -753
- package/dist/router.d.ts.map +0 -1
- package/dist/router.gen.d.ts +0 -6
- package/dist/router.gen.d.ts.map +0 -1
- package/dist/router.gen.js +0 -6
- package/dist/router.gen.js.map +0 -1
- package/dist/router.js +0 -1304
- package/dist/router.js.map +0 -1
- package/dist/rsc/__tests__/helpers.test.d.ts +0 -2
- package/dist/rsc/__tests__/helpers.test.d.ts.map +0 -1
- package/dist/rsc/__tests__/helpers.test.js +0 -140
- package/dist/rsc/__tests__/helpers.test.js.map +0 -1
- package/dist/rsc/handler.d.ts +0 -45
- package/dist/rsc/handler.d.ts.map +0 -1
- package/dist/rsc/handler.js +0 -1172
- package/dist/rsc/handler.js.map +0 -1
- package/dist/rsc/helpers.d.ts +0 -16
- package/dist/rsc/helpers.d.ts.map +0 -1
- package/dist/rsc/helpers.js +0 -55
- package/dist/rsc/helpers.js.map +0 -1
- package/dist/rsc/index.d.ts +0 -22
- package/dist/rsc/index.d.ts.map +0 -1
- package/dist/rsc/index.js +0 -23
- package/dist/rsc/index.js.map +0 -1
- package/dist/rsc/nonce.d.ts +0 -9
- package/dist/rsc/nonce.d.ts.map +0 -1
- package/dist/rsc/nonce.js +0 -18
- package/dist/rsc/nonce.js.map +0 -1
- package/dist/rsc/types.d.ts +0 -206
- package/dist/rsc/types.d.ts.map +0 -1
- package/dist/rsc/types.js +0 -8
- package/dist/rsc/types.js.map +0 -1
- package/dist/search-params.d.ts +0 -103
- package/dist/search-params.d.ts.map +0 -1
- package/dist/search-params.js +0 -74
- package/dist/search-params.js.map +0 -1
- package/dist/segment-system.d.ts +0 -75
- package/dist/segment-system.d.ts.map +0 -1
- package/dist/segment-system.js +0 -336
- package/dist/segment-system.js.map +0 -1
- package/dist/server/context.d.ts +0 -245
- package/dist/server/context.d.ts.map +0 -1
- package/dist/server/context.js +0 -197
- package/dist/server/context.js.map +0 -1
- package/dist/server/fetchable-loader-store.d.ts +0 -18
- package/dist/server/fetchable-loader-store.d.ts.map +0 -1
- package/dist/server/fetchable-loader-store.js +0 -18
- package/dist/server/fetchable-loader-store.js.map +0 -1
- package/dist/server/handle-store.d.ts +0 -85
- package/dist/server/handle-store.d.ts.map +0 -1
- package/dist/server/handle-store.js +0 -142
- package/dist/server/handle-store.js.map +0 -1
- package/dist/server/loader-registry.d.ts +0 -55
- package/dist/server/loader-registry.d.ts.map +0 -1
- package/dist/server/loader-registry.js +0 -132
- package/dist/server/loader-registry.js.map +0 -1
- package/dist/server/request-context.d.ts +0 -226
- package/dist/server/request-context.d.ts.map +0 -1
- package/dist/server/request-context.js +0 -290
- package/dist/server/request-context.js.map +0 -1
- package/dist/server/root-layout.d.ts +0 -4
- package/dist/server/root-layout.d.ts.map +0 -1
- package/dist/server/root-layout.js +0 -5
- package/dist/server/root-layout.js.map +0 -1
- package/dist/server.d.ts +0 -15
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -20
- package/dist/server.js.map +0 -1
- package/dist/ssr/__tests__/ssr-handler.test.d.ts +0 -2
- package/dist/ssr/__tests__/ssr-handler.test.d.ts.map +0 -1
- package/dist/ssr/__tests__/ssr-handler.test.js +0 -132
- package/dist/ssr/__tests__/ssr-handler.test.js.map +0 -1
- package/dist/ssr/index.d.ts +0 -98
- package/dist/ssr/index.d.ts.map +0 -1
- package/dist/ssr/index.js +0 -158
- package/dist/ssr/index.js.map +0 -1
- package/dist/static-handler.d.ts +0 -50
- package/dist/static-handler.d.ts.map +0 -1
- package/dist/static-handler.gen.d.ts +0 -5
- package/dist/static-handler.gen.d.ts.map +0 -1
- package/dist/static-handler.gen.js +0 -5
- package/dist/static-handler.gen.js.map +0 -1
- package/dist/static-handler.js +0 -29
- package/dist/static-handler.js.map +0 -1
- package/dist/testing/vitest.js +0 -82
- package/dist/theme/ThemeProvider.d.ts +0 -20
- package/dist/theme/ThemeProvider.d.ts.map +0 -1
- package/dist/theme/ThemeProvider.js +0 -240
- package/dist/theme/ThemeProvider.js.map +0 -1
- package/dist/theme/ThemeScript.d.ts +0 -48
- package/dist/theme/ThemeScript.d.ts.map +0 -1
- package/dist/theme/ThemeScript.js +0 -13
- package/dist/theme/ThemeScript.js.map +0 -1
- package/dist/theme/__tests__/theme.test.d.ts +0 -2
- package/dist/theme/__tests__/theme.test.d.ts.map +0 -1
- package/dist/theme/__tests__/theme.test.js +0 -103
- package/dist/theme/__tests__/theme.test.js.map +0 -1
- package/dist/theme/constants.d.ts +0 -29
- package/dist/theme/constants.d.ts.map +0 -1
- package/dist/theme/constants.js +0 -48
- package/dist/theme/constants.js.map +0 -1
- package/dist/theme/index.d.ts +0 -31
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/index.js +0 -36
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/theme-context.d.ts +0 -40
- package/dist/theme/theme-context.d.ts.map +0 -1
- package/dist/theme/theme-context.js +0 -60
- package/dist/theme/theme-context.js.map +0 -1
- package/dist/theme/theme-script.d.ts +0 -27
- package/dist/theme/theme-script.d.ts.map +0 -1
- package/dist/theme/theme-script.js +0 -147
- package/dist/theme/theme-script.js.map +0 -1
- package/dist/theme/types.d.ts +0 -163
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js +0 -11
- package/dist/theme/types.js.map +0 -1
- package/dist/theme/use-theme.d.ts +0 -12
- package/dist/theme/use-theme.d.ts.map +0 -1
- package/dist/theme/use-theme.js +0 -40
- package/dist/theme/use-theme.js.map +0 -1
- package/dist/types.d.ts +0 -1479
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -10
- package/dist/types.js.map +0 -1
- package/dist/urls.d.ts +0 -441
- package/dist/urls.d.ts.map +0 -1
- package/dist/urls.gen.d.ts +0 -8
- package/dist/urls.gen.d.ts.map +0 -1
- package/dist/urls.gen.js +0 -8
- package/dist/urls.gen.js.map +0 -1
- package/dist/urls.js +0 -443
- package/dist/urls.js.map +0 -1
- package/dist/use-loader.d.ts +0 -127
- package/dist/use-loader.d.ts.map +0 -1
- package/dist/use-loader.js +0 -237
- package/dist/use-loader.js.map +0 -1
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts +0 -2
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts.map +0 -1
- package/dist/vite/__tests__/ast-handler-extract.test.js +0 -294
- package/dist/vite/__tests__/ast-handler-extract.test.js.map +0 -1
- package/dist/vite/__tests__/expose-id-utils.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-id-utils.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-id-utils.test.js +0 -224
- package/dist/vite/__tests__/expose-id-utils.test.js.map +0 -1
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-internal-ids.test.js +0 -647
- package/dist/vite/__tests__/expose-internal-ids.test.js.map +0 -1
- package/dist/vite/__tests__/expose-router-id.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-router-id.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-router-id.test.js +0 -39
- package/dist/vite/__tests__/expose-router-id.test.js.map +0 -1
- package/dist/vite/ast-handler-extract.d.ts +0 -49
- package/dist/vite/ast-handler-extract.d.ts.map +0 -1
- package/dist/vite/ast-handler-extract.js +0 -249
- package/dist/vite/ast-handler-extract.js.map +0 -1
- package/dist/vite/expose-action-id.d.ts +0 -19
- package/dist/vite/expose-action-id.d.ts.map +0 -1
- package/dist/vite/expose-action-id.js +0 -250
- package/dist/vite/expose-action-id.js.map +0 -1
- package/dist/vite/expose-id-utils.d.ts +0 -69
- package/dist/vite/expose-id-utils.d.ts.map +0 -1
- package/dist/vite/expose-id-utils.js +0 -289
- package/dist/vite/expose-id-utils.js.map +0 -1
- package/dist/vite/expose-internal-ids.d.ts +0 -22
- package/dist/vite/expose-internal-ids.d.ts.map +0 -1
- package/dist/vite/expose-internal-ids.js +0 -886
- package/dist/vite/expose-internal-ids.js.map +0 -1
- package/dist/vite/index.d.ts +0 -149
- package/dist/vite/index.d.ts.map +0 -1
- package/dist/vite/index.js.bak +0 -5448
- package/dist/vite/index.js.map +0 -1
- package/dist/vite/index.named-routes.gen.ts +0 -103
- package/dist/vite/package-resolution.d.ts +0 -43
- package/dist/vite/package-resolution.d.ts.map +0 -1
- package/dist/vite/package-resolution.js +0 -112
- package/dist/vite/package-resolution.js.map +0 -1
- package/dist/vite/virtual-entries.d.ts +0 -25
- package/dist/vite/virtual-entries.d.ts.map +0 -1
- package/dist/vite/virtual-entries.js +0 -110
- package/dist/vite/virtual-entries.js.map +0 -1
package/dist/vite/index.js
CHANGED
|
@@ -2130,7 +2130,7 @@ import { resolve } from "node:path";
|
|
|
2130
2130
|
// package.json
|
|
2131
2131
|
var package_default = {
|
|
2132
2132
|
name: "@rangojs/router",
|
|
2133
|
-
version: "0.0.0-experimental.
|
|
2133
|
+
version: "0.0.0-experimental.122",
|
|
2134
2134
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
2135
2135
|
keywords: [
|
|
2136
2136
|
"react",
|
package/package.json
CHANGED
|
@@ -7,8 +7,9 @@ argument-hint:
|
|
|
7
7
|
# cache() vs "use cache" — When to Use Which
|
|
8
8
|
|
|
9
9
|
Both mechanisms share the same backing store and cache profiles, and both accept
|
|
10
|
-
an optional `tags` field (
|
|
11
|
-
below). They differ in scope, cache
|
|
10
|
+
an optional `tags` field (honored by the built-in stores — invalidate with
|
|
11
|
+
`updateTag`/`revalidateTag`; see "Two axes" below). They differ in scope, cache
|
|
12
|
+
key, execution model, and runtime control.
|
|
12
13
|
|
|
13
14
|
## Two axes — do not conflate
|
|
14
15
|
|
|
@@ -18,10 +19,11 @@ caching:
|
|
|
18
19
|
|
|
19
20
|
1. **Stored-value freshness** — _is a cached value still good?_
|
|
20
21
|
→ `"use cache"` (fn/component), `cache()` (segment), loader `cache()` (loader data).
|
|
21
|
-
Entries expire by **TTL/SWR
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
Entries expire by **TTL/SWR** and can be tagged (`cache({ tags })` or runtime
|
|
23
|
+
`cacheTag(...tags)`). Built-in stores (`MemorySegmentCacheStore`, `CFCacheStore`)
|
|
24
|
+
index by tag; invalidate on demand with `updateTag(...tags)` (awaitable,
|
|
25
|
+
read-your-own-writes) or `revalidateTag(...tags)` (background, non-blocking).
|
|
26
|
+
Both hard-purge; the difference is awaitability, not stale-serving.
|
|
25
27
|
2. **Client-update selection** — _should this segment re-run and stream to the
|
|
26
28
|
client on this navigation/action?_
|
|
27
29
|
→ `revalidate()`. Covered in `/loader` and `/route`, **not here**.
|
package/skills/caching/SKILL.md
CHANGED
|
@@ -81,6 +81,78 @@ cache(
|
|
|
81
81
|
);
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
## Tag-Based Invalidation
|
|
85
|
+
|
|
86
|
+
Tag cached entries, then invalidate them on demand. Tags can be attached three ways:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// 1. Static tags in the cache() DSL
|
|
90
|
+
cache({ ttl: 300, tags: ["products"] }, () => [path("/products", List)]);
|
|
91
|
+
|
|
92
|
+
// 2. Dynamic tags (function of ctx)
|
|
93
|
+
cache(
|
|
94
|
+
{ ttl: 300, tags: (ctx) => [`product:${ctx.params.id}`, "products"] },
|
|
95
|
+
() => [path("/products/:id", Detail)],
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// 3. Runtime tags inside a "use cache" function
|
|
99
|
+
async function getProduct(id: string) {
|
|
100
|
+
"use cache";
|
|
101
|
+
cacheTag(`product:${id}`, "products"); // variadic, additive
|
|
102
|
+
return db.getProduct(id);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Invalidate with one of two server-only verbs (both variadic, imported from
|
|
107
|
+
`@rangojs/router`):
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// Server Action — read-your-own-writes. Await it so the action's own re-render
|
|
111
|
+
// (and the next navigation) sees fresh data.
|
|
112
|
+
async function updateProduct(formData: FormData) {
|
|
113
|
+
"use server";
|
|
114
|
+
await db.updateProduct(formData);
|
|
115
|
+
await updateTag("products");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Route handler / webhook — background, non-blocking (waitUntil). Hard-purge:
|
|
119
|
+
// the next read re-renders fresh (NOT stale-while-revalidate).
|
|
120
|
+
export async function POST() {
|
|
121
|
+
"use server";
|
|
122
|
+
revalidateTag("products");
|
|
123
|
+
return new Response("ok");
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
| API | Timing | Use in | Semantics |
|
|
128
|
+
| ------------------------ | --------------------------- | ------------------------- | ----------------------------------------------------- |
|
|
129
|
+
| `updateTag(...tags)` | awaitable (`Promise<void>`) | server actions | immediate; next read is fresh |
|
|
130
|
+
| `revalidateTag(...tags)` | background (`void`) | route handlers / webhooks | background (non-blocking); next read re-renders fresh |
|
|
131
|
+
|
|
132
|
+
Both built-in stores support tags. For `CFCacheStore`, distributed (cross-colo)
|
|
133
|
+
invalidation requires a `kv` namespace — the tag-invalidation markers live in
|
|
134
|
+
that same namespace; there is **no** separate tag-invalidation store to wire.
|
|
135
|
+
If no tag-capable store is configured, `updateTag`/`revalidateTag` warn and no-op.
|
|
136
|
+
|
|
137
|
+
By default `CFCacheStore` reads the KV marker on every tagged cache read
|
|
138
|
+
(strongest invalidation latency). To cut KV reads on hot tagged routes, set
|
|
139
|
+
`tagCacheTtl` (seconds) to cache each marker in the per-colo edge cache for that
|
|
140
|
+
window — the colo running `updateTag`/`revalidateTag` writes the fresh marker
|
|
141
|
+
into its own edge cache immediately (read-your-own-writes), while other colos
|
|
142
|
+
converge within `tagCacheTtl` (the **maximum extra cross-colo invalidation
|
|
143
|
+
latency** when no purge is wired). Keep it small (e.g. 30–60), or wire a purge
|
|
144
|
+
(below) and set it large. (Contrast `tagInvalidationTtl`, which must be _large_
|
|
145
|
+
— it bounds how long the KV marker itself lives and must exceed your max entry
|
|
146
|
+
TTL+SWR.)
|
|
147
|
+
|
|
148
|
+
To make other colos prompt without a short `tagCacheTtl`, pass `onRevalidateTag`:
|
|
149
|
+
each cached marker carries a namespaced Cloudflare `Cache-Tag`, and the hook is
|
|
150
|
+
handed exactly those tags (batched, once per `updateTag`/`revalidateTag` call) to
|
|
151
|
+
feed Cloudflare's purge-by-tag API — evicting the cached lookups everywhere.
|
|
152
|
+
Purge-by-tag is available on all plans (since April 2025), subject to per-plan
|
|
153
|
+
rate limits, so the batched single call matters. With a purge wired, `tagCacheTtl`
|
|
154
|
+
becomes a pure read-cost reducer + fallback window.
|
|
155
|
+
|
|
84
156
|
## Named Profile Shorthand
|
|
85
157
|
|
|
86
158
|
Use a named cache profile string instead of an options object. The profile must be
|
|
@@ -212,6 +284,80 @@ const router = createRouter<AppBindings>({
|
|
|
212
284
|
KV entries require `expirationTtl >= 60s`. Short-lived entries (< 60s total TTL)
|
|
213
285
|
are only cached in L1.
|
|
214
286
|
|
|
287
|
+
### Resilience & latency budgets
|
|
288
|
+
|
|
289
|
+
Every cache read is **fail-safe**: a degraded tier never stalls or fails the
|
|
290
|
+
request — it degrades to the next tier (L1 → L2 → render). Three optional latency
|
|
291
|
+
budgets (milliseconds) bound each tier so a slow colo or KV namespace cannot pin
|
|
292
|
+
a request behind it:
|
|
293
|
+
|
|
294
|
+
| Option | Default | Bounds |
|
|
295
|
+
| --------------------- | ------- | ----------------------------------- |
|
|
296
|
+
| `edgeLookupTimeoutMs` | `10` | L1 `cache.match` (the lookup) |
|
|
297
|
+
| `edgeReadTimeoutMs` | `20` | L1 body read (CF streams it lazily) |
|
|
298
|
+
| `kvReadTimeoutMs` | `170` | L2 / KV read |
|
|
299
|
+
|
|
300
|
+
Set any to `0` (or a negative value) to disable that budget and always await the
|
|
301
|
+
read. A non-finite value (e.g. `Number(env.UNSET)`) falls back to the default.
|
|
302
|
+
The tag-invalidation marker reads inherit these same budgets and **fail open** on
|
|
303
|
+
a KV timeout — the entry is served rather than wrongly treated as invalidated.
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
new CFCacheStore({
|
|
307
|
+
ctx,
|
|
308
|
+
kv: env.CACHE_KV,
|
|
309
|
+
defaults: { ttl: 60, swr: 300 },
|
|
310
|
+
// Raise a budget only if your HEALTHY reads legitimately run slower (large
|
|
311
|
+
// Flight payloads, far-from-colo regions); measure the p99 first. These are
|
|
312
|
+
// degradation guard-rails, not tuning levers for "slow is normal here".
|
|
313
|
+
kvReadTimeoutMs: 250,
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Failure handling, by kind — none of these fail the request:
|
|
318
|
+
|
|
319
|
+
| Failure | Behavior |
|
|
320
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
321
|
+
| Transient read error (5xx/blip) | Degrade to the next tier; entry left intact |
|
|
322
|
+
| Read budget exceeded (timeout) | Abandon the read, degrade to the next tier |
|
|
323
|
+
| Corrupt / unparseable L1 entry | Reported corrupt; degrade to L2 (served if present). The L1 entry is evicted ONLY when L2 has no copy — so the evict can't race the L2→L1 promote |
|
|
324
|
+
| Corrupt / unparseable KV entry | Reported corrupt; evicted (self-heal) + render (no tier below it) |
|
|
325
|
+
| Write failure | No-op (entry simply not cached); never throws |
|
|
326
|
+
|
|
327
|
+
Each is surfaced to the router's `onError` callback (phase `"cache"`, with
|
|
328
|
+
`metadata.category` one of `cache-read`, `cache-corrupt`, `cache-write`,
|
|
329
|
+
`cache-delete`, `cache-invalidate`, `stale-revalidation`) so you can observe
|
|
330
|
+
cache health without affecting users.
|
|
331
|
+
|
|
332
|
+
### Validating cache behavior with `debug`
|
|
333
|
+
|
|
334
|
+
Pass `debug` to emit one structured event per L1 read — use it to confirm on a
|
|
335
|
+
real deployment (via `wrangler tail`) that the store behaves as expected before
|
|
336
|
+
relying on it. It is intended for validation, not steady-state production.
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
new CFCacheStore({
|
|
340
|
+
ctx,
|
|
341
|
+
kv: env.CACHE_KV,
|
|
342
|
+
debug: true, // logs each CFCacheReadDebugEvent to the console
|
|
343
|
+
// ...or capture programmatically:
|
|
344
|
+
// debug: (event) => myTelemetry.record(event),
|
|
345
|
+
});
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Each event reports which tier answered and why (`outcome`: `l1-fresh`,
|
|
349
|
+
`l1-stale-revalidate`, `l1-revalidating-guarded`, `match-timeout`, `match-error`,
|
|
350
|
+
`body-timeout`, `body-error`, `non-200`, `tag-invalidated`, `l1-miss`, `kv-fresh`,
|
|
351
|
+
`kv-stale`, `kv-stale-suppressed`, `kv-miss`, `kv-timeout`, `error`), the
|
|
352
|
+
staleness / revalidating timestamps, and the measured per-tier durations:
|
|
353
|
+
`matchMs` (the L1 `match`), `markerMs` (the tag-marker resolution tail for a
|
|
354
|
+
tagged entry, between `matchMs` and `bodyReadMs`; absent or 0 for an untagged
|
|
355
|
+
entry or a per-request memo hit), and `bodyReadMs` (the L1 body read). A
|
|
356
|
+
persistently large `markerMs` signals a degraded KV namespace; on a healthy
|
|
357
|
+
deployment KV keeps markers hot in its per-colo edge cache, so it stays a few
|
|
358
|
+
milliseconds. `match-error` (a transient `cache.match` rejection that falls
|
|
359
|
+
through to L2) is kept distinct from a plain `l1-miss`.
|
|
360
|
+
|
|
215
361
|
## Cache purity & tainted objects
|
|
216
362
|
|
|
217
363
|
A `cache()` boundary caches everything except loaders, so anything read inside a
|
|
@@ -288,16 +288,33 @@ export const Product = Passthrough(ProductDef, async (ctx) => {
|
|
|
288
288
|
Use `Passthrough()` whenever the Next.js route has `dynamicParams: true` (the
|
|
289
289
|
default) or serves an open-ended param space. See `/prerender` for full API.
|
|
290
290
|
|
|
291
|
-
### Revalidation:
|
|
291
|
+
### Revalidation: two distinct axes
|
|
292
292
|
|
|
293
|
-
Next.js
|
|
294
|
-
|
|
293
|
+
Next.js conflates two things under "revalidation." Rango separates them — and
|
|
294
|
+
tag-based cache invalidation now maps directly.
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
**1. Cache invalidation (bust cached values) — direct equivalent.** Tag entries
|
|
297
|
+
with `cache({ tags })` or, inside a `"use cache"` function, runtime
|
|
298
|
+
`cacheTag(...tags)`. Then invalidate by tag:
|
|
297
299
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
```typescript
|
|
301
|
+
// Next.js Rango
|
|
302
|
+
// revalidateTag("products") → await updateTag("products") // in a server action: awaitable,
|
|
303
|
+
// // read-your-own-writes (next render is fresh)
|
|
304
|
+
// or revalidateTag("products") // in a route handler / webhook:
|
|
305
|
+
// // background, non-blocking (hard-purge)
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
`updateTag` is awaitable and immediate; `revalidateTag` is fire-and-forget. Both
|
|
309
|
+
hard-purge (the next read re-renders fresh); the only difference is awaitability —
|
|
310
|
+
despite the Next.js name, `revalidateTag` here is NOT stale-while-revalidate.
|
|
311
|
+
Built-in stores (`MemorySegmentCacheStore`, `CFCacheStore`) index by tag. Next's
|
|
312
|
+
`revalidatePath` has no path-based equivalent — tag the relevant entries instead.
|
|
313
|
+
|
|
314
|
+
**2. Partial-render selection (which segments re-run after an action).** This is
|
|
315
|
+
NOT cache invalidation — it is `revalidate()`, controlling which segments
|
|
316
|
+
(layouts, paths, loaders, parallels) recompute during partial action
|
|
317
|
+
re-rendering:
|
|
301
318
|
|
|
302
319
|
```typescript
|
|
303
320
|
// Re-run this layout when a blog action fires
|
|
@@ -323,15 +340,18 @@ cache({ ttl: 60, swr: 300 }, () => [
|
|
|
323
340
|
]);
|
|
324
341
|
```
|
|
325
342
|
|
|
326
|
-
The
|
|
343
|
+
The two axes compose: `updateTag()` / `revalidateTag()` bust cached values;
|
|
344
|
+
`revalidate()` selects which segments re-render and stream to the client after an
|
|
345
|
+
action.
|
|
327
346
|
|
|
328
|
-
|
|
329
|
-
- Rango asks "which segments should re-run after this action?"
|
|
347
|
+
When migrating:
|
|
330
348
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
`
|
|
349
|
+
- `revalidateTag(tag)` → `await updateTag(tag)` (in a server action) or
|
|
350
|
+
`revalidateTag(tag)` (in a route handler / webhook). Effectively 1:1.
|
|
351
|
+
- `revalidatePath(path)` → no path-based equivalent; tag the entries on that
|
|
352
|
+
route (`cache({ tags })` / `cacheTag(...)`) and invalidate by tag.
|
|
353
|
+
- To also force specific segments to re-render after the action (independent of
|
|
354
|
+
cache busting), attach a `revalidate()` rule at those segment boundaries.
|
|
335
355
|
|
|
336
356
|
## 4. Middleware
|
|
337
357
|
|
|
@@ -463,7 +483,7 @@ Server actions work the same way — `"use server"` directive, `useActionState`,
|
|
|
463
483
|
|
|
464
484
|
Key difference: in Rango, route middleware does NOT wrap action execution. Actions only see global middleware context. Use `getRequestContext()` in actions to access `ctx.set()`/`ctx.get()`.
|
|
465
485
|
|
|
466
|
-
Next.js's `
|
|
486
|
+
Next.js's `revalidateTag()` maps directly: tag entries via `cache({ tags })` / `cacheTag(...)`, then invalidate. **In a server action use `await updateTag(tag)`** — it is read-your-own-writes, so the action's own re-render sees fresh data; `revalidateTag(tag)` is a background (non-blocking) hard-purge and is NOT read-your-own-writes, so reserve it for route handlers / webhooks (calling it from an action can leave that action's re-render stale). `revalidatePath()` has no path-based equivalent — tag the route's entries instead. Separately, to force specific matched segments (path/layout/parallel/intercept) and their loaders to re-render after an action, attach a `revalidate(({ actionId }) => ...)` rule to that segment or loader registration. See `/server-actions` for the full pattern (validation, error handling, file uploads), `/caching` for tag invalidation, and `/loader` for revalidation rule semantics.
|
|
467
487
|
|
|
468
488
|
## 8. Metadata / Head
|
|
469
489
|
|
package/skills/rango/SKILL.md
CHANGED
|
@@ -28,10 +28,10 @@ with the shape, then pick a primitive.
|
|
|
28
28
|
cache hit streams UI instantly while loaders resolve fresh alongside). Opt into
|
|
29
29
|
caching explicitly. See `/loader` → "Parallel and streaming".
|
|
30
30
|
- **One identity, one store** — loaders, handles, cached fns, and actions are all
|
|
31
|
-
`path#export`; all caches share one store. Entries expire by TTL/SWR
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
`path#export`; all caches share one store. Entries expire by TTL/SWR, and are
|
|
32
|
+
tagged via `cache({ tags })` or runtime `cacheTag(...tags)`; built-in stores
|
|
33
|
+
index by tag and invalidate via `updateTag(...tags)` (awaitable, read-your-own-writes)
|
|
34
|
+
or `revalidateTag(...tags)` (background, non-blocking).
|
|
35
35
|
- **Type-safe end to end** — route names, params, search schemas, loader return
|
|
36
36
|
types, context vars, and `href` / `reverse` are checked at compile time
|
|
37
37
|
(`/typesafety`).
|
|
@@ -85,10 +85,10 @@ To decide where something can live: **does it define a URL? structure, stays in
|
|
|
85
85
|
(`set`/`header`/`setTheme`/`onResponse`/`setLocationState`) throw; `ctx.use(Handle)`
|
|
86
86
|
is captured on miss and replayed on hit. (The non-cacheable read guard is a
|
|
87
87
|
separate `cache()`-boundary check — see the correctness bullet below.)
|
|
88
|
-
- One identity `path#export` (`functionId`/`$$id`/`actionId`); one store.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
- One identity `path#export` (`functionId`/`$$id`/`actionId`); one store. Freshness
|
|
89
|
+
is TTL/SWR expiry plus tag-based invalidation: tag via `cache({ tags })` /
|
|
90
|
+
`cacheTag(...tags)`, then `updateTag(...tags)` (awaitable) or `revalidateTag(...tags)`
|
|
91
|
+
(background). Built-in stores index by tag.
|
|
92
92
|
- `useLoader` / `useHandle` / `useFetchLoader` are client-only.
|
|
93
93
|
- Caches are correctness-first: persistent store keys are version-segmented (no
|
|
94
94
|
cross-deploy drift), the forward/back cache is mutation-aware, and
|
|
@@ -111,13 +111,13 @@ To decide where something can live: **does it define a URL? structure, stays in
|
|
|
111
111
|
Same words, different jobs — this is the most common source of the
|
|
112
112
|
`revalidate()`-is-caching misread.
|
|
113
113
|
|
|
114
|
-
| You may know
|
|
115
|
-
|
|
|
116
|
-
| Next.js `export const revalidate = N`
|
|
117
|
-
| Next.js `
|
|
118
|
-
| React Router / Remix `shouldRevalidate`
|
|
119
|
-
| HTTP `Cache-Control` / ISR
|
|
120
|
-
| Remix/RR `loader`
|
|
114
|
+
| You may know | Maps to Rango axis | Watch out |
|
|
115
|
+
| --------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| Next.js `export const revalidate = N` | **Axis 1** (cache) | Same word, opposite meaning. Next's `revalidate` is time-based cache expiry; Rango's `revalidate()` is **axis 2**. Use `cache({ ttl })` for the Next behavior. |
|
|
117
|
+
| Next.js `revalidateTag` / `updateTag` | **Axis 1** (cache) | Cache busting by tag. Tag via `cache({ tags })` / `cacheTag(...tags)`; invalidate with `updateTag(...tags)` (awaitable, read-your-own-writes) or `revalidateTag(...tags)` (background, non-blocking). Built-in stores index by tag. No `revalidatePath` (path-based busting); use tags. |
|
|
118
|
+
| React Router / Remix `shouldRevalidate` | **Axis 2** | This is the correct mental model for Rango's `revalidate()`. |
|
|
119
|
+
| HTTP `Cache-Control` / ISR | **Axis 1** | Edge/document layer — see `/document-cache`. Separate from both `cache()` and `revalidate()`. |
|
|
120
|
+
| Remix/RR `loader` | live data | Like Rango loaders, fresh per request — but Rango loaders run in parallel and stream (latency overlaps first paint), and can opt into caching on demand. |
|
|
121
121
|
|
|
122
122
|
See `/cache-guide` for the axis-1 decision guide, `/loader` and `/route` for
|
|
123
123
|
`revalidate()` (axis 2), and `/document-cache` for the edge layer.
|
|
@@ -328,13 +328,15 @@ export async function getProducts() {
|
|
|
328
328
|
Writes to the same `SegmentCacheStore` as `cache()` DSL, `Static()`, and `Prerender()`.
|
|
329
329
|
One store, one configuration.
|
|
330
330
|
|
|
331
|
-
Cache entries (and `cacheProfiles`)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
331
|
+
Cache entries (and `cacheProfiles`) can be tagged via `cache({ tags })` or, inside
|
|
332
|
+
a `"use cache"` function, runtime `cacheTag(...tags)`. The built-in
|
|
333
|
+
`MemorySegmentCacheStore` and `CFCacheStore` index by tag. Invalidate on demand
|
|
334
|
+
with `updateTag(...tags)` (awaitable, read-your-own-writes; for server actions) or
|
|
335
|
+
`revalidateTag(...tags)` (background, non-blocking; for route handlers/webhooks).
|
|
336
|
+
Both hard-purge; the difference is awaitability, not stale-serving. For
|
|
337
|
+
`CFCacheStore`, distributed invalidation needs a `kv` namespace (markers live in
|
|
338
|
+
that same namespace). The separate `revalidate()` export is the client-update axis
|
|
339
|
+
(which segments re-render on a navigation or action), not a cache bust.
|
|
338
340
|
|
|
339
341
|
## Interaction with Other Caching
|
|
340
342
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache error reporting.
|
|
3
|
+
*
|
|
4
|
+
* Caches are best-effort: a read failure degrades to a miss (render fresh) and a
|
|
5
|
+
* write failure degrades to a no-op - they MUST NOT throw up and fail the
|
|
6
|
+
* request. But the failure must still be LOUD: it is logged to the console (so
|
|
7
|
+
* it is visible even in a background waitUntil task or when no hook is wired)
|
|
8
|
+
* AND routed through the router's onError callback (via the request context's
|
|
9
|
+
* deduped _reportBackgroundError) so consumers can observe cache degradation in
|
|
10
|
+
* their own telemetry.
|
|
11
|
+
*
|
|
12
|
+
* The one deliberate exception is the invalidation WRITE verb (updateTag ->
|
|
13
|
+
* store.invalidateTags): a failed durable marker write is rejected so an awaited
|
|
14
|
+
* updateTag() surfaces it (read-your-own-writes honesty). That is not a data
|
|
15
|
+
* read/write and does not go through this helper's swallow-and-degrade path.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { _getRequestContext } from "../server/request-context.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Minimal shape of a request context for error reporting. Passed explicitly by
|
|
22
|
+
* background tasks (waitUntil) where the ALS context is already gone, so the
|
|
23
|
+
* error can still reach the router's onError. Structural to avoid importing the
|
|
24
|
+
* full RequestContext type (request-context.ts imports CacheErrorCategory from
|
|
25
|
+
* here - a mutual type-only reference).
|
|
26
|
+
*/
|
|
27
|
+
export interface CacheErrorReporter {
|
|
28
|
+
_reportBackgroundError?: (
|
|
29
|
+
error: unknown,
|
|
30
|
+
category: CacheErrorCategory,
|
|
31
|
+
) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type CacheErrorCategory =
|
|
35
|
+
/** A read failed (transient infra: KV/Cache API error). Degrade to a miss. */
|
|
36
|
+
| "cache-read"
|
|
37
|
+
/** A write failed. Degrade to a no-op (entry simply not cached). */
|
|
38
|
+
| "cache-write"
|
|
39
|
+
/** A delete/eviction failed. Best-effort. */
|
|
40
|
+
| "cache-delete"
|
|
41
|
+
/**
|
|
42
|
+
* A STORED entry could not be parsed/deserialized (partial KV read, truncated
|
|
43
|
+
* Cache API body, malformed envelope/RSC payload). The entry is faulty and is
|
|
44
|
+
* evicted so subsequent reads do not keep failing on it. Distinct from
|
|
45
|
+
* cache-read so consumers can tell corruption from a transient outage.
|
|
46
|
+
*/
|
|
47
|
+
| "cache-corrupt"
|
|
48
|
+
/** A tag-invalidation side effect failed (e.g. the eager CDN purge hook). */
|
|
49
|
+
| "cache-invalidate"
|
|
50
|
+
/**
|
|
51
|
+
* A background stale-while-revalidate refresh failed (the `"use cache"`
|
|
52
|
+
* read-through path). The stale value was already served; the refresh that
|
|
53
|
+
* would have replaced it errored.
|
|
54
|
+
*/
|
|
55
|
+
| "stale-revalidation";
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Report a non-fatal cache error loudly without failing the request: always logs
|
|
59
|
+
* (label + error) and, when a request context is available, routes the error
|
|
60
|
+
* through the router's onError callback. Never throws.
|
|
61
|
+
*
|
|
62
|
+
* `ctx` is for callers running in a detached background task (waitUntil), where
|
|
63
|
+
* the ALS request context is already gone (so `_getRequestContext()` is null):
|
|
64
|
+
* they capture the context up front and pass it here so onError still fires.
|
|
65
|
+
* Foreground callers omit it and fall back to the ALS context.
|
|
66
|
+
*/
|
|
67
|
+
export function reportCacheError(
|
|
68
|
+
error: unknown,
|
|
69
|
+
category: CacheErrorCategory,
|
|
70
|
+
label: string,
|
|
71
|
+
ctx?: CacheErrorReporter,
|
|
72
|
+
): void {
|
|
73
|
+
console.error(`${label}:`, error);
|
|
74
|
+
try {
|
|
75
|
+
const target = ctx ?? _getRequestContext();
|
|
76
|
+
target?._reportBackgroundError?.(error, category);
|
|
77
|
+
} catch {
|
|
78
|
+
// Reporting must never itself break the cache path.
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Run a best-effort async cache task (typically scheduled via waitUntil), catching
|
|
84
|
+
* any rejection and routing it through reportCacheError so background cache work
|
|
85
|
+
* (non-blocking L1 writes, KV persistence, L1 promotion) reports failures via
|
|
86
|
+
* onError instead of throwing or silently swallowing. Never rejects.
|
|
87
|
+
*
|
|
88
|
+
* Pass `ctx` when the task runs detached (the ALS context is gone) and the
|
|
89
|
+
* failure should still reach onError; omit it to fall back to the ALS context.
|
|
90
|
+
*
|
|
91
|
+
* @example this.waitUntil(() => reportingAsync(() => cache.put(req, res), "cache-write", "[CFCacheStore] L1 write"))
|
|
92
|
+
*/
|
|
93
|
+
export async function reportingAsync(
|
|
94
|
+
task: () => Promise<unknown>,
|
|
95
|
+
category: CacheErrorCategory,
|
|
96
|
+
label: string,
|
|
97
|
+
ctx?: CacheErrorReporter,
|
|
98
|
+
): Promise<void> {
|
|
99
|
+
try {
|
|
100
|
+
await task();
|
|
101
|
+
} catch (error) {
|
|
102
|
+
reportCacheError(error, category, label, ctx);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import type { CacheDefaults, SegmentCacheStore } from "./types.js";
|
|
10
10
|
import { _getRequestContext } from "../server/request-context.js";
|
|
11
11
|
import type { RequestContext } from "../server/request-context.js";
|
|
12
|
+
import { normalizeTags } from "./cache-tag.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Default TTL for route-level cache() DSL and loader cache.
|
|
@@ -108,6 +109,64 @@ export async function resolveCacheKey(
|
|
|
108
109
|
return defaultKey;
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
// ============================================================================
|
|
113
|
+
// Cache Tag Resolution
|
|
114
|
+
// ============================================================================
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Resolve cache tags from a tags option (static array or function of ctx).
|
|
118
|
+
*
|
|
119
|
+
* Fails open: a thrown tag callback falls back to no tags rather than
|
|
120
|
+
* aborting the request. Tags are additive metadata (not identity), so a
|
|
121
|
+
* missing tag does not cause cache collisions, only a missed invalidation.
|
|
122
|
+
*
|
|
123
|
+
* Shared by the cache() DSL (cache-scope) and loader caching (loader-cache)
|
|
124
|
+
* so tag resolution behaves identically across every cache axis.
|
|
125
|
+
*/
|
|
126
|
+
export function resolveTagsOption<TEnv>(
|
|
127
|
+
tags: string[] | ((ctx: RequestContext<TEnv>) => string[]) | undefined,
|
|
128
|
+
ctx: RequestContext<TEnv> | undefined,
|
|
129
|
+
label: string,
|
|
130
|
+
): string[] | undefined {
|
|
131
|
+
if (!tags) return undefined;
|
|
132
|
+
if (typeof tags === "function") {
|
|
133
|
+
if (!ctx) {
|
|
134
|
+
// A dynamic tags function needs the request context to run. Without it
|
|
135
|
+
// (e.g. resolved outside a request, at build/prerender time) the entry is
|
|
136
|
+
// cached UNTAGGED and can never be invalidated - surface that rather than
|
|
137
|
+
// silently dropping the tags, matching the thrown-callback branch below.
|
|
138
|
+
console.warn(
|
|
139
|
+
`[${label}] Dynamic tags function present but no request context; ` +
|
|
140
|
+
`caching without tags (this entry will not be tag-invalidatable).`,
|
|
141
|
+
);
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
return normalizeTagList(tags(ctx));
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error(
|
|
148
|
+
`[${label}] Tags function failed, caching without tags:`,
|
|
149
|
+
error,
|
|
150
|
+
);
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return normalizeTagList(tags);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Normalize a resolved tags array so the WRITE path matches the invalidate path:
|
|
159
|
+
* updateTag()/revalidateTag()/cacheTag() all drop empty/whitespace-only tags via
|
|
160
|
+
* normalizeTag(). Without this, an empty tag attached at write time would enter
|
|
161
|
+
* the store index but could never be invalidated (the verbs normalize it away),
|
|
162
|
+
* and on CFCacheStore would also cost a wasted KV marker read per request.
|
|
163
|
+
* Returns undefined when nothing usable remains, keeping the entry header-free.
|
|
164
|
+
*/
|
|
165
|
+
function normalizeTagList(tags: string[]): string[] | undefined {
|
|
166
|
+
const out = normalizeTags(tags);
|
|
167
|
+
return out.length > 0 ? out : undefined;
|
|
168
|
+
}
|
|
169
|
+
|
|
111
170
|
// ============================================================================
|
|
112
171
|
// Cache Store Resolution
|
|
113
172
|
// ============================================================================
|
|
@@ -120,6 +179,41 @@ export async function resolveCacheKey(
|
|
|
120
179
|
export function resolveCacheStore(
|
|
121
180
|
explicitStore: SegmentCacheStore | undefined,
|
|
122
181
|
): SegmentCacheStore | null {
|
|
123
|
-
if (explicitStore)
|
|
182
|
+
if (explicitStore) {
|
|
183
|
+
// Register explicit per-scope stores so updateTag()/revalidateTag() can
|
|
184
|
+
// reach them. This is the single chokepoint every cache axis (segment,
|
|
185
|
+
// response, loader) resolves through, so registering here covers them all
|
|
186
|
+
// eagerly - no dependence on whether a tagged write has happened yet. The
|
|
187
|
+
// app-level store is intentionally not registered (always reachable via
|
|
188
|
+
// ctx._cacheStore).
|
|
189
|
+
registerExplicitTaggedStore(explicitStore);
|
|
190
|
+
return explicitStore;
|
|
191
|
+
}
|
|
124
192
|
return _getRequestContext()?._cacheStore ?? null;
|
|
125
193
|
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Upper bound on the per-handler explicit-store registry. A module-singleton
|
|
197
|
+
* store (the recommended pattern) dedupes to a single entry and never approaches
|
|
198
|
+
* this. The cap bounds the niche case of an explicit store constructed PER
|
|
199
|
+
* request/boundary (e.g. a ctx-bound CFCacheStore, which must take a per-request
|
|
200
|
+
* ctx): without it the registry - which intentionally persists across requests so
|
|
201
|
+
* a server action's updateTag() can reach stores a prior render registered -
|
|
202
|
+
* would accumulate one dead instance per request and fan invalidation out to
|
|
203
|
+
* finished execution contexts. LRU-touch on re-resolution keeps a live, re-used
|
|
204
|
+
* store from being evicted by that churn.
|
|
205
|
+
*/
|
|
206
|
+
const EXPLICIT_STORE_REGISTRY_CAP = 64;
|
|
207
|
+
|
|
208
|
+
function registerExplicitTaggedStore(store: SegmentCacheStore): void {
|
|
209
|
+
const set = _getRequestContext()?._explicitTaggedStores;
|
|
210
|
+
if (!set) return;
|
|
211
|
+
// LRU touch: move an already-present store to the most-recent position (Set
|
|
212
|
+
// preserves insertion order) so a store re-resolved every request stays live.
|
|
213
|
+
set.delete(store);
|
|
214
|
+
set.add(store);
|
|
215
|
+
if (set.size > EXPLICIT_STORE_REGISTRY_CAP) {
|
|
216
|
+
const oldest = set.values().next().value;
|
|
217
|
+
if (oldest !== undefined) set.delete(oldest);
|
|
218
|
+
}
|
|
219
|
+
}
|