@rangojs/router 0.0.0-experimental.dfa55db4 → 0.0.0-experimental.e16b7c00
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -25
- package/dist/bin/rango.js +147 -57
- package/dist/vite/index.js +2108 -829
- package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/package.json +13 -8
- package/skills/breadcrumbs/SKILL.md +3 -1
- package/skills/bundle-analysis/SKILL.md +159 -0
- package/skills/cache-guide/SKILL.md +222 -30
- package/skills/caching/SKILL.md +188 -8
- package/skills/composability/SKILL.md +27 -2
- package/skills/document-cache/SKILL.md +78 -55
- package/skills/handler-use/SKILL.md +364 -0
- package/skills/hooks/SKILL.md +229 -20
- package/skills/host-router/SKILL.md +45 -20
- package/skills/i18n/SKILL.md +276 -0
- package/skills/intercept/SKILL.md +46 -4
- package/skills/layout/SKILL.md +28 -7
- package/skills/links/SKILL.md +247 -17
- package/skills/loader/SKILL.md +219 -9
- package/skills/middleware/SKILL.md +47 -12
- package/skills/migrate-nextjs/SKILL.md +582 -0
- package/skills/migrate-react-router/SKILL.md +769 -0
- package/skills/mime-routes/SKILL.md +27 -0
- package/skills/observability/SKILL.md +137 -0
- package/skills/parallel/SKILL.md +71 -6
- package/skills/prerender/SKILL.md +14 -33
- package/skills/rango/SKILL.md +236 -22
- package/skills/react-compiler/SKILL.md +168 -0
- package/skills/response-routes/SKILL.md +66 -9
- package/skills/route/SKILL.md +57 -4
- package/skills/router-setup/SKILL.md +3 -3
- package/skills/server-actions/SKILL.md +751 -0
- package/skills/streams-and-websockets/SKILL.md +283 -0
- package/skills/typesafety/SKILL.md +319 -27
- package/skills/use-cache/SKILL.md +36 -5
- package/skills/view-transitions/SKILL.md +294 -0
- package/src/__augment-tests__/augment.ts +81 -0
- package/src/__augment-tests__/augmented.check.ts +117 -0
- package/src/browser/action-coordinator.ts +53 -36
- package/src/browser/app-shell.ts +52 -0
- package/src/browser/event-controller.ts +86 -70
- package/src/browser/history-state.ts +21 -0
- package/src/browser/index.ts +3 -3
- package/src/browser/navigation-bridge.ts +86 -11
- package/src/browser/navigation-client.ts +76 -28
- package/src/browser/navigation-store.ts +32 -9
- package/src/browser/navigation-transaction.ts +10 -28
- package/src/browser/partial-update.ts +64 -26
- package/src/browser/prefetch/cache.ts +129 -21
- package/src/browser/prefetch/fetch.ts +148 -16
- package/src/browser/prefetch/queue.ts +36 -5
- package/src/browser/rango-state.ts +53 -13
- package/src/browser/react/Link.tsx +30 -2
- package/src/browser/react/NavigationProvider.tsx +72 -31
- package/src/browser/react/filter-segment-order.ts +51 -7
- package/src/browser/react/index.ts +3 -0
- package/src/browser/react/location-state-shared.ts +175 -4
- package/src/browser/react/location-state.ts +39 -13
- package/src/browser/react/use-handle.ts +17 -9
- package/src/browser/react/use-navigation.ts +22 -2
- package/src/browser/react/use-params.ts +20 -8
- package/src/browser/react/use-reverse.ts +106 -0
- package/src/browser/react/use-router.ts +22 -2
- package/src/browser/react/use-segments.ts +11 -8
- package/src/browser/response-adapter.ts +25 -0
- package/src/browser/rsc-router.tsx +64 -22
- package/src/browser/scroll-restoration.ts +22 -14
- package/src/browser/segment-reconciler.ts +36 -14
- package/src/browser/segment-structure-assert.ts +2 -2
- package/src/browser/server-action-bridge.ts +23 -30
- package/src/browser/types.ts +21 -0
- package/src/build/collect-fallback-refs.ts +107 -0
- package/src/build/generate-manifest.ts +60 -35
- package/src/build/generate-route-types.ts +2 -0
- package/src/build/index.ts +2 -0
- package/src/build/route-trie.ts +52 -25
- package/src/build/route-types/codegen.ts +4 -4
- package/src/build/route-types/include-resolution.ts +1 -1
- package/src/build/route-types/per-module-writer.ts +7 -4
- package/src/build/route-types/router-processing.ts +55 -14
- package/src/build/route-types/scan-filter.ts +1 -1
- package/src/build/route-types/source-scan.ts +118 -0
- package/src/build/runtime-discovery.ts +9 -20
- 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 +77 -46
- package/src/cache/cache-tag.ts +135 -0
- package/src/cache/cf/cf-cache-store.ts +1067 -176
- package/src/cache/cf/index.ts +4 -1
- package/src/cache/document-cache.ts +59 -7
- package/src/cache/index.ts +6 -0
- package/src/cache/memory-segment-store.ts +158 -14
- package/src/cache/tag-invalidation.ts +206 -0
- package/src/cache/types.ts +27 -0
- package/src/client.rsc.tsx +3 -0
- package/src/client.tsx +92 -182
- package/src/context-var.ts +5 -5
- package/src/decode-loader-results.ts +36 -0
- package/src/errors.ts +30 -1
- package/src/handle.ts +4 -6
- package/src/host/index.ts +2 -2
- package/src/host/router.ts +129 -57
- package/src/host/types.ts +31 -2
- package/src/host/utils.ts +1 -1
- package/src/href-client.ts +140 -20
- package/src/index.rsc.ts +16 -4
- package/src/index.ts +65 -15
- package/src/loader-store.ts +500 -0
- package/src/loader.rsc.ts +2 -5
- package/src/loader.ts +3 -10
- package/src/missing-id-error.ts +68 -0
- package/src/outlet-context.ts +1 -1
- package/src/prerender.ts +4 -4
- package/src/response-utils.ts +37 -0
- package/src/reverse.ts +65 -36
- package/src/route-content-wrapper.tsx +6 -28
- package/src/route-definition/dsl-helpers.ts +384 -257
- package/src/route-definition/helper-factories.ts +29 -139
- package/src/route-definition/helpers-types.ts +100 -28
- package/src/route-definition/resolve-handler-use.ts +6 -0
- package/src/route-definition/use-item-types.ts +32 -0
- package/src/route-types.ts +26 -41
- package/src/router/content-negotiation.ts +15 -2
- package/src/router/error-handling.ts +1 -1
- package/src/router/handler-context.ts +21 -38
- package/src/router/intercept-resolution.ts +4 -18
- package/src/router/lazy-includes.ts +8 -8
- package/src/router/loader-resolution.ts +19 -2
- package/src/router/manifest.ts +22 -13
- package/src/router/match-api.ts +4 -3
- package/src/router/match-handlers.ts +1 -0
- package/src/router/match-middleware/cache-lookup.ts +46 -92
- package/src/router/match-middleware/cache-store.ts +3 -2
- package/src/router/match-result.ts +103 -4
- package/src/router/metrics.ts +1 -1
- package/src/router/middleware-types.ts +15 -26
- package/src/router/middleware.ts +99 -84
- package/src/router/pattern-matching.ts +101 -17
- package/src/router/prerender-match.ts +3 -1
- package/src/router/preview-match.ts +3 -1
- package/src/router/request-classification.ts +4 -28
- package/src/router/revalidation.ts +58 -2
- package/src/router/router-interfaces.ts +45 -28
- package/src/router/router-options.ts +25 -1
- package/src/router/router-registry.ts +2 -5
- package/src/router/segment-resolution/fresh.ts +32 -6
- package/src/router/segment-resolution/loader-cache.ts +8 -17
- package/src/router/segment-resolution/revalidation.ts +154 -107
- package/src/router/segment-resolution/view-transition-default.ts +36 -0
- package/src/router/substitute-pattern-params.ts +56 -0
- package/src/router/trie-matching.ts +18 -13
- package/src/router/types.ts +8 -0
- package/src/router/url-params.ts +49 -0
- package/src/router.ts +23 -18
- package/src/rsc/handler-context.ts +2 -2
- package/src/rsc/handler.ts +46 -74
- package/src/rsc/helpers.ts +72 -43
- package/src/rsc/index.ts +1 -1
- package/src/rsc/origin-guard.ts +28 -10
- package/src/rsc/progressive-enhancement.ts +4 -0
- package/src/rsc/response-route-handler.ts +54 -54
- package/src/rsc/rsc-rendering.ts +35 -51
- package/src/rsc/runtime-warnings.ts +9 -10
- package/src/rsc/server-action.ts +17 -37
- package/src/rsc/ssr-setup.ts +16 -0
- package/src/rsc/types.ts +8 -2
- package/src/search-params.ts +4 -4
- package/src/segment-content-promise.ts +67 -0
- package/src/segment-loader-promise.ts +122 -0
- package/src/segment-system.tsx +132 -116
- package/src/serialize.ts +243 -0
- package/src/server/context.ts +143 -53
- package/src/server/cookie-store.ts +28 -4
- package/src/server/request-context.ts +46 -44
- package/src/ssr/index.tsx +5 -1
- package/src/static-handler.ts +1 -1
- package/src/types/cache-types.ts +13 -4
- package/src/types/error-types.ts +5 -1
- package/src/types/global-namespace.ts +39 -26
- package/src/types/handler-context.ts +68 -50
- package/src/types/index.ts +1 -0
- package/src/types/loader-types.ts +5 -6
- package/src/types/request-scope.ts +126 -0
- package/src/types/route-entry.ts +11 -0
- package/src/types/segments.ts +36 -2
- package/src/urls/include-helper.ts +34 -67
- package/src/urls/index.ts +0 -3
- package/src/urls/path-helper-types.ts +41 -7
- package/src/urls/path-helper.ts +17 -52
- package/src/urls/pattern-types.ts +36 -19
- package/src/urls/response-types.ts +22 -29
- package/src/urls/type-extraction.ts +26 -116
- package/src/urls/urls-function.ts +1 -5
- package/src/use-loader.tsx +416 -42
- package/src/vite/debug.ts +185 -0
- package/src/vite/discovery/bundle-postprocess.ts +6 -6
- package/src/vite/discovery/discover-routers.ts +101 -51
- package/src/vite/discovery/discovery-errors.ts +194 -0
- package/src/vite/discovery/gate-state.ts +171 -0
- package/src/vite/discovery/prerender-collection.ts +67 -26
- package/src/vite/discovery/route-types-writer.ts +40 -84
- package/src/vite/discovery/self-gen-tracking.ts +27 -1
- package/src/vite/discovery/state.ts +33 -0
- package/src/vite/discovery/virtual-module-codegen.ts +13 -23
- package/src/vite/index.ts +2 -0
- package/src/vite/plugin-types.ts +67 -0
- package/src/vite/plugins/cjs-to-esm.ts +8 -7
- package/src/vite/plugins/client-ref-dedup.ts +16 -0
- package/src/vite/plugins/client-ref-hashing.ts +28 -5
- package/src/vite/plugins/cloudflare-protocol-loader-hook.d.mts +23 -0
- package/src/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/src/vite/plugins/cloudflare-protocol-stub.ts +214 -0
- package/src/vite/plugins/expose-action-id.ts +54 -30
- package/src/vite/plugins/expose-id-utils.ts +24 -8
- package/src/vite/plugins/expose-ids/export-analysis.ts +100 -20
- package/src/vite/plugins/expose-ids/handler-transform.ts +8 -61
- package/src/vite/plugins/expose-ids/loader-transform.ts +3 -5
- package/src/vite/plugins/expose-ids/router-transform.ts +20 -3
- package/src/vite/plugins/expose-internal-ids.ts +503 -468
- package/src/vite/plugins/performance-tracks.ts +29 -25
- package/src/vite/plugins/use-cache-transform.ts +65 -50
- package/src/vite/plugins/version-injector.ts +39 -23
- package/src/vite/plugins/version-plugin.ts +59 -2
- package/src/vite/plugins/virtual-entries.ts +2 -2
- package/src/vite/rango.ts +116 -29
- package/src/vite/router-discovery.ts +750 -100
- package/src/vite/utils/ast-handler-extract.ts +15 -15
- package/src/vite/utils/banner.ts +1 -1
- package/src/vite/utils/bundle-analysis.ts +4 -2
- package/src/vite/utils/client-chunks.ts +190 -0
- package/src/vite/utils/forward-user-plugins.ts +193 -0
- package/src/vite/utils/manifest-utils.ts +21 -5
- package/src/vite/utils/package-resolution.ts +41 -1
- package/src/vite/utils/prerender-utils.ts +21 -6
- package/src/vite/utils/shared-utils.ts +107 -26
- 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/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/src/browser/action-response-classifier.ts +0 -99
|
@@ -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
|
+
}
|
|
@@ -36,6 +36,12 @@ import { restoreHandles } from "./handle-snapshot.js";
|
|
|
36
36
|
import { startHandleCapture, type HandleCapture } from "./handle-capture.js";
|
|
37
37
|
import { sortedSearchString } from "./cache-key-utils.js";
|
|
38
38
|
import { runBackground } from "./background-task.js";
|
|
39
|
+
import {
|
|
40
|
+
normalizeTags,
|
|
41
|
+
recordRequestTags,
|
|
42
|
+
runWithCacheTagScope,
|
|
43
|
+
} from "./cache-tag.js";
|
|
44
|
+
import { reportCacheError } from "./cache-error.js";
|
|
39
45
|
|
|
40
46
|
/**
|
|
41
47
|
* Convert encodeReply result to a stable string key.
|
|
@@ -70,9 +76,17 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
70
76
|
const store = requestCtx?._cacheStore;
|
|
71
77
|
const resolvedProfileName = profileName || "default";
|
|
72
78
|
|
|
73
|
-
// Bypass: no store or no getItem support
|
|
79
|
+
// Bypass: no store or no getItem support. Still run inside a tag scope so a
|
|
80
|
+
// cacheTag() call inside the function degrades to a no-op rather than
|
|
81
|
+
// throwing "must be called inside a use cache function" - adopting cacheTag()
|
|
82
|
+
// must not hard-fail in apps/tests without an item-capable cache configured.
|
|
74
83
|
if (!store?.getItem) {
|
|
75
|
-
|
|
84
|
+
const scoped = runWithCacheTagScope(() => fn.apply(this, args));
|
|
85
|
+
const result = await scoped.result;
|
|
86
|
+
// Still record the runtime tags into the request set so a cacheTag() in an
|
|
87
|
+
// uncached function tags the document, even with no item-capable store.
|
|
88
|
+
recordRequestTags(scoped.tags, requestCtx);
|
|
89
|
+
return result;
|
|
76
90
|
}
|
|
77
91
|
|
|
78
92
|
// Resolve profile strictly from request-scoped config (set by the
|
|
@@ -155,8 +169,13 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
155
169
|
cacheKey = `use-cache:${id}`;
|
|
156
170
|
}
|
|
157
171
|
} catch {
|
|
158
|
-
// Non-serializable args: run uncached
|
|
159
|
-
|
|
172
|
+
// Non-serializable args: run uncached (within a tag scope so cacheTag()
|
|
173
|
+
// still does not throw). Record runtime tags so the document union still
|
|
174
|
+
// sees them even though this call is not itself cached.
|
|
175
|
+
const scoped = runWithCacheTagScope(() => fn.apply(this, args));
|
|
176
|
+
const result = await scoped.result;
|
|
177
|
+
recordRequestTags(scoped.tags, requestCtx);
|
|
178
|
+
return result;
|
|
160
179
|
}
|
|
161
180
|
|
|
162
181
|
// Cache lookup
|
|
@@ -173,9 +192,20 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
173
192
|
restoreHandles(cached.handles, handleStore);
|
|
174
193
|
}
|
|
175
194
|
}
|
|
195
|
+
// Surface the hit's tags to the request set so a document built from a
|
|
196
|
+
// cached item is still tagged (the function did not re-run, so its
|
|
197
|
+
// runtime cacheTag() tags are only available from the stored entry).
|
|
198
|
+
recordRequestTags(cached.tags, requestCtx);
|
|
176
199
|
return result;
|
|
177
|
-
} catch {
|
|
178
|
-
//
|
|
200
|
+
} catch (error) {
|
|
201
|
+
// The stored value is corrupt/partial (failed RSC deserialize). Report
|
|
202
|
+
// it, then fall through to fresh execution - the miss path below re-runs
|
|
203
|
+
// and setItem() overwrites the faulty entry under the same key (self-heal).
|
|
204
|
+
reportCacheError(
|
|
205
|
+
error,
|
|
206
|
+
"cache-corrupt",
|
|
207
|
+
`[use cache] "${id}" fresh-hit`,
|
|
208
|
+
);
|
|
179
209
|
}
|
|
180
210
|
}
|
|
181
211
|
|
|
@@ -189,6 +219,8 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
189
219
|
restoreHandles(cached.handles, handleStore);
|
|
190
220
|
}
|
|
191
221
|
}
|
|
222
|
+
// Tag the request with the stale entry's tags (see fresh-hit note).
|
|
223
|
+
recordRequestTags(cached.tags, requestCtx);
|
|
192
224
|
// Background revalidation — must capture handles if tainted args present.
|
|
193
225
|
// Use an isolated handle store so background pushes don't pollute the
|
|
194
226
|
// live response or throw LateHandlePushError on the completed store.
|
|
@@ -238,20 +270,38 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
238
270
|
}
|
|
239
271
|
|
|
240
272
|
try {
|
|
241
|
-
const
|
|
273
|
+
const scoped = runWithCacheTagScope(() => fn.apply(this, args));
|
|
274
|
+
const freshResult = await scoped.result;
|
|
242
275
|
bgStopCapture?.();
|
|
276
|
+
// Merge profile/DSL tags with runtime cacheTag() tags, read after
|
|
277
|
+
// awaiting so post-await cacheTag() calls are included. Normalize
|
|
278
|
+
// (drops empty profile tags, matching the invalidate path) + dedupe.
|
|
279
|
+
const freshTags = [
|
|
280
|
+
...new Set(
|
|
281
|
+
normalizeTags([...(profile.tags ?? []), ...scoped.tags]),
|
|
282
|
+
),
|
|
283
|
+
];
|
|
284
|
+
recordRequestTags(freshTags, requestCtx);
|
|
243
285
|
const serialized = await serializeResult(freshResult);
|
|
244
286
|
if (serialized !== null) {
|
|
245
287
|
await store.setItem!(cacheKey, serialized, {
|
|
246
288
|
handles: bgCapture?.data,
|
|
247
289
|
ttl: profile.ttl,
|
|
248
290
|
swr: profile.swr,
|
|
249
|
-
tags:
|
|
291
|
+
tags: freshTags.length > 0 ? freshTags : undefined,
|
|
250
292
|
});
|
|
251
293
|
}
|
|
252
294
|
} catch (bgError) {
|
|
253
295
|
bgStopCapture?.();
|
|
254
|
-
requestCtx
|
|
296
|
+
// Pass requestCtx explicitly: this runs in a detached background
|
|
297
|
+
// task where the ALS context is gone, so onError can only fire if
|
|
298
|
+
// we hand it the context captured up front.
|
|
299
|
+
reportCacheError(
|
|
300
|
+
bgError,
|
|
301
|
+
"stale-revalidation",
|
|
302
|
+
"[use cache] background revalidation failed",
|
|
303
|
+
requestCtx,
|
|
304
|
+
);
|
|
255
305
|
} finally {
|
|
256
306
|
for (const arg of bgTaintedArgs) {
|
|
257
307
|
unstampCacheExec(arg as object);
|
|
@@ -263,8 +313,14 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
263
313
|
}
|
|
264
314
|
});
|
|
265
315
|
return result;
|
|
266
|
-
} catch {
|
|
267
|
-
//
|
|
316
|
+
} catch (error) {
|
|
317
|
+
// Stale value is corrupt/partial; report and fall through to a fresh
|
|
318
|
+
// execution, which overwrites the faulty entry under the same key.
|
|
319
|
+
reportCacheError(
|
|
320
|
+
error,
|
|
321
|
+
"cache-corrupt",
|
|
322
|
+
`[use cache] "${id}" stale-hit`,
|
|
323
|
+
);
|
|
268
324
|
}
|
|
269
325
|
}
|
|
270
326
|
|
|
@@ -297,8 +353,10 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
297
353
|
}
|
|
298
354
|
|
|
299
355
|
let result: any;
|
|
356
|
+
let scoped: ReturnType<typeof runWithCacheTagScope>;
|
|
300
357
|
try {
|
|
301
|
-
|
|
358
|
+
scoped = runWithCacheTagScope(() => fn.apply(this, args));
|
|
359
|
+
result = await scoped.result;
|
|
302
360
|
} finally {
|
|
303
361
|
// Decrement ref count; symbol is deleted when it reaches zero
|
|
304
362
|
for (const arg of taintedArgs) {
|
|
@@ -311,6 +369,14 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
311
369
|
stopCapture?.();
|
|
312
370
|
}
|
|
313
371
|
|
|
372
|
+
// Merge profile/DSL tags with runtime cacheTag() tags. Read scoped.tags
|
|
373
|
+
// after awaiting result so post-await cacheTag() calls are included.
|
|
374
|
+
// Normalize (drops empty profile tags, matching the invalidate path) + dedupe.
|
|
375
|
+
const allTags = [
|
|
376
|
+
...new Set(normalizeTags([...(profile.tags ?? []), ...scoped!.tags])),
|
|
377
|
+
];
|
|
378
|
+
recordRequestTags(allTags, requestCtx);
|
|
379
|
+
|
|
314
380
|
// Serialize and store — fully non-blocking when waitUntil is available.
|
|
315
381
|
// The response does not need to wait for serialization or the store write.
|
|
316
382
|
const cacheWrite = async () => {
|
|
@@ -321,7 +387,7 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
321
387
|
handles: capture?.data,
|
|
322
388
|
ttl: profile.ttl,
|
|
323
389
|
swr: profile.swr,
|
|
324
|
-
tags:
|
|
390
|
+
tags: allTags.length > 0 ? allTags : undefined,
|
|
325
391
|
});
|
|
326
392
|
}
|
|
327
393
|
} catch (writeError) {
|
package/src/cache/cache-scope.ts
CHANGED
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
getRequestContext,
|
|
17
17
|
_getRequestContext,
|
|
18
18
|
} from "../server/request-context.js";
|
|
19
|
+
import { recordRequestTags } from "./cache-tag.js";
|
|
20
|
+
import { reportCacheError } from "./cache-error.js";
|
|
19
21
|
import { serializeSegments, deserializeSegments } from "./segment-codec.js";
|
|
20
22
|
import { captureHandles, restoreHandles } from "./handle-snapshot.js";
|
|
21
23
|
import { sortedSearchString, sortedRouteParams } from "./cache-key-utils.js";
|
|
@@ -23,7 +25,23 @@ import {
|
|
|
23
25
|
DEFAULT_ROUTE_TTL,
|
|
24
26
|
resolveCacheKey,
|
|
25
27
|
resolveCacheStore,
|
|
28
|
+
resolveTagsOption,
|
|
26
29
|
} from "./cache-policy.js";
|
|
30
|
+
import type { RequestContext } from "../server/request-context.js";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Resolve tags for a cache() boundary from its config (static array or
|
|
34
|
+
* function of ctx). Thin wrapper over the shared resolveTagsOption so the
|
|
35
|
+
* cache() DSL and loader caching resolve tags identically.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export function resolveCacheTags(
|
|
39
|
+
config: PartialCacheOptions | false,
|
|
40
|
+
ctx: RequestContext | undefined,
|
|
41
|
+
): string[] | undefined {
|
|
42
|
+
if (config === false) return undefined;
|
|
43
|
+
return resolveTagsOption(config.tags, ctx, "CacheScope");
|
|
44
|
+
}
|
|
27
45
|
|
|
28
46
|
function debugCacheLog(message: string): void {
|
|
29
47
|
if (INTERNAL_RANGO_DEBUG) {
|
|
@@ -187,6 +205,32 @@ export class CacheScope {
|
|
|
187
205
|
return resolveCacheKey(keyFn, this.getStore(), defaultKey, "CacheScope");
|
|
188
206
|
}
|
|
189
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Evaluate the cache `condition` predicate. Returns false (skip the cache
|
|
210
|
+
* operation) when the predicate returns false or throws; returns true when
|
|
211
|
+
* there is no condition or no request context to evaluate it against.
|
|
212
|
+
*/
|
|
213
|
+
private conditionAllows(op: "read" | "write"): boolean {
|
|
214
|
+
if (this.config === false || !this.config.condition) return true;
|
|
215
|
+
const requestCtx = getRequestContext();
|
|
216
|
+
if (!requestCtx) return true;
|
|
217
|
+
try {
|
|
218
|
+
if (!this.config.condition(requestCtx)) {
|
|
219
|
+
debugCacheLog(
|
|
220
|
+
`[CacheScope] condition returned false, skipping cache ${op}`,
|
|
221
|
+
);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.error(
|
|
227
|
+
`[CacheScope] condition function threw, skipping cache ${op}:`,
|
|
228
|
+
error,
|
|
229
|
+
);
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
190
234
|
/**
|
|
191
235
|
* Lookup cached segments for a route (single cache entry per request).
|
|
192
236
|
* Returns { segments, shouldRevalidate } or null if cache miss.
|
|
@@ -204,27 +248,7 @@ export class CacheScope {
|
|
|
204
248
|
shouldRevalidate: boolean;
|
|
205
249
|
} | null> {
|
|
206
250
|
if (!this.enabled) return null;
|
|
207
|
-
|
|
208
|
-
// Evaluate condition — skip cache read when condition returns false
|
|
209
|
-
if (this.config !== false && this.config.condition) {
|
|
210
|
-
const requestCtx = getRequestContext();
|
|
211
|
-
if (requestCtx) {
|
|
212
|
-
try {
|
|
213
|
-
if (!this.config.condition(requestCtx)) {
|
|
214
|
-
debugCacheLog(
|
|
215
|
-
`[CacheScope] condition returned false, skipping cache read`,
|
|
216
|
-
);
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
} catch (error) {
|
|
220
|
-
console.error(
|
|
221
|
-
`[CacheScope] condition function threw, skipping cache read:`,
|
|
222
|
-
error,
|
|
223
|
-
);
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
251
|
+
if (!this.conditionAllows("read")) return null;
|
|
228
252
|
|
|
229
253
|
const store = this.getStore();
|
|
230
254
|
if (!store) return null;
|
|
@@ -242,8 +266,26 @@ export class CacheScope {
|
|
|
242
266
|
|
|
243
267
|
const { data: cached, shouldRevalidate } = result;
|
|
244
268
|
|
|
245
|
-
// Deserialize segments
|
|
246
|
-
|
|
269
|
+
// Deserialize segments. A failure means the cached segments are corrupt/
|
|
270
|
+
// partial: evict the entry (self-heal - the re-render re-caches under the
|
|
271
|
+
// same key) and report it as corruption, distinct from a transient infra
|
|
272
|
+
// error (handled by the outer catch).
|
|
273
|
+
let segments: ResolvedSegment[];
|
|
274
|
+
try {
|
|
275
|
+
segments = await deserializeSegments(cached.segments);
|
|
276
|
+
} catch (error) {
|
|
277
|
+
reportCacheError(
|
|
278
|
+
error,
|
|
279
|
+
"cache-corrupt",
|
|
280
|
+
`[CacheScope] ${key}: corrupt cached segments, evicting`,
|
|
281
|
+
);
|
|
282
|
+
await store
|
|
283
|
+
.delete(key)
|
|
284
|
+
.catch((e) =>
|
|
285
|
+
reportCacheError(e, "cache-delete", `[CacheScope] ${key}: evict`),
|
|
286
|
+
);
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
247
289
|
|
|
248
290
|
// Replay handle data
|
|
249
291
|
const handleStore = _getRequestContext()?._handleStore;
|
|
@@ -262,7 +304,7 @@ export class CacheScope {
|
|
|
262
304
|
|
|
263
305
|
return { segments, shouldRevalidate };
|
|
264
306
|
} catch (error) {
|
|
265
|
-
|
|
307
|
+
reportCacheError(error, "cache-read", `[CacheScope] lookup ${key}`);
|
|
266
308
|
return null;
|
|
267
309
|
}
|
|
268
310
|
}
|
|
@@ -284,27 +326,7 @@ export class CacheScope {
|
|
|
284
326
|
isIntercept?: boolean,
|
|
285
327
|
): Promise<void> {
|
|
286
328
|
if (!this.enabled || segments.length === 0) return;
|
|
287
|
-
|
|
288
|
-
// Evaluate condition — skip cache write when condition returns false
|
|
289
|
-
if (this.config !== false && this.config.condition) {
|
|
290
|
-
const conditionCtx = getRequestContext();
|
|
291
|
-
if (conditionCtx) {
|
|
292
|
-
try {
|
|
293
|
-
if (!this.config.condition(conditionCtx)) {
|
|
294
|
-
debugCacheLog(
|
|
295
|
-
`[CacheScope] condition returned false, skipping cache write`,
|
|
296
|
-
);
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
} catch (error) {
|
|
300
|
-
console.error(
|
|
301
|
-
`[CacheScope] condition function threw, skipping cache write:`,
|
|
302
|
-
error,
|
|
303
|
-
);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
329
|
+
if (!this.conditionAllows("write")) return;
|
|
308
330
|
|
|
309
331
|
const store = this.getStore();
|
|
310
332
|
if (!store) return;
|
|
@@ -325,6 +347,10 @@ export class CacheScope {
|
|
|
325
347
|
// Resolve cache key early (while request context is available)
|
|
326
348
|
const key = await this.resolveKey(pathname, params, isIntercept);
|
|
327
349
|
|
|
350
|
+
// Resolve tags early (while request context is available, before waitUntil)
|
|
351
|
+
const tags = resolveCacheTags(this.config, requestCtx);
|
|
352
|
+
recordRequestTags(tags, requestCtx);
|
|
353
|
+
|
|
328
354
|
// Check if this is a partial request (navigation) vs document request
|
|
329
355
|
const isPartial = requestCtx.originalUrl.searchParams.has("_rsc_partial");
|
|
330
356
|
|
|
@@ -388,6 +414,7 @@ export class CacheScope {
|
|
|
388
414
|
segments: serializedSegments,
|
|
389
415
|
handles,
|
|
390
416
|
expiresAt: Date.now() + ttl * 1000,
|
|
417
|
+
tags,
|
|
391
418
|
};
|
|
392
419
|
|
|
393
420
|
if (INTERNAL_RANGO_DEBUG) {
|
|
@@ -405,7 +432,11 @@ export class CacheScope {
|
|
|
405
432
|
);
|
|
406
433
|
}
|
|
407
434
|
} catch (error) {
|
|
408
|
-
|
|
435
|
+
reportCacheError(
|
|
436
|
+
error,
|
|
437
|
+
"cache-write",
|
|
438
|
+
`[CacheScope] Failed to cache ${key}`,
|
|
439
|
+
);
|
|
409
440
|
}
|
|
410
441
|
});
|
|
411
442
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache Tag API
|
|
3
|
+
*
|
|
4
|
+
* Provides cacheTag() for tagging cached entries at runtime inside "use cache"
|
|
5
|
+
* functions. Tags are scoped via AsyncLocalStorage; calling cacheTag() outside
|
|
6
|
+
* a "use cache" execution throws.
|
|
7
|
+
*
|
|
8
|
+
* The runtime (cache-runtime.ts) wraps "use cache" execution in
|
|
9
|
+
* runWithCacheTagScope(), collects the runtime tags, and merges them with the
|
|
10
|
+
* profile/DSL tags before storing.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
14
|
+
import {
|
|
15
|
+
_getRequestContext,
|
|
16
|
+
type RequestContext,
|
|
17
|
+
} from "../server/request-context.js";
|
|
18
|
+
|
|
19
|
+
const cacheTagStorage = new AsyncLocalStorage<Set<string>>();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Normalize a tag for storage.
|
|
23
|
+
*
|
|
24
|
+
* Returns the tag unchanged if usable, or null if it is empty/whitespace-only
|
|
25
|
+
* (dropped consistently in every environment - an empty tag matches nothing).
|
|
26
|
+
*
|
|
27
|
+
* Backend-specific constraints are intentionally NOT enforced here so the tag
|
|
28
|
+
* primitive stays backend-agnostic. In particular, the CFCacheStore
|
|
29
|
+
* encodeURIComponent's tags at serialization time so commas/spaces/non-Latin1
|
|
30
|
+
* characters cannot corrupt the comma-delimited Cloudflare Cache-Tag header or
|
|
31
|
+
* the HTTP marker header (it does not reject them). Keep tags short and
|
|
32
|
+
* low-cardinality: a tag's KV marker key must stay under Cloudflare's 512-byte
|
|
33
|
+
* limit, and a Cache-Tag value under 1024 bytes. The in-memory store has no
|
|
34
|
+
* such limitations.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export function normalizeTag(tag: string): string | null {
|
|
39
|
+
if (!tag || !tag.trim()) return null;
|
|
40
|
+
return tag;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Normalize a tag collection: drop empty/whitespace-only tags so the WRITE path
|
|
45
|
+
* matches the invalidate path (updateTag/revalidateTag/cacheTag all normalize).
|
|
46
|
+
* Does not deduplicate - callers that need that wrap with a Set.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export function normalizeTags(tags: Iterable<string>): string[] {
|
|
51
|
+
const out: string[] = [];
|
|
52
|
+
for (const tag of tags) {
|
|
53
|
+
const normalized = normalizeTag(tag);
|
|
54
|
+
if (normalized !== null) out.push(normalized);
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Tag the current "use cache" entry for later invalidation via
|
|
61
|
+
* updateTag() / revalidateTag().
|
|
62
|
+
*
|
|
63
|
+
* Must be called inside a function marked with "use cache".
|
|
64
|
+
* Tags are additive - multiple calls accumulate.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* async function getProduct(ctx) {
|
|
69
|
+
* "use cache";
|
|
70
|
+
* cacheTag(`product:${ctx.params.id}`, "products");
|
|
71
|
+
* return db.getProduct(ctx.params.id);
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export function cacheTag(...tags: string[]): void {
|
|
76
|
+
const store = cacheTagStorage.getStore();
|
|
77
|
+
if (!store) {
|
|
78
|
+
throw new Error('cacheTag() must be called inside a "use cache" function.');
|
|
79
|
+
}
|
|
80
|
+
for (const tag of tags) {
|
|
81
|
+
const normalized = normalizeTag(tag);
|
|
82
|
+
if (normalized === null) {
|
|
83
|
+
if (process.env.NODE_ENV !== "production") {
|
|
84
|
+
console.warn(`[cacheTag] Ignoring empty or whitespace-only tag.`);
|
|
85
|
+
}
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
store.add(normalized);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Record `tags` into the request-scoped tag set (ctx._requestTags), the union of
|
|
94
|
+
* every cache tag resolved while producing the response. The document cache reads
|
|
95
|
+
* this after the render settles so a full-page entry is tagged with everything its
|
|
96
|
+
* content used, making it invalidatable by updateTag()/revalidateTag().
|
|
97
|
+
*
|
|
98
|
+
* Called at the tag-resolution sites: "use cache" stores (cache-runtime, both the
|
|
99
|
+
* miss and read/hit paths), loader cache (cache-policy/loader-cache), and segment
|
|
100
|
+
* cache() (cache-scope). Writes the field directly (not via ctx.set()) so it does
|
|
101
|
+
* not trip the cache-scope side-effect guard, mirroring cacheTag() itself.
|
|
102
|
+
*
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
export function recordRequestTags(
|
|
106
|
+
tags: Iterable<string> | undefined,
|
|
107
|
+
ctx: RequestContext | undefined = _getRequestContext(),
|
|
108
|
+
): void {
|
|
109
|
+
if (!tags) return;
|
|
110
|
+
const set = ctx?._requestTags;
|
|
111
|
+
if (!set) return;
|
|
112
|
+
for (const tag of tags) {
|
|
113
|
+
const normalized = normalizeTag(tag);
|
|
114
|
+
if (normalized !== null) set.add(normalized);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Run a function within a cache tag scope. Any cacheTag() calls inside `fn`
|
|
120
|
+
* accumulate into the returned Set.
|
|
121
|
+
*
|
|
122
|
+
* The returned Set is the LIVE reference - the caller must await `result`
|
|
123
|
+
* before reading `tags`, because an async cached function may call cacheTag()
|
|
124
|
+
* after an await boundary.
|
|
125
|
+
*
|
|
126
|
+
* @internal Used by cache-runtime.ts to wrap "use cache" execution.
|
|
127
|
+
*/
|
|
128
|
+
export function runWithCacheTagScope<T>(fn: () => T): {
|
|
129
|
+
result: T;
|
|
130
|
+
tags: Set<string>;
|
|
131
|
+
} {
|
|
132
|
+
const tagSet = new Set<string>();
|
|
133
|
+
const result = cacheTagStorage.run(tagSet, fn);
|
|
134
|
+
return { result, tags: tagSet };
|
|
135
|
+
}
|