@rangojs/router 0.0.0-experimental.120 → 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 +2073 -218
- 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
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache Tag Invalidation API
|
|
3
|
+
*
|
|
4
|
+
* Two on-demand invalidation verbs, mirroring the distinction popularized by
|
|
5
|
+
* Next.js so consumers can pick the right consistency model:
|
|
6
|
+
*
|
|
7
|
+
* - updateTag(...tags): read-your-own-writes. Awaitable - resolves only after
|
|
8
|
+
* in-process invalidation across every configured store completes. Use in a
|
|
9
|
+
* Server Action and `await` it before the action re-renders, so the action's
|
|
10
|
+
* own response reflects the mutation.
|
|
11
|
+
*
|
|
12
|
+
* - revalidateTag(...tags): fire-and-forget via waitUntil - the response is not
|
|
13
|
+
* blocked. Use in Route Handlers / webhooks. NOTE: both verbs hard-purge; the
|
|
14
|
+
* only difference is awaitability. revalidateTag does NOT serve stale content -
|
|
15
|
+
* the next read after the invalidation lands is a hard miss that re-renders.
|
|
16
|
+
* (The name mirrors Next.js, where it is SWR; here it is background-purge.)
|
|
17
|
+
*
|
|
18
|
+
* Both fan out across the app-level store (ctx._cacheStore) and every explicit
|
|
19
|
+
* per-scope store from cache({ store }) registered for this handler
|
|
20
|
+
* (ctx._explicitTaggedStores), calling the store-level invalidateTags()
|
|
21
|
+
* primitive for each tag. A single configured store (the common case) owns its
|
|
22
|
+
* own tag index and distributed invalidation - there is no separate
|
|
23
|
+
* tag-invalidation store.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { _getRequestContext } from "../server/request-context.js";
|
|
27
|
+
import { reportingAsync } from "./cache-error.js";
|
|
28
|
+
import { normalizeTags } from "./cache-tag.js";
|
|
29
|
+
import type { SegmentCacheStore } from "./types.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Collect every store that may hold entries tagged for this request's handler:
|
|
33
|
+
* the app-level store plus all explicit per-scope stores (deduplicated). Splits
|
|
34
|
+
* them into tag-capable (implement invalidateTags()) and not, so callers can
|
|
35
|
+
* warn about configured stores whose tagged entries will NOT be invalidated.
|
|
36
|
+
*
|
|
37
|
+
* `hasContext` reports whether an ALS request context existed at all. Without one
|
|
38
|
+
* (e.g. a queue consumer or cron job calling updateTag/revalidateTag) no stores
|
|
39
|
+
* are reachable, and the empty-capable case is a missing-context problem, not a
|
|
40
|
+
* store-config problem - callers branch on this to warn about the right cause.
|
|
41
|
+
*/
|
|
42
|
+
function collectStores(): {
|
|
43
|
+
capable: SegmentCacheStore[];
|
|
44
|
+
incapable: number;
|
|
45
|
+
hasContext: boolean;
|
|
46
|
+
} {
|
|
47
|
+
const ctx = _getRequestContext();
|
|
48
|
+
const stores = new Set<SegmentCacheStore>();
|
|
49
|
+
if (ctx?._cacheStore) stores.add(ctx._cacheStore);
|
|
50
|
+
if (ctx?._explicitTaggedStores) {
|
|
51
|
+
for (const store of ctx._explicitTaggedStores) stores.add(store);
|
|
52
|
+
}
|
|
53
|
+
const capable: SegmentCacheStore[] = [];
|
|
54
|
+
let incapable = 0;
|
|
55
|
+
for (const store of stores) {
|
|
56
|
+
if (typeof store.invalidateTags === "function") capable.push(store);
|
|
57
|
+
else incapable++;
|
|
58
|
+
}
|
|
59
|
+
return { capable, incapable, hasContext: ctx != null };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Production-visible warning. A misconfigured store silently dropping
|
|
64
|
+
* invalidations is a data-correctness footgun, so this surfaces in every
|
|
65
|
+
* environment (not dev-only).
|
|
66
|
+
*/
|
|
67
|
+
function warnNoTagStore(fn: string, tags: string[]): void {
|
|
68
|
+
console.warn(
|
|
69
|
+
`[${fn}] No tag-capable cache store is configured; tags ` +
|
|
70
|
+
`[${tags.join(", ")}] were not invalidated. The configured store must ` +
|
|
71
|
+
`implement invalidateTags() (the built-in MemorySegmentCacheStore and ` +
|
|
72
|
+
`CFCacheStore do).`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Production-visible warning for the no-request-context case. Distinct from
|
|
78
|
+
* warnNoTagStore: the stores are not unreachable because they are misconfigured,
|
|
79
|
+
* but because there is no ALS request context to reach them through (e.g. a queue
|
|
80
|
+
* consumer or scheduled job). Naming the real cause keeps consumers from chasing
|
|
81
|
+
* a store-config red herring.
|
|
82
|
+
*/
|
|
83
|
+
function warnNoRequestContext(fn: string, tags: string[]): void {
|
|
84
|
+
console.warn(
|
|
85
|
+
`[${fn}] Called outside a request context (e.g. from a queue consumer or ` +
|
|
86
|
+
`scheduled job); no cache stores are reachable and tags ` +
|
|
87
|
+
`[${tags.join(", ")}] were not invalidated. Invoke it within a request ` +
|
|
88
|
+
`(Server Action or route handler).`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Production-visible warning for mixed-store configs: at least one configured
|
|
94
|
+
* store does not support tag invalidation, so its tagged entries (if any) are
|
|
95
|
+
* left stale even though other stores were invalidated.
|
|
96
|
+
*/
|
|
97
|
+
function warnPartialTagStore(fn: string, incapable: number): void {
|
|
98
|
+
console.warn(
|
|
99
|
+
`[${fn}] ${incapable} configured cache store(s) do not implement ` +
|
|
100
|
+
`invalidateTags(); their tagged entries were NOT invalidated. Use a ` +
|
|
101
|
+
`tag-capable store (e.g. MemorySegmentCacheStore / CFCacheStore) for any ` +
|
|
102
|
+
`cache({ store }) boundary whose entries you invalidate by tag.`,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function invalidateAcross(
|
|
107
|
+
stores: SegmentCacheStore[],
|
|
108
|
+
tags: string[],
|
|
109
|
+
): Promise<void> {
|
|
110
|
+
// One invalidateTags(tags) call per store: the store receives the whole tag
|
|
111
|
+
// batch so it can do a single CDN purge request rather than one per tag.
|
|
112
|
+
//
|
|
113
|
+
// allSettled, not all: a store's invalidateTags() can reject (e.g. CFCacheStore
|
|
114
|
+
// surfaces a failed durable KV marker write). With Promise.all, the first
|
|
115
|
+
// rejection would short-circuit and the other stores' outcomes would go
|
|
116
|
+
// unobserved. Attempt every store, then surface a combined error so an awaited
|
|
117
|
+
// updateTag() still rejects (read-your-own-writes honesty) without masking the
|
|
118
|
+
// stores that did succeed.
|
|
119
|
+
const results = await Promise.allSettled(
|
|
120
|
+
stores.map((store) => store.invalidateTags!(tags)),
|
|
121
|
+
);
|
|
122
|
+
const errors = results
|
|
123
|
+
.filter((r): r is PromiseRejectedResult => r.status === "rejected")
|
|
124
|
+
.map((r) => r.reason);
|
|
125
|
+
if (errors.length > 0) {
|
|
126
|
+
const err = new Error(
|
|
127
|
+
`[tag invalidation] ${errors.length}/${stores.length} store(s) failed to ` +
|
|
128
|
+
`invalidate tags [${tags.join(", ")}]; their entries may still serve ` +
|
|
129
|
+
`stale data. Retry the invalidation.`,
|
|
130
|
+
);
|
|
131
|
+
(err as Error & { cause?: unknown }).cause = errors[0];
|
|
132
|
+
throw err;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Immediately expire every cache entry tagged with any of `tags`, resolving
|
|
138
|
+
* once in-process invalidation across all configured stores completes.
|
|
139
|
+
*
|
|
140
|
+
* Read-your-own-writes: because the returned promise resolves before you return
|
|
141
|
+
* from a Server Action, awaiting it guarantees the action's own re-render (and
|
|
142
|
+
* any subsequent read) sees fresh data.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* async function updateProduct(formData: FormData) {
|
|
147
|
+
* "use server";
|
|
148
|
+
* await db.updateProduct(formData);
|
|
149
|
+
* await updateTag("products"); // next render is fresh
|
|
150
|
+
* }
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
export async function updateTag(...tags: string[]): Promise<void> {
|
|
154
|
+
const valid = normalizeTags(tags);
|
|
155
|
+
if (valid.length === 0) return;
|
|
156
|
+
|
|
157
|
+
const { capable, incapable, hasContext } = collectStores();
|
|
158
|
+
if (capable.length === 0) {
|
|
159
|
+
if (hasContext) warnNoTagStore("updateTag", valid);
|
|
160
|
+
else warnNoRequestContext("updateTag", valid);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (incapable > 0) warnPartialTagStore("updateTag", incapable);
|
|
164
|
+
|
|
165
|
+
await invalidateAcross(capable, valid);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Invalidate every cache entry tagged with any of `tags` in the background,
|
|
170
|
+
* without blocking the current response (fire-and-forget via waitUntil).
|
|
171
|
+
*
|
|
172
|
+
* This is NOT stale-while-revalidate: like updateTag() it hard-purges, so the
|
|
173
|
+
* next read after the invalidation lands is a miss that re-renders fresh. The
|
|
174
|
+
* only difference from updateTag() is awaitability - revalidateTag() defers the
|
|
175
|
+
* purge off the response path and is not awaited.
|
|
176
|
+
*
|
|
177
|
+
* Use in Route Handlers / webhooks. For read-your-own-writes inside a Server
|
|
178
|
+
* Action, use updateTag() instead so the action's own response is fresh.
|
|
179
|
+
*
|
|
180
|
+
* Fire-and-forget: because this returns void and runs in the background, a
|
|
181
|
+
* failed durable marker write (e.g. a transient KV outage) is NOT surfaced to
|
|
182
|
+
* the caller. It IS reported - logged loudly and routed through the router's
|
|
183
|
+
* `onError` callback (phase `cache`, `metadata.category === "cache-invalidate"`)
|
|
184
|
+
* via reportingAsync - so the failure is observable in telemetry even though it
|
|
185
|
+
* cannot be awaited. If you need the invalidation to be CONFIRMED (and to retry
|
|
186
|
+
* on failure), use `await updateTag()` instead, which rejects when a store's
|
|
187
|
+
* durable write fails.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* // route handler invoked by an external webhook
|
|
192
|
+
* export async function POST() {
|
|
193
|
+
* "use server";
|
|
194
|
+
* revalidateTag("products");
|
|
195
|
+
* return new Response("ok");
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
export function revalidateTag(...tags: string[]): void {
|
|
200
|
+
const valid = normalizeTags(tags);
|
|
201
|
+
if (valid.length === 0) return;
|
|
202
|
+
|
|
203
|
+
const { capable, incapable, hasContext } = collectStores();
|
|
204
|
+
if (capable.length === 0) {
|
|
205
|
+
if (hasContext) warnNoTagStore("revalidateTag", valid);
|
|
206
|
+
else warnNoRequestContext("revalidateTag", valid);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (incapable > 0) warnPartialTagStore("revalidateTag", incapable);
|
|
210
|
+
|
|
211
|
+
const ctx = _getRequestContext();
|
|
212
|
+
// reportingAsync never rejects: it catches a failed durable write and routes
|
|
213
|
+
// it through reportCacheError (loud log + onError). This is the only place a
|
|
214
|
+
// revalidateTag failure can be observed, since it is not awaitable. Pass ctx
|
|
215
|
+
// explicitly - the run executes in a detached waitUntil where the ALS context
|
|
216
|
+
// is gone, so onError fires only if we hand it the captured context.
|
|
217
|
+
const run = () =>
|
|
218
|
+
reportingAsync(
|
|
219
|
+
() => invalidateAcross(capable, valid),
|
|
220
|
+
"cache-invalidate",
|
|
221
|
+
"[revalidateTag] background invalidation",
|
|
222
|
+
ctx,
|
|
223
|
+
);
|
|
224
|
+
if (ctx?.waitUntil) {
|
|
225
|
+
ctx.waitUntil(run);
|
|
226
|
+
} else {
|
|
227
|
+
// No request context (e.g. called outside ALS): best-effort background run.
|
|
228
|
+
void run();
|
|
229
|
+
}
|
|
230
|
+
}
|
package/src/cache/types.ts
CHANGED
|
@@ -136,12 +136,14 @@ export interface SegmentCacheStore<TEnv = unknown> {
|
|
|
136
136
|
* @param response - Response to cache (will be cloned)
|
|
137
137
|
* @param ttl - Time-to-live in seconds
|
|
138
138
|
* @param swr - Optional stale-while-revalidate window in seconds
|
|
139
|
+
* @param tags - Optional cache tags for invalidation
|
|
139
140
|
*/
|
|
140
141
|
putResponse?(
|
|
141
142
|
key: string,
|
|
142
143
|
response: Response,
|
|
143
144
|
ttl: number,
|
|
144
145
|
swr?: number,
|
|
146
|
+
tags?: string[],
|
|
145
147
|
): Promise<void>;
|
|
146
148
|
|
|
147
149
|
// ============================================================================
|
|
@@ -167,6 +169,20 @@ export interface SegmentCacheStore<TEnv = unknown> {
|
|
|
167
169
|
value: string,
|
|
168
170
|
options?: CacheItemOptions,
|
|
169
171
|
): Promise<void>;
|
|
172
|
+
|
|
173
|
+
// ============================================================================
|
|
174
|
+
// Tag-based Invalidation (optional)
|
|
175
|
+
// ============================================================================
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Invalidate every cache entry (segment, response, item) tagged with any of
|
|
179
|
+
* `tags`. Store-level primitive that the public updateTag()/revalidateTag()
|
|
180
|
+
* APIs delegate to. Receives ALL of one invalidation call's tags at once so
|
|
181
|
+
* stores can batch their work (e.g. a single CDN purge request rather than
|
|
182
|
+
* one per tag). Stores that do not support tags simply omit this method.
|
|
183
|
+
* @param tags - The cache tags to invalidate
|
|
184
|
+
*/
|
|
185
|
+
invalidateTags?(tags: string[]): Promise<void>;
|
|
170
186
|
}
|
|
171
187
|
|
|
172
188
|
/**
|
|
@@ -181,6 +197,13 @@ export interface CacheItemResult {
|
|
|
181
197
|
handles?: string;
|
|
182
198
|
/** Whether the entry is stale and should be revalidated */
|
|
183
199
|
shouldRevalidate: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* The entry's cache tags (including runtime cacheTag() tags), surfaced on read
|
|
202
|
+
* so a "use cache" HIT can still contribute its tags to the request-scoped tag
|
|
203
|
+
* set used by document-level caching. On a hit the cached function is not
|
|
204
|
+
* re-run, so its runtime tags are only available here, not from re-execution.
|
|
205
|
+
*/
|
|
206
|
+
tags?: string[];
|
|
184
207
|
}
|
|
185
208
|
|
|
186
209
|
/**
|
|
@@ -235,6 +258,10 @@ export interface CachedEntryData {
|
|
|
235
258
|
handles: string;
|
|
236
259
|
/** Expiration timestamp (ms since epoch) */
|
|
237
260
|
expiresAt: number;
|
|
261
|
+
/** Cache tags for invalidation */
|
|
262
|
+
tags?: string[];
|
|
263
|
+
/** Timestamp (ms since epoch) when tags were attached, for distributed invalidation */
|
|
264
|
+
taggedAt?: number;
|
|
238
265
|
}
|
|
239
266
|
|
|
240
267
|
// ============================================================================
|
package/src/index.rsc.ts
CHANGED
|
@@ -189,6 +189,13 @@ export {
|
|
|
189
189
|
type ReadonlyHeaders,
|
|
190
190
|
} from "./server/cookie-store.js";
|
|
191
191
|
|
|
192
|
+
// Cache tag APIs (server-only)
|
|
193
|
+
// cacheTag: tag the current "use cache" entry at runtime.
|
|
194
|
+
// updateTag: read-your-own-writes invalidation (awaitable, for Server Actions).
|
|
195
|
+
// revalidateTag: background hard-purge invalidation (not awaited, for route handlers / webhooks).
|
|
196
|
+
export { cacheTag } from "./cache/cache-tag.js";
|
|
197
|
+
export { updateTag, revalidateTag } from "./cache/tag-invalidation.js";
|
|
198
|
+
|
|
192
199
|
// Meta types
|
|
193
200
|
export type { MetaDescriptor, MetaDescriptorBase } from "./router/types.js";
|
|
194
201
|
|
package/src/index.ts
CHANGED
|
@@ -237,6 +237,18 @@ export function middleware(): never {
|
|
|
237
237
|
export function revalidate(): never {
|
|
238
238
|
throw serverOnlyStubError("revalidate");
|
|
239
239
|
}
|
|
240
|
+
// Cache tag APIs are server-only (real implementations in index.rsc.ts). These
|
|
241
|
+
// stubs keep the named-export shape identical under the default/non-react-server
|
|
242
|
+
// condition so SSR/client/default bundles that encounter the import link cleanly.
|
|
243
|
+
export function cacheTag(): never {
|
|
244
|
+
throw serverOnlyStubError("cacheTag");
|
|
245
|
+
}
|
|
246
|
+
export function updateTag(): never {
|
|
247
|
+
throw serverOnlyStubError("updateTag");
|
|
248
|
+
}
|
|
249
|
+
export function revalidateTag(): never {
|
|
250
|
+
throw serverOnlyStubError("revalidateTag");
|
|
251
|
+
}
|
|
240
252
|
export function loader(): never {
|
|
241
253
|
throw serverOnlyStubError("loader");
|
|
242
254
|
}
|
|
@@ -216,6 +216,7 @@ export async function matchForPrerender<TEnv = any>(
|
|
|
216
216
|
}) as any,
|
|
217
217
|
method: "GET",
|
|
218
218
|
_handleStore: handleStore,
|
|
219
|
+
_requestTags: new Set<string>(),
|
|
219
220
|
waitUntil: () => {},
|
|
220
221
|
onResponse: () => {},
|
|
221
222
|
_onResponseCallbacks: [],
|
|
@@ -465,6 +466,7 @@ export async function renderStaticSegment<TEnv = any>(
|
|
|
465
466
|
}) as any,
|
|
466
467
|
method: "GET",
|
|
467
468
|
_handleStore: handleStore,
|
|
469
|
+
_requestTags: new Set<string>(),
|
|
468
470
|
waitUntil: () => {},
|
|
469
471
|
onResponse: () => {},
|
|
470
472
|
_onResponseCallbacks: [],
|
|
@@ -28,9 +28,11 @@ import {
|
|
|
28
28
|
resolveSwrWindow,
|
|
29
29
|
resolveCacheKey,
|
|
30
30
|
resolveCacheStore,
|
|
31
|
+
resolveTagsOption,
|
|
31
32
|
DEFAULT_ROUTE_TTL,
|
|
32
33
|
} from "../../cache/cache-policy.js";
|
|
33
34
|
import { readThroughItem } from "../../cache/read-through-swr.js";
|
|
35
|
+
import { recordRequestTags } from "../../cache/cache-tag.js";
|
|
34
36
|
// Lazy-loaded to avoid pulling @vitejs/plugin-rsc/rsc into modules that
|
|
35
37
|
// import segment-resolution but never use loader caching.
|
|
36
38
|
let _serializeResult: typeof import("../../cache/segment-codec.js").serializeResult;
|
|
@@ -87,23 +89,8 @@ async function resolveLoaderKey(
|
|
|
87
89
|
*/
|
|
88
90
|
function resolveTags(loaderEntry: LoaderEntry): string[] | undefined {
|
|
89
91
|
const options = loaderEntry.cache?.options;
|
|
90
|
-
if (!options
|
|
91
|
-
|
|
92
|
-
if (typeof options.tags === "function") {
|
|
93
|
-
const requestCtx = getRequestContext();
|
|
94
|
-
if (!requestCtx) return undefined;
|
|
95
|
-
try {
|
|
96
|
-
return options.tags(requestCtx);
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.error(
|
|
99
|
-
`[LoaderCache] Tags function failed, caching without tags:`,
|
|
100
|
-
error,
|
|
101
|
-
);
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return options.tags;
|
|
92
|
+
if (!options) return undefined;
|
|
93
|
+
return resolveTagsOption(options.tags, getRequestContext(), "LoaderCache");
|
|
107
94
|
}
|
|
108
95
|
|
|
109
96
|
function getLoaderStore(
|
|
@@ -152,6 +139,10 @@ export function resolveLoaderData<TEnv>(
|
|
|
152
139
|
const swrWindow = resolveSwrWindow(options.swr, store.defaults);
|
|
153
140
|
const swr = swrWindow || undefined;
|
|
154
141
|
const tags = resolveTags(loaderEntry);
|
|
142
|
+
// Loader tags are config-derived, so they are the complete set whether this is
|
|
143
|
+
// a cache hit or miss; record them every time so a document built from this
|
|
144
|
+
// loader is tagged for invalidation.
|
|
145
|
+
recordRequestTags(tags);
|
|
155
146
|
|
|
156
147
|
// Wrap ctx.use() so cache HIT primes the handler's memoization map.
|
|
157
148
|
// ctx.use() closes over the match context's loaderPromises (not request context's).
|
package/src/rsc/handler.ts
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
getRouterTrie,
|
|
58
58
|
} from "../route-map-builder.js";
|
|
59
59
|
import type { HandlerContext } from "./handler-context.js";
|
|
60
|
+
import type { CacheErrorCategory } from "../cache/cache-error.js";
|
|
60
61
|
import type { SegmentCacheStore } from "../cache/types.js";
|
|
61
62
|
import { buildRouterTrieFromUrlpatterns } from "./manifest-init.js";
|
|
62
63
|
import { handleProgressiveEnhancement } from "./progressive-enhancement.js";
|
|
@@ -150,6 +151,13 @@ export function createRSCHandler<
|
|
|
150
151
|
>(options: CreateRSCHandlerOptions<TEnv, TRoutes>) {
|
|
151
152
|
const { router, version = VERSION, nonce: nonceProvider } = options;
|
|
152
153
|
|
|
154
|
+
// Handler-owned registry of explicit per-scope stores from cache({ store }).
|
|
155
|
+
// Lives in the closure so it is scoped per handler (multi-router deployments
|
|
156
|
+
// get separate registries) and accumulates every explicit store this handler
|
|
157
|
+
// resolves across requests. updateTag()/revalidateTag() iterate it to reach
|
|
158
|
+
// stores not covered by the app-level ctx._cacheStore.
|
|
159
|
+
const explicitTaggedStores = new Set<SegmentCacheStore>();
|
|
160
|
+
|
|
153
161
|
// Use provided deps or default to @vitejs/plugin-rsc/rsc exports
|
|
154
162
|
const deps = options.deps ?? rscDeps;
|
|
155
163
|
const {
|
|
@@ -441,6 +449,7 @@ export function createRSCHandler<
|
|
|
441
449
|
url,
|
|
442
450
|
variables,
|
|
443
451
|
cacheStore,
|
|
452
|
+
explicitTaggedStores,
|
|
444
453
|
cacheProfiles: router.cacheProfiles,
|
|
445
454
|
executionContext: executionCtx,
|
|
446
455
|
themeConfig: router.themeConfig,
|
|
@@ -453,7 +462,7 @@ export function createRSCHandler<
|
|
|
453
462
|
// can surface non-fatal errors through the router's onError callback.
|
|
454
463
|
requestContext._reportBackgroundError = (
|
|
455
464
|
error: unknown,
|
|
456
|
-
category:
|
|
465
|
+
category: CacheErrorCategory,
|
|
457
466
|
) => {
|
|
458
467
|
callOnError(error, "cache", {
|
|
459
468
|
request,
|
|
@@ -12,7 +12,7 @@ import { contextGet } from "../context-var.js";
|
|
|
12
12
|
import { NOCACHE_SYMBOL } from "../cache/taint.js";
|
|
13
13
|
import { traverseBack } from "../router/pattern-matching.js";
|
|
14
14
|
import { RESPONSE_TYPE_MIME } from "../router/content-negotiation.js";
|
|
15
|
-
import { createCacheScope } from "../cache/cache-scope.js";
|
|
15
|
+
import { createCacheScope, resolveCacheTags } from "../cache/cache-scope.js";
|
|
16
16
|
import { executeMiddleware } from "../router/middleware.js";
|
|
17
17
|
import {
|
|
18
18
|
createReverseFunction,
|
|
@@ -277,6 +277,11 @@ export async function handleResponseRoute<TEnv>(
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
// Resolve cache tags for this document entry (static or dynamic),
|
|
281
|
+
// while request context is available. Passed to putResponse so the
|
|
282
|
+
// entry is tag-invalidatable.
|
|
283
|
+
const responseTags = resolveCacheTags(cacheScope.config, reqCtx);
|
|
284
|
+
|
|
280
285
|
// Save pre-handler callbacks (registered by app-level middleware
|
|
281
286
|
// before we reach the cache block) and clear the live array.
|
|
282
287
|
// createResponseWithMergedHeaders (inside the handler) eagerly
|
|
@@ -318,6 +323,7 @@ export async function handleResponseRoute<TEnv>(
|
|
|
318
323
|
fresh.clone(),
|
|
319
324
|
cacheScope!.ttl,
|
|
320
325
|
cacheScope!.swr,
|
|
326
|
+
responseTags,
|
|
321
327
|
);
|
|
322
328
|
}
|
|
323
329
|
} catch (error) {
|
|
@@ -346,6 +352,7 @@ export async function handleResponseRoute<TEnv>(
|
|
|
346
352
|
response.clone(),
|
|
347
353
|
cacheScope!.ttl,
|
|
348
354
|
cacheScope!.swr,
|
|
355
|
+
responseTags,
|
|
349
356
|
);
|
|
350
357
|
} catch (error) {
|
|
351
358
|
console.error(`[ResponseCache] Cache write failed:`, error);
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
14
|
+
import type { CacheErrorCategory } from "../cache/cache-error.js";
|
|
14
15
|
import type { CookieOptions } from "../router/middleware.js";
|
|
15
16
|
import type { LoaderDefinition, LoaderContext } from "../types.js";
|
|
16
17
|
import type { ScopedReverseFunction } from "../reverse.js";
|
|
@@ -140,6 +141,25 @@ export interface RequestContext<
|
|
|
140
141
|
/** @internal Cache store for segment caching (optional, used by CacheScope) */
|
|
141
142
|
_cacheStore?: SegmentCacheStore;
|
|
142
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @internal Handler-owned registry of explicit per-scope stores from
|
|
146
|
+
* cache({ store }). Created once per createRSCHandler() and threaded into
|
|
147
|
+
* every request context, so it accumulates every explicit store the handler
|
|
148
|
+
* resolves. updateTag()/revalidateTag() iterate this set plus _cacheStore to
|
|
149
|
+
* reach every store that may hold tagged entries. The app-level store is not
|
|
150
|
+
* added here (it is always reachable via _cacheStore).
|
|
151
|
+
*/
|
|
152
|
+
_explicitTaggedStores?: Set<SegmentCacheStore>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @internal Union of every cache tag resolved while producing this request's
|
|
156
|
+
* response (from cache({ tags }), runtime cacheTag(), and loader cache tags).
|
|
157
|
+
* Populated at the tag-resolution sites via recordRequestTags(). Read by the
|
|
158
|
+
* document cache middleware so a full-page entry is tagged with everything its
|
|
159
|
+
* content used and can therefore be invalidated by updateTag()/revalidateTag().
|
|
160
|
+
*/
|
|
161
|
+
_requestTags: Set<string>;
|
|
162
|
+
|
|
143
163
|
/** @internal Cache profiles for "use cache" profile resolution (per-router) */
|
|
144
164
|
_cacheProfiles?: Record<
|
|
145
165
|
string,
|
|
@@ -318,9 +338,13 @@ export interface RequestContext<
|
|
|
318
338
|
* @internal Report a non-fatal background error through the router's
|
|
319
339
|
* onError callback. Wired by the RSC handler / router during request
|
|
320
340
|
* creation. Cache-runtime and other subsystems call this to surface
|
|
321
|
-
* errors without failing the response.
|
|
341
|
+
* errors without failing the response. `category` is surfaced to consumers as
|
|
342
|
+
* `metadata.category` on the onError context (phase `cache`).
|
|
322
343
|
*/
|
|
323
|
-
_reportBackgroundError?: (
|
|
344
|
+
_reportBackgroundError?: (
|
|
345
|
+
error: unknown,
|
|
346
|
+
category: CacheErrorCategory,
|
|
347
|
+
) => void;
|
|
324
348
|
|
|
325
349
|
/** @internal Per-request debug performance override (set via ctx.debugPerformance()) */
|
|
326
350
|
_debugPerformance?: boolean;
|
|
@@ -355,6 +379,8 @@ export type PublicRequestContext<
|
|
|
355
379
|
| "deleteCookie"
|
|
356
380
|
| "_handleStore"
|
|
357
381
|
| "_cacheStore"
|
|
382
|
+
| "_explicitTaggedStores"
|
|
383
|
+
| "_requestTags"
|
|
358
384
|
| "_cacheProfiles"
|
|
359
385
|
| "_onResponseCallbacks"
|
|
360
386
|
| "_themeConfig"
|
|
@@ -500,6 +526,11 @@ export interface CreateRequestContextOptions<TEnv> {
|
|
|
500
526
|
initialResponse?: Response;
|
|
501
527
|
/** Optional cache store for segment caching (used by CacheScope) */
|
|
502
528
|
cacheStore?: SegmentCacheStore;
|
|
529
|
+
/**
|
|
530
|
+
* Handler-owned registry of explicit per-scope stores for cross-store tag
|
|
531
|
+
* invalidation. Created once per handler, reused across requests.
|
|
532
|
+
*/
|
|
533
|
+
explicitTaggedStores?: Set<SegmentCacheStore>;
|
|
503
534
|
/** Optional cache profiles for "use cache" resolution (per-router) */
|
|
504
535
|
cacheProfiles?: Record<
|
|
505
536
|
string,
|
|
@@ -529,6 +560,7 @@ export function createRequestContext<TEnv>(
|
|
|
529
560
|
variables,
|
|
530
561
|
initialResponse,
|
|
531
562
|
cacheStore,
|
|
563
|
+
explicitTaggedStores,
|
|
532
564
|
cacheProfiles,
|
|
533
565
|
executionContext,
|
|
534
566
|
themeConfig,
|
|
@@ -746,6 +778,8 @@ export function createRequestContext<TEnv>(
|
|
|
746
778
|
|
|
747
779
|
_handleStore: handleStore,
|
|
748
780
|
_cacheStore: cacheStore,
|
|
781
|
+
_explicitTaggedStores: explicitTaggedStores,
|
|
782
|
+
_requestTags: new Set<string>(),
|
|
749
783
|
_cacheProfiles: cacheProfiles,
|
|
750
784
|
|
|
751
785
|
waitUntil(fn: () => Promise<void>): void {
|
package/src/types/cache-types.ts
CHANGED
|
@@ -78,6 +78,14 @@ export interface CacheOptions<TEnv = unknown> {
|
|
|
78
78
|
* - Loader-specific caching strategies
|
|
79
79
|
* - Hot data in fast cache, cold data in larger/slower cache
|
|
80
80
|
*
|
|
81
|
+
* Tag invalidation caveat: a per-boundary store becomes reachable by
|
|
82
|
+
* `updateTag()` / `revalidateTag()` once this boundary is resolved in the
|
|
83
|
+
* current process. If the store is *durable* (shared across processes) and the
|
|
84
|
+
* very first request to a fresh worker is an `updateTag`/`revalidateTag` for a
|
|
85
|
+
* tag held only in this store - before this boundary is matched - that
|
|
86
|
+
* invalidation can miss it. For data you invalidate by tag, prefer the
|
|
87
|
+
* app-level store (always reachable), or ensure the boundary is warmed.
|
|
88
|
+
*
|
|
81
89
|
* @example
|
|
82
90
|
* ```typescript
|
|
83
91
|
* const kvStore = new CloudflareKVStore(env.CACHE_KV);
|
|
@@ -145,10 +153,11 @@ export interface CacheOptions<TEnv = unknown> {
|
|
|
145
153
|
* Tags for cache invalidation.
|
|
146
154
|
* Can be a static array or a function that returns tags.
|
|
147
155
|
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
156
|
+
* The built-in `MemorySegmentCacheStore` and `CFCacheStore` index by tag.
|
|
157
|
+
* Invalidate on demand with `updateTag(...tags)` (awaitable, read-your-own-writes;
|
|
158
|
+
* for server actions) or `revalidateTag(...tags)` (background hard-purge, not
|
|
159
|
+
* awaited; for route handlers / webhooks). For `CFCacheStore`, distributed
|
|
160
|
+
* invalidation requires a `kv` namespace (markers live in that same namespace).
|
|
152
161
|
*
|
|
153
162
|
* @example
|
|
154
163
|
* ```typescript
|
package/src/types/error-types.ts
CHANGED
|
@@ -155,7 +155,11 @@ export interface OnErrorContext<TEnv = any> {
|
|
|
155
155
|
stack?: string;
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* Additional metadata specific to the error phase
|
|
158
|
+
* Additional metadata specific to the error phase. For the `cache` phase,
|
|
159
|
+
* `metadata.category` is a `CacheErrorCategory` (exported from
|
|
160
|
+
* `@rangojs/router/cache`) identifying the failure kind, e.g. `cache-read`
|
|
161
|
+
* (transient outage, degraded to a miss) vs `cache-corrupt` (faulty entry
|
|
162
|
+
* self-healed) vs `cache-invalidate` (a failed background revalidateTag).
|
|
159
163
|
*/
|
|
160
164
|
metadata?: Record<string, unknown>;
|
|
161
165
|
}
|