@rangojs/router 0.0.0-experimental.debug-cache-2383ca26 → 0.0.0-experimental.df410dd5
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 +196 -43
- package/dist/__internal.d.ts +83 -0
- package/dist/__internal.d.ts.map +1 -0
- package/dist/__internal.js +19 -0
- package/dist/__internal.js.map +1 -0
- package/dist/__mocks__/version.d.ts +7 -0
- package/dist/__mocks__/version.d.ts.map +1 -0
- package/dist/__mocks__/version.js +7 -0
- package/dist/__mocks__/version.js.map +1 -0
- package/dist/__tests__/client-href.test.d.ts +2 -0
- package/dist/__tests__/client-href.test.d.ts.map +1 -0
- package/dist/__tests__/client-href.test.js +74 -0
- package/dist/__tests__/client-href.test.js.map +1 -0
- package/dist/__tests__/component-utils.test.d.ts +2 -0
- package/dist/__tests__/component-utils.test.d.ts.map +1 -0
- package/dist/__tests__/component-utils.test.js +51 -0
- package/dist/__tests__/component-utils.test.js.map +1 -0
- package/dist/__tests__/event-controller.test.d.ts +2 -0
- package/dist/__tests__/event-controller.test.d.ts.map +1 -0
- package/dist/__tests__/event-controller.test.js +538 -0
- package/dist/__tests__/event-controller.test.js.map +1 -0
- package/dist/__tests__/helpers/route-tree.d.ts +118 -0
- package/dist/__tests__/helpers/route-tree.d.ts.map +1 -0
- package/dist/__tests__/helpers/route-tree.js +374 -0
- package/dist/__tests__/helpers/route-tree.js.map +1 -0
- package/dist/__tests__/match-result.test.d.ts +2 -0
- package/dist/__tests__/match-result.test.d.ts.map +1 -0
- package/dist/__tests__/match-result.test.js +154 -0
- package/dist/__tests__/match-result.test.js.map +1 -0
- package/dist/__tests__/navigation-store.test.d.ts +2 -0
- package/dist/__tests__/navigation-store.test.d.ts.map +1 -0
- package/dist/__tests__/navigation-store.test.js +440 -0
- package/dist/__tests__/navigation-store.test.js.map +1 -0
- package/dist/__tests__/partial-update.test.d.ts +2 -0
- package/dist/__tests__/partial-update.test.d.ts.map +1 -0
- package/dist/__tests__/partial-update.test.js +1009 -0
- package/dist/__tests__/partial-update.test.js.map +1 -0
- package/dist/__tests__/reverse-types.test.d.ts +8 -0
- package/dist/__tests__/reverse-types.test.d.ts.map +1 -0
- package/dist/__tests__/reverse-types.test.js +656 -0
- package/dist/__tests__/reverse-types.test.js.map +1 -0
- package/dist/__tests__/route-definition.test.d.ts +2 -0
- package/dist/__tests__/route-definition.test.d.ts.map +1 -0
- package/dist/__tests__/route-definition.test.js +55 -0
- package/dist/__tests__/route-definition.test.js.map +1 -0
- package/dist/__tests__/router-helpers.test.d.ts +2 -0
- package/dist/__tests__/router-helpers.test.d.ts.map +1 -0
- package/dist/__tests__/router-helpers.test.js +377 -0
- package/dist/__tests__/router-helpers.test.js.map +1 -0
- package/dist/__tests__/router-integration-2.test.d.ts +2 -0
- package/dist/__tests__/router-integration-2.test.d.ts.map +1 -0
- package/dist/__tests__/router-integration-2.test.js +426 -0
- package/dist/__tests__/router-integration-2.test.js.map +1 -0
- package/dist/__tests__/router-integration.test.d.ts +2 -0
- package/dist/__tests__/router-integration.test.d.ts.map +1 -0
- package/dist/__tests__/router-integration.test.js +1051 -0
- package/dist/__tests__/router-integration.test.js.map +1 -0
- package/dist/__tests__/search-params.test.d.ts +5 -0
- package/dist/__tests__/search-params.test.d.ts.map +1 -0
- package/dist/__tests__/search-params.test.js +306 -0
- package/dist/__tests__/search-params.test.js.map +1 -0
- package/dist/__tests__/segment-system.test.d.ts +2 -0
- package/dist/__tests__/segment-system.test.d.ts.map +1 -0
- package/dist/__tests__/segment-system.test.js +627 -0
- package/dist/__tests__/segment-system.test.js.map +1 -0
- package/dist/__tests__/static-handler-types.test.d.ts +8 -0
- package/dist/__tests__/static-handler-types.test.d.ts.map +1 -0
- package/dist/__tests__/static-handler-types.test.js +63 -0
- package/dist/__tests__/static-handler-types.test.js.map +1 -0
- package/dist/__tests__/urls.test.d.ts +2 -0
- package/dist/__tests__/urls.test.d.ts.map +1 -0
- package/dist/__tests__/urls.test.js +421 -0
- package/dist/__tests__/urls.test.js.map +1 -0
- package/dist/__tests__/use-mount.test.d.ts +2 -0
- package/dist/__tests__/use-mount.test.d.ts.map +1 -0
- package/dist/__tests__/use-mount.test.js +35 -0
- package/dist/__tests__/use-mount.test.js.map +1 -0
- package/dist/bin/rango.d.ts +2 -0
- package/dist/bin/rango.d.ts.map +1 -0
- package/dist/bin/rango.js +269 -96
- package/dist/bin/rango.js.map +1 -0
- package/dist/browser/event-controller.d.ts +191 -0
- package/dist/browser/event-controller.d.ts.map +1 -0
- package/dist/browser/event-controller.js +559 -0
- package/dist/browser/event-controller.js.map +1 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +14 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/link-interceptor.d.ts +38 -0
- package/dist/browser/link-interceptor.d.ts.map +1 -0
- package/dist/browser/link-interceptor.js +99 -0
- package/dist/browser/link-interceptor.js.map +1 -0
- package/dist/browser/logging.d.ts +10 -0
- package/dist/browser/logging.d.ts.map +1 -0
- package/dist/browser/logging.js +29 -0
- package/dist/browser/logging.js.map +1 -0
- package/dist/browser/lru-cache.d.ts +17 -0
- package/dist/browser/lru-cache.d.ts.map +1 -0
- package/dist/browser/lru-cache.js +50 -0
- package/dist/browser/lru-cache.js.map +1 -0
- package/dist/browser/merge-segment-loaders.d.ts +39 -0
- package/dist/browser/merge-segment-loaders.d.ts.map +1 -0
- package/dist/browser/merge-segment-loaders.js +102 -0
- package/dist/browser/merge-segment-loaders.js.map +1 -0
- package/dist/browser/navigation-bridge.d.ts +102 -0
- package/dist/browser/navigation-bridge.d.ts.map +1 -0
- package/dist/browser/navigation-bridge.js +708 -0
- package/dist/browser/navigation-bridge.js.map +1 -0
- package/dist/browser/navigation-client.d.ts +25 -0
- package/dist/browser/navigation-client.d.ts.map +1 -0
- package/dist/browser/navigation-client.js +157 -0
- package/dist/browser/navigation-client.js.map +1 -0
- package/dist/browser/navigation-store.d.ts +101 -0
- package/dist/browser/navigation-store.d.ts.map +1 -0
- package/dist/browser/navigation-store.js +625 -0
- package/dist/browser/navigation-store.js.map +1 -0
- package/dist/browser/partial-update.d.ts +75 -0
- package/dist/browser/partial-update.d.ts.map +1 -0
- package/dist/browser/partial-update.js +426 -0
- package/dist/browser/partial-update.js.map +1 -0
- package/dist/browser/react/Link.d.ts +86 -0
- package/dist/browser/react/Link.d.ts.map +1 -0
- package/dist/browser/react/Link.js +128 -0
- package/dist/browser/react/Link.js.map +1 -0
- package/dist/browser/react/NavigationProvider.d.ts +63 -0
- package/dist/browser/react/NavigationProvider.d.ts.map +1 -0
- package/dist/browser/react/NavigationProvider.js +216 -0
- package/dist/browser/react/NavigationProvider.js.map +1 -0
- package/dist/browser/react/ScrollRestoration.d.ts +75 -0
- package/dist/browser/react/ScrollRestoration.d.ts.map +1 -0
- package/dist/browser/react/ScrollRestoration.js +57 -0
- package/dist/browser/react/ScrollRestoration.js.map +1 -0
- package/dist/browser/react/context.d.ts +46 -0
- package/dist/browser/react/context.d.ts.map +1 -0
- package/dist/browser/react/context.js +10 -0
- package/dist/browser/react/context.js.map +1 -0
- package/dist/browser/react/index.d.ts +11 -0
- package/dist/browser/react/index.d.ts.map +1 -0
- package/dist/browser/react/index.js +22 -0
- package/dist/browser/react/index.js.map +1 -0
- package/dist/browser/react/location-state-shared.d.ts +63 -0
- package/dist/browser/react/location-state-shared.d.ts.map +1 -0
- package/dist/browser/react/location-state-shared.js +81 -0
- package/dist/browser/react/location-state-shared.js.map +1 -0
- package/dist/browser/react/location-state.d.ts +23 -0
- package/dist/browser/react/location-state.d.ts.map +1 -0
- package/dist/browser/react/location-state.js +29 -0
- package/dist/browser/react/location-state.js.map +1 -0
- package/dist/browser/react/mount-context.d.ts +24 -0
- package/dist/browser/react/mount-context.d.ts.map +1 -0
- package/dist/browser/react/mount-context.js +24 -0
- package/dist/browser/react/mount-context.js.map +1 -0
- package/dist/browser/react/use-action.d.ts +64 -0
- package/dist/browser/react/use-action.d.ts.map +1 -0
- package/dist/browser/react/use-action.js +134 -0
- package/dist/browser/react/use-action.js.map +1 -0
- package/dist/browser/react/use-client-cache.d.ts +41 -0
- package/dist/browser/react/use-client-cache.d.ts.map +1 -0
- package/dist/browser/react/use-client-cache.js +39 -0
- package/dist/browser/react/use-client-cache.js.map +1 -0
- package/dist/browser/react/use-handle.d.ts +31 -0
- package/dist/browser/react/use-handle.d.ts.map +1 -0
- package/dist/browser/react/use-handle.js +144 -0
- package/dist/browser/react/use-handle.js.map +1 -0
- package/dist/browser/react/use-href.d.ts +33 -0
- package/dist/browser/react/use-href.d.ts.map +1 -0
- package/dist/browser/react/use-href.js +39 -0
- package/dist/browser/react/use-href.js.map +1 -0
- package/dist/browser/react/use-link-status.d.ts +37 -0
- package/dist/browser/react/use-link-status.d.ts.map +1 -0
- package/dist/browser/react/use-link-status.js +99 -0
- package/dist/browser/react/use-link-status.js.map +1 -0
- package/dist/browser/react/use-mount.d.ts +25 -0
- package/dist/browser/react/use-mount.d.ts.map +1 -0
- package/dist/browser/react/use-mount.js +30 -0
- package/dist/browser/react/use-mount.js.map +1 -0
- package/dist/browser/react/use-navigation.d.ts +27 -0
- package/dist/browser/react/use-navigation.d.ts.map +1 -0
- package/dist/browser/react/use-navigation.js +87 -0
- package/dist/browser/react/use-navigation.js.map +1 -0
- package/dist/browser/react/use-segments.d.ts +38 -0
- package/dist/browser/react/use-segments.d.ts.map +1 -0
- package/dist/browser/react/use-segments.js +130 -0
- package/dist/browser/react/use-segments.js.map +1 -0
- package/dist/browser/request-controller.d.ts +26 -0
- package/dist/browser/request-controller.d.ts.map +1 -0
- package/dist/browser/request-controller.js +147 -0
- package/dist/browser/request-controller.js.map +1 -0
- package/dist/browser/rsc-router.d.ts +129 -0
- package/dist/browser/rsc-router.d.ts.map +1 -0
- package/dist/browser/rsc-router.js +195 -0
- package/dist/browser/rsc-router.js.map +1 -0
- package/dist/browser/scroll-restoration.d.ts +93 -0
- package/dist/browser/scroll-restoration.d.ts.map +1 -0
- package/dist/browser/scroll-restoration.js +321 -0
- package/dist/browser/scroll-restoration.js.map +1 -0
- package/dist/browser/segment-structure-assert.d.ts +17 -0
- package/dist/browser/segment-structure-assert.d.ts.map +1 -0
- package/dist/browser/segment-structure-assert.js +59 -0
- package/dist/browser/segment-structure-assert.js.map +1 -0
- package/dist/browser/server-action-bridge.d.ts +26 -0
- package/dist/browser/server-action-bridge.d.ts.map +1 -0
- package/dist/browser/server-action-bridge.js +668 -0
- package/dist/browser/server-action-bridge.js.map +1 -0
- package/dist/browser/shallow.d.ts +12 -0
- package/dist/browser/shallow.d.ts.map +1 -0
- package/dist/browser/shallow.js +34 -0
- package/dist/browser/shallow.js.map +1 -0
- package/dist/browser/types.d.ts +369 -0
- package/dist/browser/types.d.ts.map +1 -0
- package/dist/browser/types.js +2 -0
- package/dist/browser/types.js.map +1 -0
- package/dist/build/__tests__/generate-cli.test.d.ts +2 -0
- package/dist/build/__tests__/generate-cli.test.d.ts.map +1 -0
- package/dist/build/__tests__/generate-cli.test.js +237 -0
- package/dist/build/__tests__/generate-cli.test.js.map +1 -0
- package/dist/build/__tests__/generate-manifest.test.d.ts +2 -0
- package/dist/build/__tests__/generate-manifest.test.d.ts.map +1 -0
- package/dist/build/__tests__/generate-manifest.test.js +119 -0
- package/dist/build/__tests__/generate-manifest.test.js.map +1 -0
- package/dist/build/__tests__/generate-route-types.test.d.ts +2 -0
- package/dist/build/__tests__/generate-route-types.test.d.ts.map +1 -0
- package/dist/build/__tests__/generate-route-types.test.js +620 -0
- package/dist/build/__tests__/generate-route-types.test.js.map +1 -0
- package/dist/build/__tests__/per-router-manifest.test.d.ts +2 -0
- package/dist/build/__tests__/per-router-manifest.test.d.ts.map +1 -0
- package/dist/build/__tests__/per-router-manifest.test.js +308 -0
- package/dist/build/__tests__/per-router-manifest.test.js.map +1 -0
- package/dist/build/generate-manifest.d.ts +81 -0
- package/dist/build/generate-manifest.d.ts.map +1 -0
- package/dist/build/generate-manifest.js +276 -0
- package/dist/build/generate-manifest.js.map +1 -0
- package/dist/build/generate-route-types.d.ts +115 -0
- package/dist/build/generate-route-types.d.ts.map +1 -0
- package/dist/build/generate-route-types.js +740 -0
- package/dist/build/generate-route-types.js.map +1 -0
- package/dist/build/index.d.ts +21 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +21 -0
- package/dist/build/index.js.map +1 -0
- package/dist/build/route-trie.d.ts +71 -0
- package/dist/build/route-trie.d.ts.map +1 -0
- package/dist/build/route-trie.js +175 -0
- package/dist/build/route-trie.js.map +1 -0
- package/dist/cache/__tests__/cache-scope.test.d.ts +2 -0
- package/dist/cache/__tests__/cache-scope.test.d.ts.map +1 -0
- package/dist/cache/__tests__/cache-scope.test.js +208 -0
- package/dist/cache/__tests__/cache-scope.test.js.map +1 -0
- package/dist/cache/__tests__/document-cache.test.d.ts +2 -0
- package/dist/cache/__tests__/document-cache.test.d.ts.map +1 -0
- package/dist/cache/__tests__/document-cache.test.js +345 -0
- package/dist/cache/__tests__/document-cache.test.js.map +1 -0
- package/dist/cache/__tests__/memory-segment-store.test.d.ts +2 -0
- package/dist/cache/__tests__/memory-segment-store.test.d.ts.map +1 -0
- package/dist/cache/__tests__/memory-segment-store.test.js +425 -0
- package/dist/cache/__tests__/memory-segment-store.test.js.map +1 -0
- package/dist/cache/__tests__/memory-store.test.d.ts +2 -0
- package/dist/cache/__tests__/memory-store.test.d.ts.map +1 -0
- package/dist/cache/__tests__/memory-store.test.js +367 -0
- package/dist/cache/__tests__/memory-store.test.js.map +1 -0
- package/dist/cache/cache-scope.d.ts +102 -0
- package/dist/cache/cache-scope.d.ts.map +1 -0
- package/dist/cache/cache-scope.js +440 -0
- package/dist/cache/cache-scope.js.map +1 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts +2 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts.map +1 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.js +330 -0
- package/dist/cache/cf/__tests__/cf-cache-store.test.js.map +1 -0
- package/dist/cache/cf/cf-cache-store.d.ts +165 -0
- package/dist/cache/cf/cf-cache-store.d.ts.map +1 -0
- package/dist/cache/cf/cf-cache-store.js +242 -0
- package/dist/cache/cf/cf-cache-store.js.map +1 -0
- package/dist/cache/cf/index.d.ts +14 -0
- package/dist/cache/cf/index.d.ts.map +1 -0
- package/dist/cache/cf/index.js +17 -0
- package/dist/cache/cf/index.js.map +1 -0
- package/dist/cache/document-cache.d.ts +64 -0
- package/dist/cache/document-cache.d.ts.map +1 -0
- package/dist/cache/document-cache.js +228 -0
- package/dist/cache/document-cache.js.map +1 -0
- package/dist/cache/index.d.ts +19 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +21 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/memory-segment-store.d.ts +110 -0
- package/dist/cache/memory-segment-store.d.ts.map +1 -0
- package/dist/cache/memory-segment-store.js +117 -0
- package/dist/cache/memory-segment-store.js.map +1 -0
- package/dist/cache/memory-store.d.ts +41 -0
- package/dist/cache/memory-store.d.ts.map +1 -0
- package/dist/cache/memory-store.js +191 -0
- package/dist/cache/memory-store.js.map +1 -0
- package/dist/cache/types.d.ts +317 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +12 -0
- package/dist/cache/types.js.map +1 -0
- package/dist/client.d.ts +248 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +367 -0
- package/dist/client.js.map +1 -0
- package/dist/client.rsc.d.ts +26 -0
- package/dist/client.rsc.d.ts.map +1 -0
- package/dist/client.rsc.js +46 -0
- package/dist/client.rsc.js.map +1 -0
- package/dist/component-utils.d.ts +36 -0
- package/dist/component-utils.d.ts.map +1 -0
- package/dist/component-utils.js +61 -0
- package/dist/component-utils.js.map +1 -0
- package/dist/components/DefaultDocument.d.ts +13 -0
- package/dist/components/DefaultDocument.d.ts.map +1 -0
- package/dist/components/DefaultDocument.js +15 -0
- package/dist/components/DefaultDocument.js.map +1 -0
- package/dist/debug.d.ts +58 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +157 -0
- package/dist/debug.js.map +1 -0
- package/dist/default-error-boundary.d.ts +11 -0
- package/dist/default-error-boundary.d.ts.map +1 -0
- package/dist/default-error-boundary.js +45 -0
- package/dist/default-error-boundary.js.map +1 -0
- package/dist/deps/browser.d.ts +2 -0
- package/dist/deps/browser.d.ts.map +1 -0
- package/dist/deps/browser.js +3 -0
- package/dist/deps/browser.js.map +1 -0
- package/dist/deps/html-stream-client.d.ts +2 -0
- package/dist/deps/html-stream-client.d.ts.map +1 -0
- package/dist/deps/html-stream-client.js +3 -0
- package/dist/deps/html-stream-client.js.map +1 -0
- package/dist/deps/html-stream-server.d.ts +2 -0
- package/dist/deps/html-stream-server.d.ts.map +1 -0
- package/dist/deps/html-stream-server.js +3 -0
- package/dist/deps/html-stream-server.js.map +1 -0
- package/dist/deps/rsc.d.ts +2 -0
- package/dist/deps/rsc.d.ts.map +1 -0
- package/dist/deps/rsc.js +4 -0
- package/dist/deps/rsc.js.map +1 -0
- package/dist/deps/ssr.d.ts +2 -0
- package/dist/deps/ssr.d.ts.map +1 -0
- package/dist/deps/ssr.js +3 -0
- package/dist/deps/ssr.js.map +1 -0
- package/dist/errors.d.ts +174 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +241 -0
- package/dist/errors.js.map +1 -0
- package/dist/handle.d.ts +78 -0
- package/dist/handle.d.ts.map +1 -0
- package/dist/handle.js +82 -0
- package/dist/handle.js.map +1 -0
- package/dist/handles/MetaTags.d.ts +14 -0
- package/dist/handles/MetaTags.d.ts.map +1 -0
- package/dist/handles/MetaTags.js +136 -0
- package/dist/handles/MetaTags.js.map +1 -0
- package/dist/handles/index.d.ts +6 -0
- package/dist/handles/index.d.ts.map +1 -0
- package/dist/handles/index.js +6 -0
- package/dist/handles/index.js.map +1 -0
- package/dist/handles/meta.d.ts +39 -0
- package/dist/handles/meta.d.ts.map +1 -0
- package/dist/handles/meta.js +202 -0
- package/dist/handles/meta.js.map +1 -0
- package/dist/host/__tests__/errors.test.d.ts +2 -0
- package/dist/host/__tests__/errors.test.d.ts.map +1 -0
- package/dist/host/__tests__/errors.test.js +76 -0
- package/dist/host/__tests__/errors.test.js.map +1 -0
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts +2 -0
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts.map +1 -0
- package/dist/host/__tests__/pattern-comprehensive.test.js +732 -0
- package/dist/host/__tests__/pattern-comprehensive.test.js.map +1 -0
- package/dist/host/__tests__/pattern-matcher.test.d.ts +2 -0
- package/dist/host/__tests__/pattern-matcher.test.d.ts.map +1 -0
- package/dist/host/__tests__/pattern-matcher.test.js +251 -0
- package/dist/host/__tests__/pattern-matcher.test.js.map +1 -0
- package/dist/host/__tests__/router.test.d.ts +2 -0
- package/dist/host/__tests__/router.test.d.ts.map +1 -0
- package/dist/host/__tests__/router.test.js +241 -0
- package/dist/host/__tests__/router.test.js.map +1 -0
- package/dist/host/__tests__/testing.test.d.ts +2 -0
- package/dist/host/__tests__/testing.test.d.ts.map +1 -0
- package/dist/host/__tests__/testing.test.js +64 -0
- package/dist/host/__tests__/testing.test.js.map +1 -0
- package/dist/host/__tests__/utils.test.d.ts +2 -0
- package/dist/host/__tests__/utils.test.d.ts.map +1 -0
- package/dist/host/__tests__/utils.test.js +29 -0
- package/dist/host/__tests__/utils.test.js.map +1 -0
- package/dist/host/cookie-handler.d.ts +34 -0
- package/dist/host/cookie-handler.d.ts.map +1 -0
- package/dist/host/cookie-handler.js +124 -0
- package/dist/host/cookie-handler.js.map +1 -0
- package/dist/host/errors.d.ts +56 -0
- package/dist/host/errors.d.ts.map +1 -0
- package/dist/host/errors.js +79 -0
- package/dist/host/errors.js.map +1 -0
- package/dist/host/index.d.ts +29 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +32 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/pattern-matcher.d.ts +36 -0
- package/dist/host/pattern-matcher.d.ts.map +1 -0
- package/dist/host/pattern-matcher.js +172 -0
- package/dist/host/pattern-matcher.js.map +1 -0
- package/dist/host/router.d.ts +26 -0
- package/dist/host/router.d.ts.map +1 -0
- package/dist/host/router.js +218 -0
- package/dist/host/router.js.map +1 -0
- package/dist/host/testing.d.ts +36 -0
- package/dist/host/testing.d.ts.map +1 -0
- package/dist/host/testing.js +55 -0
- package/dist/host/testing.js.map +1 -0
- package/dist/host/types.d.ts +115 -0
- package/dist/host/types.d.ts.map +1 -0
- package/dist/host/types.js +7 -0
- package/dist/host/types.js.map +1 -0
- package/dist/host/utils.d.ts +21 -0
- package/dist/host/utils.d.ts.map +1 -0
- package/dist/host/utils.js +23 -0
- package/dist/host/utils.js.map +1 -0
- package/dist/href-client.d.ts +131 -0
- package/dist/href-client.d.ts.map +1 -0
- package/dist/href-client.js +64 -0
- package/dist/href-client.js.map +1 -0
- package/dist/href-context.d.ts +29 -0
- package/dist/href-context.d.ts.map +1 -0
- package/dist/href-context.js +21 -0
- package/dist/href-context.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/index.rsc.d.ts +32 -0
- package/dist/index.rsc.d.ts.map +1 -0
- package/dist/index.rsc.js +40 -0
- package/dist/index.rsc.js.map +1 -0
- package/dist/internal-debug.d.ts +2 -0
- package/dist/internal-debug.d.ts.map +1 -0
- package/dist/internal-debug.js +5 -0
- package/dist/internal-debug.js.map +1 -0
- package/dist/loader.d.ts +14 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +20 -0
- package/dist/loader.js.map +1 -0
- package/dist/loader.rsc.d.ts +19 -0
- package/dist/loader.rsc.d.ts.map +1 -0
- package/dist/loader.rsc.js +99 -0
- package/dist/loader.rsc.js.map +1 -0
- package/dist/network-error-thrower.d.ts +17 -0
- package/dist/network-error-thrower.d.ts.map +1 -0
- package/dist/network-error-thrower.js +14 -0
- package/dist/network-error-thrower.js.map +1 -0
- package/dist/outlet-context.d.ts +13 -0
- package/dist/outlet-context.d.ts.map +1 -0
- package/dist/outlet-context.js +3 -0
- package/dist/outlet-context.js.map +1 -0
- package/dist/prerender/__tests__/param-hash.test.d.ts +2 -0
- package/dist/prerender/__tests__/param-hash.test.d.ts.map +1 -0
- package/dist/prerender/__tests__/param-hash.test.js +148 -0
- package/dist/prerender/__tests__/param-hash.test.js.map +1 -0
- package/dist/prerender/param-hash.d.ts +16 -0
- package/dist/prerender/param-hash.d.ts.map +1 -0
- package/dist/prerender/param-hash.js +36 -0
- package/dist/prerender/param-hash.js.map +1 -0
- package/dist/prerender/store.d.ts +38 -0
- package/dist/prerender/store.d.ts.map +1 -0
- package/dist/prerender/store.js +61 -0
- package/dist/prerender/store.js.map +1 -0
- package/dist/prerender.d.ts +66 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +57 -0
- package/dist/prerender.js.map +1 -0
- package/dist/reverse.d.ts +196 -0
- package/dist/reverse.d.ts.map +1 -0
- package/dist/reverse.js +78 -0
- package/dist/reverse.js.map +1 -0
- package/dist/root-error-boundary.d.ts +33 -0
- package/dist/root-error-boundary.d.ts.map +1 -0
- package/dist/root-error-boundary.js +165 -0
- package/dist/root-error-boundary.js.map +1 -0
- package/dist/route-content-wrapper.d.ts +46 -0
- package/dist/route-content-wrapper.d.ts.map +1 -0
- package/dist/route-content-wrapper.js +77 -0
- package/dist/route-content-wrapper.js.map +1 -0
- package/dist/route-definition.d.ts +421 -0
- package/dist/route-definition.d.ts.map +1 -0
- package/dist/route-definition.js +868 -0
- package/dist/route-definition.js.map +1 -0
- package/dist/route-map-builder.d.ts +155 -0
- package/dist/route-map-builder.d.ts.map +1 -0
- package/dist/route-map-builder.js +237 -0
- package/dist/route-map-builder.js.map +1 -0
- package/dist/route-types.d.ts +165 -0
- package/dist/route-types.d.ts.map +1 -0
- package/dist/route-types.js +7 -0
- package/dist/route-types.js.map +1 -0
- package/dist/router/__tests__/handler-context.test.d.ts +2 -0
- package/dist/router/__tests__/handler-context.test.d.ts.map +1 -0
- package/dist/router/__tests__/handler-context.test.js +65 -0
- package/dist/router/__tests__/handler-context.test.js.map +1 -0
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts +2 -0
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts.map +1 -0
- package/dist/router/__tests__/loader-cycle-detection.test.js +221 -0
- package/dist/router/__tests__/loader-cycle-detection.test.js.map +1 -0
- package/dist/router/__tests__/match-context.test.d.ts +2 -0
- package/dist/router/__tests__/match-context.test.d.ts.map +1 -0
- package/dist/router/__tests__/match-context.test.js +92 -0
- package/dist/router/__tests__/match-context.test.js.map +1 -0
- package/dist/router/__tests__/match-pipelines.test.d.ts +2 -0
- package/dist/router/__tests__/match-pipelines.test.d.ts.map +1 -0
- package/dist/router/__tests__/match-pipelines.test.js +417 -0
- package/dist/router/__tests__/match-pipelines.test.js.map +1 -0
- package/dist/router/__tests__/match-result.test.d.ts +2 -0
- package/dist/router/__tests__/match-result.test.d.ts.map +1 -0
- package/dist/router/__tests__/match-result.test.js +457 -0
- package/dist/router/__tests__/match-result.test.js.map +1 -0
- package/dist/router/__tests__/on-error.test.d.ts +2 -0
- package/dist/router/__tests__/on-error.test.d.ts.map +1 -0
- package/dist/router/__tests__/on-error.test.js +678 -0
- package/dist/router/__tests__/on-error.test.js.map +1 -0
- package/dist/router/__tests__/pattern-matching.test.d.ts +2 -0
- package/dist/router/__tests__/pattern-matching.test.d.ts.map +1 -0
- package/dist/router/__tests__/pattern-matching.test.js +629 -0
- package/dist/router/__tests__/pattern-matching.test.js.map +1 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts +2 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts.map +1 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js +155 -0
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js.map +1 -0
- package/dist/router/error-handling.d.ts +77 -0
- package/dist/router/error-handling.d.ts.map +1 -0
- package/dist/router/error-handling.js +202 -0
- package/dist/router/error-handling.js.map +1 -0
- package/dist/router/handler-context.d.ts +20 -0
- package/dist/router/handler-context.d.ts.map +1 -0
- package/dist/router/handler-context.js +198 -0
- package/dist/router/handler-context.js.map +1 -0
- package/dist/router/intercept-resolution.d.ts +66 -0
- package/dist/router/intercept-resolution.d.ts.map +1 -0
- package/dist/router/intercept-resolution.js +246 -0
- package/dist/router/intercept-resolution.js.map +1 -0
- package/dist/router/loader-resolution.d.ts +64 -0
- package/dist/router/loader-resolution.d.ts.map +1 -0
- package/dist/router/loader-resolution.js +284 -0
- package/dist/router/loader-resolution.js.map +1 -0
- package/dist/router/logging.d.ts +15 -0
- package/dist/router/logging.d.ts.map +1 -0
- package/dist/router/logging.js +99 -0
- package/dist/router/logging.js.map +1 -0
- package/dist/router/manifest.d.ts +22 -0
- package/dist/router/manifest.d.ts.map +1 -0
- package/dist/router/manifest.js +181 -0
- package/dist/router/manifest.js.map +1 -0
- package/dist/router/match-api.d.ts +35 -0
- package/dist/router/match-api.d.ts.map +1 -0
- package/dist/router/match-api.js +406 -0
- package/dist/router/match-api.js.map +1 -0
- package/dist/router/match-context.d.ts +206 -0
- package/dist/router/match-context.d.ts.map +1 -0
- package/dist/router/match-context.js +17 -0
- package/dist/router/match-context.js.map +1 -0
- package/dist/router/match-middleware/background-revalidation.d.ts +127 -0
- package/dist/router/match-middleware/background-revalidation.d.ts.map +1 -0
- package/dist/router/match-middleware/background-revalidation.js +75 -0
- package/dist/router/match-middleware/background-revalidation.js.map +1 -0
- package/dist/router/match-middleware/cache-lookup.d.ts +112 -0
- package/dist/router/match-middleware/cache-lookup.d.ts.map +1 -0
- package/dist/router/match-middleware/cache-lookup.js +257 -0
- package/dist/router/match-middleware/cache-lookup.js.map +1 -0
- package/dist/router/match-middleware/cache-store.d.ts +113 -0
- package/dist/router/match-middleware/cache-store.d.ts.map +1 -0
- package/dist/router/match-middleware/cache-store.js +108 -0
- package/dist/router/match-middleware/cache-store.js.map +1 -0
- package/dist/router/match-middleware/index.d.ts +81 -0
- package/dist/router/match-middleware/index.d.ts.map +1 -0
- package/dist/router/match-middleware/index.js +80 -0
- package/dist/router/match-middleware/index.js.map +1 -0
- package/dist/router/match-middleware/intercept-resolution.d.ts +117 -0
- package/dist/router/match-middleware/intercept-resolution.d.ts.map +1 -0
- package/dist/router/match-middleware/intercept-resolution.js +134 -0
- package/dist/router/match-middleware/intercept-resolution.js.map +1 -0
- package/dist/router/match-middleware/segment-resolution.d.ts +99 -0
- package/dist/router/match-middleware/segment-resolution.d.ts.map +1 -0
- package/dist/router/match-middleware/segment-resolution.js +53 -0
- package/dist/router/match-middleware/segment-resolution.js.map +1 -0
- package/dist/router/match-pipelines.d.ts +147 -0
- package/dist/router/match-pipelines.d.ts.map +1 -0
- package/dist/router/match-pipelines.js +82 -0
- package/dist/router/match-pipelines.js.map +1 -0
- package/dist/router/match-result.d.ts +126 -0
- package/dist/router/match-result.d.ts.map +1 -0
- package/dist/router/match-result.js +93 -0
- package/dist/router/match-result.js.map +1 -0
- package/dist/router/metrics.d.ts +20 -0
- package/dist/router/metrics.d.ts.map +1 -0
- package/dist/router/metrics.js +47 -0
- package/dist/router/metrics.js.map +1 -0
- package/dist/router/middleware.d.ts +249 -0
- package/dist/router/middleware.d.ts.map +1 -0
- package/dist/router/middleware.js +434 -0
- package/dist/router/middleware.js.map +1 -0
- package/dist/router/middleware.test.d.ts +2 -0
- package/dist/router/middleware.test.d.ts.map +1 -0
- package/dist/router/middleware.test.js +816 -0
- package/dist/router/middleware.test.js.map +1 -0
- package/dist/router/pattern-matching.d.ts +149 -0
- package/dist/router/pattern-matching.d.ts.map +1 -0
- package/dist/router/pattern-matching.js +349 -0
- package/dist/router/pattern-matching.js.map +1 -0
- package/dist/router/revalidation.d.ts +44 -0
- package/dist/router/revalidation.d.ts.map +1 -0
- package/dist/router/revalidation.js +147 -0
- package/dist/router/revalidation.js.map +1 -0
- package/dist/router/router-context.d.ts +135 -0
- package/dist/router/router-context.d.ts.map +1 -0
- package/dist/router/router-context.js +36 -0
- package/dist/router/router-context.js.map +1 -0
- package/dist/router/segment-resolution.d.ts +127 -0
- package/dist/router/segment-resolution.d.ts.map +1 -0
- package/dist/router/segment-resolution.js +919 -0
- package/dist/router/segment-resolution.js.map +1 -0
- package/dist/router/trie-matching.d.ts +40 -0
- package/dist/router/trie-matching.d.ts.map +1 -0
- package/dist/router/trie-matching.js +127 -0
- package/dist/router/trie-matching.js.map +1 -0
- package/dist/router/types.d.ts +136 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/router/types.js +7 -0
- package/dist/router/types.js.map +1 -0
- package/dist/router.d.ts +753 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.gen.d.ts +6 -0
- package/dist/router.gen.d.ts.map +1 -0
- package/dist/router.gen.js +6 -0
- package/dist/router.gen.js.map +1 -0
- package/dist/router.js +1304 -0
- package/dist/router.js.map +1 -0
- package/dist/rsc/__tests__/helpers.test.d.ts +2 -0
- package/dist/rsc/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/rsc/__tests__/helpers.test.js +140 -0
- package/dist/rsc/__tests__/helpers.test.js.map +1 -0
- package/dist/rsc/handler.d.ts +45 -0
- package/dist/rsc/handler.d.ts.map +1 -0
- package/dist/rsc/handler.js +1172 -0
- package/dist/rsc/handler.js.map +1 -0
- package/dist/rsc/helpers.d.ts +16 -0
- package/dist/rsc/helpers.d.ts.map +1 -0
- package/dist/rsc/helpers.js +55 -0
- package/dist/rsc/helpers.js.map +1 -0
- package/dist/rsc/index.d.ts +22 -0
- package/dist/rsc/index.d.ts.map +1 -0
- package/dist/rsc/index.js +23 -0
- package/dist/rsc/index.js.map +1 -0
- package/dist/rsc/nonce.d.ts +9 -0
- package/dist/rsc/nonce.d.ts.map +1 -0
- package/dist/rsc/nonce.js +18 -0
- package/dist/rsc/nonce.js.map +1 -0
- package/dist/rsc/types.d.ts +206 -0
- package/dist/rsc/types.d.ts.map +1 -0
- package/dist/rsc/types.js +8 -0
- package/dist/rsc/types.js.map +1 -0
- package/dist/search-params.d.ts +103 -0
- package/dist/search-params.d.ts.map +1 -0
- package/dist/search-params.js +74 -0
- package/dist/search-params.js.map +1 -0
- package/dist/segment-system.d.ts +75 -0
- package/dist/segment-system.d.ts.map +1 -0
- package/dist/segment-system.js +336 -0
- package/dist/segment-system.js.map +1 -0
- package/dist/server/context.d.ts +245 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +197 -0
- package/dist/server/context.js.map +1 -0
- package/dist/server/fetchable-loader-store.d.ts +18 -0
- package/dist/server/fetchable-loader-store.d.ts.map +1 -0
- package/dist/server/fetchable-loader-store.js +18 -0
- package/dist/server/fetchable-loader-store.js.map +1 -0
- package/dist/server/handle-store.d.ts +85 -0
- package/dist/server/handle-store.d.ts.map +1 -0
- package/dist/server/handle-store.js +142 -0
- package/dist/server/handle-store.js.map +1 -0
- package/dist/server/loader-registry.d.ts +55 -0
- package/dist/server/loader-registry.d.ts.map +1 -0
- package/dist/server/loader-registry.js +132 -0
- package/dist/server/loader-registry.js.map +1 -0
- package/dist/server/request-context.d.ts +226 -0
- package/dist/server/request-context.d.ts.map +1 -0
- package/dist/server/request-context.js +290 -0
- package/dist/server/request-context.js.map +1 -0
- package/dist/server/root-layout.d.ts +4 -0
- package/dist/server/root-layout.d.ts.map +1 -0
- package/dist/server/root-layout.js +5 -0
- package/dist/server/root-layout.js.map +1 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +20 -0
- package/dist/server.js.map +1 -0
- package/dist/ssr/__tests__/ssr-handler.test.d.ts +2 -0
- package/dist/ssr/__tests__/ssr-handler.test.d.ts.map +1 -0
- package/dist/ssr/__tests__/ssr-handler.test.js +132 -0
- package/dist/ssr/__tests__/ssr-handler.test.js.map +1 -0
- package/dist/ssr/index.d.ts +98 -0
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/index.js +158 -0
- package/dist/ssr/index.js.map +1 -0
- package/dist/static-handler.d.ts +50 -0
- package/dist/static-handler.d.ts.map +1 -0
- package/dist/static-handler.gen.d.ts +5 -0
- package/dist/static-handler.gen.d.ts.map +1 -0
- package/dist/static-handler.gen.js +5 -0
- package/dist/static-handler.gen.js.map +1 -0
- package/dist/static-handler.js +29 -0
- package/dist/static-handler.js.map +1 -0
- package/dist/testing/vitest.js +48 -0
- package/dist/theme/ThemeProvider.d.ts +20 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +240 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/ThemeScript.d.ts +48 -0
- package/dist/theme/ThemeScript.d.ts.map +1 -0
- package/dist/theme/ThemeScript.js +13 -0
- package/dist/theme/ThemeScript.js.map +1 -0
- package/dist/theme/__tests__/theme.test.d.ts +2 -0
- package/dist/theme/__tests__/theme.test.d.ts.map +1 -0
- package/dist/theme/__tests__/theme.test.js +103 -0
- package/dist/theme/__tests__/theme.test.js.map +1 -0
- package/dist/theme/constants.d.ts +29 -0
- package/dist/theme/constants.d.ts.map +1 -0
- package/dist/theme/constants.js +48 -0
- package/dist/theme/constants.js.map +1 -0
- package/dist/theme/index.d.ts +31 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +36 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/theme-context.d.ts +40 -0
- package/dist/theme/theme-context.d.ts.map +1 -0
- package/dist/theme/theme-context.js +60 -0
- package/dist/theme/theme-context.js.map +1 -0
- package/dist/theme/theme-script.d.ts +27 -0
- package/dist/theme/theme-script.d.ts.map +1 -0
- package/dist/theme/theme-script.js +147 -0
- package/dist/theme/theme-script.js.map +1 -0
- package/dist/theme/types.d.ts +163 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +11 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/theme/use-theme.d.ts +12 -0
- package/dist/theme/use-theme.d.ts.map +1 -0
- package/dist/theme/use-theme.js +40 -0
- package/dist/theme/use-theme.js.map +1 -0
- package/dist/types.d.ts +1479 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/urls.d.ts +441 -0
- package/dist/urls.d.ts.map +1 -0
- package/dist/urls.gen.d.ts +8 -0
- package/dist/urls.gen.d.ts.map +1 -0
- package/dist/urls.gen.js +8 -0
- package/dist/urls.gen.js.map +1 -0
- package/dist/urls.js +443 -0
- package/dist/urls.js.map +1 -0
- package/dist/use-loader.d.ts +127 -0
- package/dist/use-loader.d.ts.map +1 -0
- package/dist/use-loader.js +237 -0
- package/dist/use-loader.js.map +1 -0
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts +2 -0
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts.map +1 -0
- package/dist/vite/__tests__/ast-handler-extract.test.js +294 -0
- package/dist/vite/__tests__/ast-handler-extract.test.js.map +1 -0
- package/dist/vite/__tests__/expose-id-utils.test.d.ts +2 -0
- package/dist/vite/__tests__/expose-id-utils.test.d.ts.map +1 -0
- package/dist/vite/__tests__/expose-id-utils.test.js +224 -0
- package/dist/vite/__tests__/expose-id-utils.test.js.map +1 -0
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts +2 -0
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts.map +1 -0
- package/dist/vite/__tests__/expose-internal-ids.test.js +647 -0
- package/dist/vite/__tests__/expose-internal-ids.test.js.map +1 -0
- package/dist/vite/__tests__/expose-router-id.test.d.ts +2 -0
- package/dist/vite/__tests__/expose-router-id.test.d.ts.map +1 -0
- package/dist/vite/__tests__/expose-router-id.test.js +39 -0
- package/dist/vite/__tests__/expose-router-id.test.js.map +1 -0
- package/dist/vite/ast-handler-extract.d.ts +49 -0
- package/dist/vite/ast-handler-extract.d.ts.map +1 -0
- package/dist/vite/ast-handler-extract.js +249 -0
- package/dist/vite/ast-handler-extract.js.map +1 -0
- package/dist/vite/expose-action-id.d.ts +19 -0
- package/dist/vite/expose-action-id.d.ts.map +1 -0
- package/dist/vite/expose-action-id.js +250 -0
- package/dist/vite/expose-action-id.js.map +1 -0
- package/dist/vite/expose-id-utils.d.ts +69 -0
- package/dist/vite/expose-id-utils.d.ts.map +1 -0
- package/dist/vite/expose-id-utils.js +289 -0
- package/dist/vite/expose-id-utils.js.map +1 -0
- package/dist/vite/expose-internal-ids.d.ts +22 -0
- package/dist/vite/expose-internal-ids.d.ts.map +1 -0
- package/dist/vite/expose-internal-ids.js +886 -0
- package/dist/vite/expose-internal-ids.js.map +1 -0
- package/dist/vite/index.d.ts +149 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +2659 -883
- package/dist/vite/index.js.bak +5448 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/index.named-routes.gen.ts +103 -0
- package/dist/vite/package-resolution.d.ts +43 -0
- package/dist/vite/package-resolution.d.ts.map +1 -0
- package/dist/vite/package-resolution.js +112 -0
- package/dist/vite/package-resolution.js.map +1 -0
- package/dist/vite/plugins/cloudflare-protocol-loader-hook.mjs +76 -0
- package/dist/vite/virtual-entries.d.ts +25 -0
- package/dist/vite/virtual-entries.d.ts.map +1 -0
- package/dist/vite/virtual-entries.js +110 -0
- package/dist/vite/virtual-entries.js.map +1 -0
- package/package.json +57 -11
- package/skills/breadcrumbs/SKILL.md +3 -1
- package/skills/bundle-analysis/SKILL.md +159 -0
- package/skills/cache-guide/SKILL.md +243 -21
- package/skills/caching/SKILL.md +118 -2
- 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 +249 -17
- package/skills/loader/SKILL.md +273 -53
- package/skills/middleware/SKILL.md +49 -12
- package/skills/migrate-nextjs/SKILL.md +562 -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 +123 -100
- package/skills/rango/SKILL.md +242 -22
- package/skills/react-compiler/SKILL.md +168 -0
- package/skills/response-routes/SKILL.md +66 -9
- package/skills/route/SKILL.md +88 -4
- package/skills/router-setup/SKILL.md +90 -5
- package/skills/server-actions/SKILL.md +751 -0
- package/skills/streams-and-websockets/SKILL.md +283 -0
- package/skills/testing/SKILL.md +776 -0
- package/skills/typesafety/SKILL.md +329 -27
- package/skills/use-cache/SKILL.md +34 -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/__internal.ts +1 -1
- package/src/browser/action-coordinator.ts +53 -36
- package/src/browser/app-shell.ts +52 -0
- package/src/browser/app-version.ts +14 -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 +101 -13
- package/src/browser/navigation-client.ts +125 -53
- package/src/browser/navigation-store.ts +75 -17
- package/src/browser/navigation-transaction.ts +10 -28
- package/src/browser/partial-update.ts +90 -30
- package/src/browser/prefetch/cache.ts +129 -21
- package/src/browser/prefetch/fetch.ts +156 -18
- package/src/browser/prefetch/queue.ts +92 -29
- package/src/browser/prefetch/resource-ready.ts +77 -0
- package/src/browser/rango-state.ts +53 -13
- package/src/browser/react/Link.tsx +72 -8
- package/src/browser/react/NavigationProvider.tsx +83 -33
- package/src/browser/react/context.ts +7 -2
- 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 +23 -64
- 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 +43 -10
- package/src/browser/react/use-segments.ts +11 -8
- package/src/browser/response-adapter.ts +25 -0
- package/src/browser/rsc-router.tsx +87 -22
- package/src/browser/scroll-restoration.ts +29 -19
- package/src/browser/segment-reconciler.ts +36 -14
- package/src/browser/segment-structure-assert.ts +2 -2
- package/src/browser/server-action-bridge.ts +31 -36
- package/src/browser/types.ts +48 -5
- package/src/build/collect-fallback-refs.ts +107 -0
- package/src/build/generate-manifest.ts +65 -40
- package/src/build/generate-route-types.ts +5 -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 +9 -2
- package/src/build/route-types/per-module-writer.ts +7 -4
- package/src/build/route-types/router-processing.ts +266 -86
- package/src/build/route-types/scan-filter.ts +9 -2
- package/src/build/route-types/source-scan.ts +118 -0
- package/src/build/runtime-discovery.ts +9 -20
- package/src/cache/cache-scope.ts +48 -61
- package/src/cache/cf/cf-cache-store.ts +54 -13
- package/src/cache/taint.ts +55 -0
- package/src/client.rsc.tsx +3 -0
- package/src/client.tsx +94 -238
- package/src/context-var.ts +72 -2
- package/src/decode-loader-results.ts +36 -0
- package/src/errors.ts +30 -1
- package/src/handle.ts +65 -12
- 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 +12 -5
- package/src/index.ts +61 -11
- package/src/loader-store.ts +500 -0
- package/src/loader.rsc.ts +21 -6
- package/src/loader.ts +3 -10
- package/src/missing-id-error.ts +68 -0
- package/src/outlet-context.ts +1 -1
- package/src/prerender/store.ts +5 -4
- package/src/prerender.ts +141 -80
- package/src/response-utils.ts +37 -0
- package/src/reverse.ts +65 -15
- package/src/route-content-wrapper.tsx +6 -28
- package/src/route-definition/dsl-helpers.ts +411 -261
- package/src/route-definition/helper-factories.ts +29 -139
- package/src/route-definition/helpers-types.ts +110 -34
- package/src/route-definition/index.ts +3 -0
- package/src/route-definition/redirect.ts +9 -1
- package/src/route-definition/resolve-handler-use.ts +155 -0
- package/src/route-definition/use-item-types.ts +32 -0
- package/src/route-types.ts +37 -41
- package/src/router/basename.ts +14 -0
- package/src/router/content-negotiation.ts +113 -1
- package/src/router/error-handling.ts +1 -1
- package/src/router/handler-context.ts +77 -38
- package/src/router/intercept-resolution.ts +13 -22
- package/src/router/lazy-includes.ts +8 -8
- package/src/router/loader-resolution.ts +174 -22
- package/src/router/manifest.ts +22 -13
- package/src/router/match-api.ts +128 -192
- package/src/router/match-handlers.ts +63 -20
- package/src/router/match-middleware/cache-lookup.ts +70 -97
- package/src/router/match-middleware/cache-store.ts +3 -2
- package/src/router/match-middleware/segment-resolution.ts +53 -0
- package/src/router/match-result.ts +103 -4
- package/src/router/metrics.ts +1 -1
- package/src/router/middleware-types.ts +21 -34
- package/src/router/middleware.ts +101 -89
- package/src/router/navigation-snapshot.ts +182 -0
- package/src/router/pattern-matching.ts +101 -17
- package/src/router/prerender-match.ts +110 -10
- package/src/router/preview-match.ts +32 -102
- package/src/router/request-classification.ts +286 -0
- package/src/router/revalidation.ts +58 -2
- package/src/router/route-snapshot.ts +245 -0
- package/src/router/router-interfaces.ts +77 -28
- package/src/router/router-options.ts +76 -11
- package/src/router/router-registry.ts +2 -5
- package/src/router/segment-resolution/fresh.ts +105 -13
- package/src/router/segment-resolution/helpers.ts +29 -24
- package/src/router/segment-resolution/revalidation.ts +236 -112
- package/src/router/segment-resolution/view-transition-default.ts +36 -0
- package/src/router/substitute-pattern-params.ts +56 -0
- package/src/router/telemetry.ts +99 -0
- package/src/router/trie-matching.ts +18 -13
- package/src/router/types.ts +9 -0
- package/src/router/url-params.ts +49 -0
- package/src/router.ts +86 -22
- package/src/rsc/handler-context.ts +2 -2
- package/src/rsc/handler.ts +440 -381
- package/src/rsc/helpers.ts +91 -43
- package/src/rsc/index.ts +1 -1
- package/src/rsc/loader-fetch.ts +23 -3
- package/src/rsc/manifest-init.ts +5 -1
- package/src/rsc/origin-guard.ts +28 -10
- package/src/rsc/progressive-enhancement.ts +18 -2
- package/src/rsc/response-route-handler.ts +46 -53
- package/src/rsc/rsc-rendering.ts +41 -48
- package/src/rsc/runtime-warnings.ts +9 -10
- package/src/rsc/server-action.ts +25 -37
- package/src/rsc/ssr-setup.ts +18 -2
- package/src/rsc/types.ts +17 -3
- 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 +190 -51
- package/src/server/cookie-store.ts +28 -4
- package/src/server/handle-store.ts +19 -0
- package/src/server/loader-registry.ts +9 -8
- package/src/server/request-context.ts +195 -57
- package/src/ssr/index.tsx +8 -1
- package/src/static-handler.ts +19 -7
- package/src/testing/cache-status.ts +166 -0
- package/src/testing/collect-handle.ts +63 -0
- package/src/testing/dispatch.ts +440 -0
- package/src/testing/dom.entry.ts +22 -0
- package/src/testing/e2e/fixture.ts +154 -0
- package/src/testing/e2e/index.ts +149 -0
- package/src/testing/e2e/matchers.ts +51 -0
- package/src/testing/e2e/page-helpers.ts +272 -0
- package/src/testing/e2e/parity.ts +306 -0
- package/src/testing/e2e/server.ts +183 -0
- package/src/testing/flight-matchers.ts +104 -0
- package/src/testing/flight-runtime.d.ts +57 -0
- package/src/testing/flight-tree.ts +309 -0
- package/src/testing/flight.entry.ts +39 -0
- package/src/testing/flight.ts +197 -0
- package/src/testing/generated-routes.ts +223 -0
- package/src/testing/index.ts +106 -0
- package/src/testing/internal/context.ts +304 -0
- package/src/testing/internal/flight-client-globals.ts +30 -0
- package/src/testing/render-route.tsx +565 -0
- package/src/testing/run-loader.ts +341 -0
- package/src/testing/run-middleware.ts +179 -0
- package/src/testing/vitest-stubs/cloudflare-email.ts +9 -0
- package/src/testing/vitest-stubs/cloudflare-workers.ts +21 -0
- package/src/testing/vitest-stubs/plugin-rsc.ts +16 -0
- package/src/testing/vitest-stubs/version.ts +5 -0
- package/src/testing/vitest.ts +185 -0
- package/src/types/cache-types.ts +4 -4
- package/src/types/global-namespace.ts +39 -26
- package/src/types/handler-context.ts +103 -67
- package/src/types/index.ts +1 -0
- package/src/types/loader-types.ts +41 -15
- package/src/types/request-scope.ts +126 -0
- package/src/types/route-entry.ts +12 -1
- 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 +50 -9
- package/src/urls/path-helper.ts +63 -63
- package/src/urls/pattern-types.ts +48 -19
- package/src/urls/response-types.ts +25 -22
- package/src/urls/type-extraction.ts +26 -116
- package/src/urls/urls-function.ts +1 -5
- package/src/use-loader.tsx +487 -44
- package/src/vite/debug.ts +185 -0
- package/src/vite/discovery/bundle-postprocess.ts +34 -37
- package/src/vite/discovery/discover-routers.ts +105 -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 +188 -93
- 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 +46 -4
- package/src/vite/discovery/virtual-module-codegen.ts +13 -23
- package/src/vite/index.ts +6 -0
- package/src/vite/plugin-types.ts +126 -4
- 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 +12 -35
- 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 +544 -317
- package/src/vite/plugins/performance-tracks.ts +92 -0
- package/src/vite/plugins/refresh-cmd.ts +88 -26
- 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 +130 -26
- package/src/vite/router-discovery.ts +920 -129
- 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 +38 -5
- package/src/vite/utils/shared-utils.ts +109 -27
- package/src/browser/action-response-classifier.ts +0 -99
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rangojs/router",
|
|
3
|
-
"version": "0.0.0-experimental.
|
|
3
|
+
"version": "0.0.0-experimental.df410dd5",
|
|
4
4
|
"description": "Django-inspired RSC router with composable URL patterns",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -126,6 +126,31 @@
|
|
|
126
126
|
"./host/testing": {
|
|
127
127
|
"types": "./src/host/testing.ts",
|
|
128
128
|
"default": "./src/host/testing.ts"
|
|
129
|
+
},
|
|
130
|
+
"./testing": {
|
|
131
|
+
"types": "./src/testing/index.ts",
|
|
132
|
+
"default": "./src/testing/index.ts"
|
|
133
|
+
},
|
|
134
|
+
"./testing/vitest": {
|
|
135
|
+
"types": "./src/testing/vitest.ts",
|
|
136
|
+
"default": "./dist/testing/vitest.js"
|
|
137
|
+
},
|
|
138
|
+
"./testing/dom": {
|
|
139
|
+
"types": "./src/testing/dom.entry.ts",
|
|
140
|
+
"default": "./src/testing/dom.entry.ts"
|
|
141
|
+
},
|
|
142
|
+
"./testing/e2e": {
|
|
143
|
+
"types": "./src/testing/e2e/index.ts",
|
|
144
|
+
"default": "./src/testing/e2e/index.ts"
|
|
145
|
+
},
|
|
146
|
+
"./testing/flight": {
|
|
147
|
+
"types": "./src/testing/flight.entry.ts",
|
|
148
|
+
"react-server": "./src/testing/flight.entry.ts",
|
|
149
|
+
"default": "./src/testing/flight.entry.ts"
|
|
150
|
+
},
|
|
151
|
+
"./testing/flight-matchers": {
|
|
152
|
+
"types": "./src/testing/flight-matchers.ts",
|
|
153
|
+
"default": "./src/testing/flight-matchers.ts"
|
|
129
154
|
}
|
|
130
155
|
},
|
|
131
156
|
"publishConfig": {
|
|
@@ -133,45 +158,66 @@
|
|
|
133
158
|
"tag": "experimental"
|
|
134
159
|
},
|
|
135
160
|
"scripts": {
|
|
136
|
-
"build": "pnpm dlx esbuild src/vite/index.ts --bundle --format=esm --outfile=dist/vite/index.js --platform=node --packages=external && pnpm dlx esbuild src/bin/rango.ts --bundle --format=esm --outfile=dist/bin/rango.js --platform=node --packages=external --banner:js='#!/usr/bin/env node' && chmod +x dist/bin/rango.js",
|
|
161
|
+
"build": "pnpm dlx esbuild src/vite/index.ts --bundle --format=esm --outfile=dist/vite/index.js --platform=node --packages=external && mkdir -p dist/vite/plugins && cp src/vite/plugins/cloudflare-protocol-loader-hook.mjs dist/vite/plugins/cloudflare-protocol-loader-hook.mjs && pnpm dlx esbuild src/testing/vitest.ts --bundle --format=esm --outfile=dist/testing/vitest.js --platform=node --packages=external && pnpm dlx esbuild src/bin/rango.ts --bundle --format=esm --outfile=dist/bin/rango.js --platform=node --packages=external --banner:js='#!/usr/bin/env node' && chmod +x dist/bin/rango.js",
|
|
137
162
|
"prepublishOnly": "pnpm build",
|
|
138
|
-
"typecheck": "tsc --noEmit",
|
|
163
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.strict-check.json --noEmit && tsc -p tsconfig.augment-check.json --noEmit",
|
|
139
164
|
"test": "playwright test",
|
|
140
165
|
"test:ui": "playwright test --ui",
|
|
166
|
+
"test:hmr-local": "playwright test --project=dev-warmup --project=hmr-routes --project=hmr-basename --project=hmr-prerender --no-deps --workers=1",
|
|
141
167
|
"test:unit": "vitest run",
|
|
142
|
-
"test:unit:watch": "vitest"
|
|
168
|
+
"test:unit:watch": "vitest",
|
|
169
|
+
"test:unit:rsc": "vitest run --config vitest.rsc.config.ts"
|
|
143
170
|
},
|
|
144
171
|
"dependencies": {
|
|
145
|
-
"@
|
|
172
|
+
"@types/debug": "^4.1.12",
|
|
173
|
+
"@vitejs/plugin-rsc": "^0.5.26",
|
|
174
|
+
"debug": "^4.4.1",
|
|
146
175
|
"magic-string": "^0.30.17",
|
|
147
176
|
"picomatch": "^4.0.3",
|
|
148
|
-
"rsc-html-stream": "^0.0.7"
|
|
177
|
+
"rsc-html-stream": "^0.0.7",
|
|
178
|
+
"tinyexec": "^0.3.2"
|
|
149
179
|
},
|
|
150
180
|
"devDependencies": {
|
|
151
181
|
"@playwright/test": "^1.49.1",
|
|
182
|
+
"@shared/e2e": "workspace:*",
|
|
183
|
+
"@testing-library/dom": "^10.4.1",
|
|
184
|
+
"@testing-library/react": "^16.3.2",
|
|
152
185
|
"@types/node": "^24.10.1",
|
|
153
186
|
"@types/react": "catalog:",
|
|
154
187
|
"@types/react-dom": "catalog:",
|
|
155
188
|
"esbuild": "^0.27.0",
|
|
189
|
+
"happy-dom": "^20.10.1",
|
|
156
190
|
"jiti": "^2.6.1",
|
|
157
191
|
"react": "catalog:",
|
|
158
192
|
"react-dom": "catalog:",
|
|
159
|
-
"tinyexec": "^0.3.2",
|
|
160
193
|
"typescript": "^5.3.0",
|
|
161
194
|
"vitest": "^4.0.0"
|
|
162
195
|
},
|
|
163
196
|
"peerDependencies": {
|
|
164
|
-
"@cloudflare/vite-plugin": "^1.
|
|
165
|
-
"@
|
|
166
|
-
"react": "
|
|
167
|
-
"
|
|
197
|
+
"@cloudflare/vite-plugin": "^1.38.0",
|
|
198
|
+
"@playwright/test": "^1.49.1",
|
|
199
|
+
"@testing-library/react": ">=16",
|
|
200
|
+
"@vitejs/plugin-rsc": "^0.5.26",
|
|
201
|
+
"react": ">=19.2.6 <20",
|
|
202
|
+
"react-dom": ">=19.2.6 <20",
|
|
203
|
+
"vite": "^8.0.0",
|
|
204
|
+
"vitest": ">=3"
|
|
168
205
|
},
|
|
169
206
|
"peerDependenciesMeta": {
|
|
170
207
|
"@cloudflare/vite-plugin": {
|
|
171
208
|
"optional": true
|
|
172
209
|
},
|
|
210
|
+
"@playwright/test": {
|
|
211
|
+
"optional": true
|
|
212
|
+
},
|
|
213
|
+
"@testing-library/react": {
|
|
214
|
+
"optional": true
|
|
215
|
+
},
|
|
173
216
|
"vite": {
|
|
174
217
|
"optional": true
|
|
218
|
+
},
|
|
219
|
+
"vitest": {
|
|
220
|
+
"optional": true
|
|
175
221
|
}
|
|
176
222
|
}
|
|
177
223
|
}
|
|
@@ -141,9 +141,11 @@ path("/dashboard", (ctx) => {
|
|
|
141
141
|
breadcrumb({ label: "Dashboard", href: "/dashboard" });
|
|
142
142
|
return <DashboardNav handle={Breadcrumbs} />;
|
|
143
143
|
});
|
|
144
|
+
```
|
|
144
145
|
|
|
146
|
+
```tsx
|
|
145
147
|
// Client component
|
|
146
|
-
|
|
148
|
+
"use client";
|
|
147
149
|
import { useHandle, type Breadcrumbs } from "@rangojs/router/client";
|
|
148
150
|
|
|
149
151
|
function DashboardNav({ handle }: { handle: typeof Breadcrumbs }) {
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bundle-analysis
|
|
3
|
+
description: Audit a Rango app's production bundle for server-side code leaking into the client, dev/prod React duplication, oversized chunks, and inefficient client-reference grouping. Use when investigating bundle size growth, before a production deploy, or when the client/SSR/RSC output suddenly balloons.
|
|
4
|
+
argument-hint: "<app-dir>"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Bundle Analysis
|
|
8
|
+
|
|
9
|
+
Use this when you want **proof** that your Rango app is shipping the bundles you expect: small client, no server leaks, no doubled React, reasonable RSC worker size.
|
|
10
|
+
|
|
11
|
+
## What this checks
|
|
12
|
+
|
|
13
|
+
Your app builds in three Vite environments — `client`, `ssr`, and `rsc` — and each ships its own bundle. The most common bundle bugs in a Rango app are:
|
|
14
|
+
|
|
15
|
+
1. **Server code leaking into the client.** A file that imports `node:fs`, calls a database, or contains action logic ends up in the client bundle because a client component pulled it in transitively. Symptom: your client bundle is much larger than expected, sometimes with imports that fail at runtime.
|
|
16
|
+
2. **Both dev and prod React in the SSR/RSC bundle.** When `process.env.NODE_ENV` isn't folded at build time, React's CJS files ship both `.development.js` _and_ `.production.js` variants — doubling React's footprint. The Cloudflare vite plugin folds NODE_ENV automatically; vanilla `vite build` does it for client but not always for SSR/RSC.
|
|
17
|
+
3. **An oversized routes-manifest in your RSC worker.** The `virtual:rsc-router/routes-manifest/<routerId>` chunk holds your route trie and precomputed entries — large only in proportion to your route count. If it's surprisingly big, you may have unintentionally generated routes (e.g., parametrized fixtures) that bloated the trie.
|
|
18
|
+
4. **Inefficient client-reference grouping.** Each `"use client"` boundary becomes a chunk. Too many small client components = many tiny chunks; one giant client component = one giant chunk that defeats code-splitting.
|
|
19
|
+
|
|
20
|
+
Tree-shaking does _not_ catch (1) generated data inlined as string literals or (2) data-dependent conditionals like React's. You need a visualizer.
|
|
21
|
+
|
|
22
|
+
## Step 1: Install the visualizer
|
|
23
|
+
|
|
24
|
+
In your app's directory:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm add -D rollup-plugin-visualizer
|
|
28
|
+
# or: npm install --save-dev rollup-plugin-visualizer
|
|
29
|
+
# or: yarn add -D rollup-plugin-visualizer
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Step 2: Wire it into your `vite.config.ts`
|
|
33
|
+
|
|
34
|
+
Add a small helper that registers one visualizer instance **per Vite environment** (not just one global). The plugin caches its options after the first call, so a single instance can't handle multi-environment builds — you'll get a report for one environment and silence for the others.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// vite.config.ts
|
|
38
|
+
import { defineConfig, type PluginOption, type Plugin } from "vite";
|
|
39
|
+
import { visualizer } from "rollup-plugin-visualizer";
|
|
40
|
+
import { join } from "node:path";
|
|
41
|
+
// ... your other imports ...
|
|
42
|
+
|
|
43
|
+
function analyze(): PluginOption[] {
|
|
44
|
+
if (!process.env.ANALYZE) return [];
|
|
45
|
+
return (["client", "ssr", "rsc"] as const).map((envName) => {
|
|
46
|
+
const inner = visualizer({
|
|
47
|
+
filename: join("bundle-stats", `${envName}.html`),
|
|
48
|
+
template: "treemap",
|
|
49
|
+
gzipSize: true,
|
|
50
|
+
brotliSize: true,
|
|
51
|
+
}) as Plugin;
|
|
52
|
+
return {
|
|
53
|
+
...inner,
|
|
54
|
+
name: `analyze-${envName}`,
|
|
55
|
+
applyToEnvironment(env) {
|
|
56
|
+
return env.name === envName;
|
|
57
|
+
},
|
|
58
|
+
} as Plugin;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default defineConfig(({ command }) => ({
|
|
63
|
+
plugins: [
|
|
64
|
+
// your existing plugins...
|
|
65
|
+
...analyze(),
|
|
66
|
+
],
|
|
67
|
+
// For non-Cloudflare apps, fold NODE_ENV explicitly so React's CJS files
|
|
68
|
+
// emit only the .production.js variants in SSR/RSC. Skip if your build
|
|
69
|
+
// setup already does this (the Cloudflare vite plugin does).
|
|
70
|
+
define:
|
|
71
|
+
command === "build"
|
|
72
|
+
? { "process.env.NODE_ENV": JSON.stringify("production") }
|
|
73
|
+
: undefined,
|
|
74
|
+
}));
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Add `bundle-stats/` to your `.gitignore`.
|
|
78
|
+
|
|
79
|
+
## Step 3: Build with the analyzer enabled
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
ANALYZE=1 pnpm exec vite build
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
You'll get three HTML reports in `bundle-stats/`:
|
|
86
|
+
|
|
87
|
+
- `bundle-stats/client.html` — what runs in the browser
|
|
88
|
+
- `bundle-stats/ssr.html` — what runs during HTML stream
|
|
89
|
+
- `bundle-stats/rsc.html` — what runs in your RSC server (Worker / Node)
|
|
90
|
+
|
|
91
|
+
Open them with a quick local server (file:// has CORS issues with the embedded scripts):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pnpm dlx serve -l 5050 .
|
|
95
|
+
# then visit http://localhost:5050/bundle-stats/client.html
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Step 4: Triage the reports
|
|
99
|
+
|
|
100
|
+
### Open `client.html` first
|
|
101
|
+
|
|
102
|
+
The treemap shows nested boxes; box area = uncompressed size. Hover for gzip/brotli numbers.
|
|
103
|
+
|
|
104
|
+
**Look for:**
|
|
105
|
+
|
|
106
|
+
- **Your server code.** Any of your own files that contain database queries, secret keys, server actions implementation (not the action _reference_), or `node:` imports. If they appear in the client treemap with non-zero bytes, they leaked. Common causes:
|
|
107
|
+
- A shared module that mixes client and server code without a `"use client"` or `"use server"` directive.
|
|
108
|
+
- A barrel file (`index.ts`) that re-exports both client and server symbols. Tree-shaking should help, but `JSON.parse('{...}')` data and side-effecting top-level statements survive.
|
|
109
|
+
- Client component imports a server-only utility through an indirect path (e.g., shared types file that pulls server modules).
|
|
110
|
+
- **Multiple copies of the same package.** Look for two boxes with the same package name but different version paths. Usually means a transitive dep pinned a different version.
|
|
111
|
+
- **The `@rangojs/router` chunk** should be roughly **50 KB gzip** (74 files). If significantly larger, you might be importing client-incompatible APIs from the wrong subpath.
|
|
112
|
+
- **Per-route client-reference chunks** (named like `chunk-<hash>.js`). Each `"use client"` boundary can become its own chunk. If you have hundreds of tiny chunks, you may have over-split (every leaf component as a client component); if you have one massive 200 KB chunk, you've under-split (a wide client tree behind one boundary).
|
|
113
|
+
|
|
114
|
+
### Now check `ssr.html`
|
|
115
|
+
|
|
116
|
+
**Look for:**
|
|
117
|
+
|
|
118
|
+
- **`react-dom-server.edge.development-*.js`** (or any `*.development*.js` chunk). This is the dev/prod React doubling. Fix: add `define: { "process.env.NODE_ENV": '"production"' }` to your vite config (see Step 2).
|
|
119
|
+
- **Your client components** appearing in SSR. They're _expected_ here — SSR hydration needs to produce HTML for them. The same components show up in `client.html` too because the browser hydrates them. This is not a leak.
|
|
120
|
+
- **Total SSR size**: a reasonable Rango SSR is ~140 KB gzip plus your app code. If it's >300 KB, almost always (1) dev/prod React duplication or (2) a giant data structure being inlined.
|
|
121
|
+
|
|
122
|
+
### Now check `rsc.html`
|
|
123
|
+
|
|
124
|
+
**Look for:**
|
|
125
|
+
|
|
126
|
+
- **`virtual:rsc-router/routes-manifest`** should be **tiny** (< 1 KB). If it's > 100 KB, you're on an old version of `@rangojs/router` that inlined the trie eagerly — upgrade to a release that includes commit `d10a2470`.
|
|
127
|
+
- **`virtual:rsc-router/routes-manifest/<hash>`** is the lazy per-router chunk. Its size is proportional to your route count. For a typical app: 5–50 KB gzip. For a stress-test app with thousands of routes: hundreds of KB. If yours is unexpectedly huge, check whether you're generating routes you don't need.
|
|
128
|
+
- **`<your-router>.named-routes.gen.ts`** — generated route map. Should match your route count.
|
|
129
|
+
- **Your action and loader implementations** — these run server-side. Expected to be here, not in client.
|
|
130
|
+
- **Worker-incompatible code** (Node-only imports like `node:fs` that Cloudflare doesn't support). The build will usually fail before the analyzer runs, but if you're seeing runtime errors at the edge, the RSC treemap shows what made it in.
|
|
131
|
+
|
|
132
|
+
## Step 5: Fix what you find
|
|
133
|
+
|
|
134
|
+
| Finding | Fix |
|
|
135
|
+
| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
136
|
+
| Your server code in `client.html` (non-zero bytes) | Audit the import chain. Add `"use server"` to server-only files. Move shared data out of barrel files. Use the `@rangojs/router/server` subpath for explicitly server APIs. |
|
|
137
|
+
| Your server code in `client.html` listed but 0 bytes | Tree-shaking already eliminated it. Cosmetic. Leave it. |
|
|
138
|
+
| `react-dom-server.edge.development-*.js` in SSR or RSC | Add the `define` block from Step 2 to your vite config. |
|
|
139
|
+
| Routes-manifest > 100 KB gzip in RSC eager chunk | Update `@rangojs/router` to a release that includes the lazy-only manifest fix. |
|
|
140
|
+
| Same package version present twice | Run `pnpm dedupe` (or `npm dedupe`). If the duplication persists, a transitive dep pins an incompatible version — open a PR upstream or pin the resolution. |
|
|
141
|
+
| Client chunk > 500 KB gzip with a single dominant module | That module is your largest client component. Consider lazy-loading via dynamic `import()` or moving non-interactive parts to server components. |
|
|
142
|
+
| Hundreds of tiny client chunks | You've sprinkled `"use client"` too liberally. Hoist directives to higher boundaries so React groups them. |
|
|
143
|
+
|
|
144
|
+
## When to re-run
|
|
145
|
+
|
|
146
|
+
- Before every production deploy, especially after adding new dependencies.
|
|
147
|
+
- After upgrading `@rangojs/router`, React, or `@vitejs/plugin-rsc`.
|
|
148
|
+
- After adding routes that scale with data (e.g., one route per item from a content directory) — the manifest may have grown.
|
|
149
|
+
- When CI starts reporting larger artifact sizes.
|
|
150
|
+
|
|
151
|
+
## Reporting Rango regressions
|
|
152
|
+
|
|
153
|
+
If a finding looks like a `@rangojs/router` regression (the framework is shipping more than it should, not your app), open an issue at the [@rangojs/router GitHub](https://github.com/ivogt/vite-rsc/issues) and include:
|
|
154
|
+
|
|
155
|
+
- The output of `client.html` / `rsc.html` (screenshots or the JSON `data = {...}` block from the HTML).
|
|
156
|
+
- The `@rangojs/router` version (`pnpm why @rangojs/router`).
|
|
157
|
+
- Your `vite.config.ts`.
|
|
158
|
+
|
|
159
|
+
The framework maintainers run a similar audit internally — the methodology in this skill mirrors what they use to validate every release.
|
|
@@ -6,8 +6,138 @@ argument-hint:
|
|
|
6
6
|
|
|
7
7
|
# cache() vs "use cache" — When to Use Which
|
|
8
8
|
|
|
9
|
-
Both mechanisms share the same backing store
|
|
10
|
-
|
|
9
|
+
Both mechanisms share the same backing store and cache profiles, and both accept
|
|
10
|
+
an optional `tags` field (not yet honored by the built-in stores — see "Two axes"
|
|
11
|
+
below). They differ in scope, cache key, execution model, and runtime control.
|
|
12
|
+
|
|
13
|
+
## Two axes — do not conflate
|
|
14
|
+
|
|
15
|
+
Everything on this page is **axis 1: stored-value freshness** — _is a cached
|
|
16
|
+
value still good?_ There is a second, orthogonal axis it is easy to mistake for
|
|
17
|
+
caching:
|
|
18
|
+
|
|
19
|
+
1. **Stored-value freshness** — _is a cached value still good?_
|
|
20
|
+
→ `"use cache"` (fn/component), `cache()` (segment), loader `cache()` (loader data).
|
|
21
|
+
Entries expire by **TTL/SWR**. They accept an optional `tags` field, but the
|
|
22
|
+
built-in stores (`MemorySegmentCacheStore`, `CFCacheStore`) do not yet index or
|
|
23
|
+
invalidate by tag, so tag-based invalidation (`revalidateTag`) is a
|
|
24
|
+
forward-looking API requiring a custom store with secondary indices.
|
|
25
|
+
2. **Client-update selection** — _should this segment re-run and stream to the
|
|
26
|
+
client on this navigation/action?_
|
|
27
|
+
→ `revalidate()`. Covered in `/loader` and `/route`, **not here**.
|
|
28
|
+
|
|
29
|
+
They are orthogonal and compose: a segment selected by `revalidate()` still
|
|
30
|
+
consults its cache (hit → no recompute); a cache bust does **not** force a client
|
|
31
|
+
update, and `revalidate()` never reads, writes, or expires a cached value. If you
|
|
32
|
+
know React Router, `revalidate()` is `shouldRevalidate`, not `Cache-Control`. See
|
|
33
|
+
`/rango` → "Coming from another framework" for the cross-framework mapping.
|
|
34
|
+
|
|
35
|
+
## Fast choice
|
|
36
|
+
|
|
37
|
+
Read this first; use the rest of the page when the choice has edge cases.
|
|
38
|
+
|
|
39
|
+
1. Do you want to cache an entire route or group of routes?
|
|
40
|
+
**Yes** -> `cache()`
|
|
41
|
+
2. Do you need runtime conditions, such as skip for authed users or key by
|
|
42
|
+
locale?
|
|
43
|
+
**Yes** -> `cache()` with `condition` / `key`
|
|
44
|
+
3. Do you want to cache a data fetch or helper shared across routes?
|
|
45
|
+
**Yes** -> `"use cache"`
|
|
46
|
+
4. Do you need different cache entries for different function arguments?
|
|
47
|
+
**Yes** -> `"use cache"` (keyed by args)
|
|
48
|
+
5. Is the expensive part rendering a subtree?
|
|
49
|
+
**Yes** -> `cache()` (caches rendered segments)
|
|
50
|
+
6. Is the expensive part one query inside a larger live handler?
|
|
51
|
+
**Yes** -> `"use cache"` on the query function
|
|
52
|
+
|
|
53
|
+
## Correctness & invalidation
|
|
54
|
+
|
|
55
|
+
rango's caches are built so a hit can't serve wrong or stale-shaped data. These
|
|
56
|
+
guarantees are mostly automatic — worth knowing so you don't reimplement
|
|
57
|
+
protection the framework already gives you (or assume one it deliberately
|
|
58
|
+
doesn't).
|
|
59
|
+
|
|
60
|
+
There are two guard models to keep separate. Both block response side effects
|
|
61
|
+
(`ctx.header()`, cookie writes) that would be lost on a hit; they differ in what
|
|
62
|
+
else they allow:
|
|
63
|
+
|
|
64
|
+
- **`cache()` boundary guard** (route-level) — fires while the handler runs on a
|
|
65
|
+
miss. `cookies()` and `headers()` throw (request-scoped data would be baked into
|
|
66
|
+
the shared cached shell), `ctx.get(nonCacheableVar)` throws (a tainted value
|
|
67
|
+
would be baked in), and response side effects (`ctx.header()`, `ctx.setCookie()`,
|
|
68
|
+
`ctx.setStatus()`, `ctx.onResponse()`) throw. `ctx.set()` of a cacheable var is
|
|
69
|
+
**allowed** — children are cached too and can read it. **Loaders are exempt**
|
|
70
|
+
(they always run fresh) — read request data inside a loader.
|
|
71
|
+
- **`"use cache"` exec-guard** (function-level) — the same request-scoped APIs
|
|
72
|
+
throw inside the cached function (`cookies()`, `headers()`, `ctx.set()`,
|
|
73
|
+
`ctx.header()`); additionally, tainted `ctx`/`env`/`req` args are excluded from
|
|
74
|
+
the cache key.
|
|
75
|
+
|
|
76
|
+
### Cross-deploy safety: version-segmented store keys
|
|
77
|
+
|
|
78
|
+
`CFCacheStore` prefixes every **physical** store key (the CF Cache API URL and
|
|
79
|
+
the KV key) with the build version — auto-generated from the
|
|
80
|
+
`@rangojs/router:version` virtual module, overridable via the store's `version`
|
|
81
|
+
option. A new deploy reads under a new prefix, so it can **never** read a
|
|
82
|
+
previous build's entries: no cross-deploy shape drift, and no dead client-chunk
|
|
83
|
+
references baked into cached RSC.
|
|
84
|
+
|
|
85
|
+
The tradeoff to know: **loader/data caches use the same store**, so they're
|
|
86
|
+
version-segmented too. Every deploy is therefore a _cold data cache_ — SWR can't
|
|
87
|
+
soften it, because no stale entry exists under the new key. For high-traffic,
|
|
88
|
+
frequently-deploying, data-bound apps that's a deploy-time origin warm-up. Decide
|
|
89
|
+
deliberately: accept it (correctness over hit-rate), or split the policy — let
|
|
90
|
+
the render/edge cache auto-version while a separate data store gets a stable
|
|
91
|
+
`version` so its entries survive deploys. (Per-process stores like
|
|
92
|
+
`MemorySegmentCacheStore` are cold on every restart anyway; this matters for
|
|
93
|
+
persistent stores.) See `/caching` for store setup.
|
|
94
|
+
|
|
95
|
+
### Client cache: forward/back is mutation-aware
|
|
96
|
+
|
|
97
|
+
The browser keeps a history (forward/back) cache of rendered segments. Any
|
|
98
|
+
client-side mutation (a server action) marks those entries **stale** and
|
|
99
|
+
broadcasts it to other tabs. On back/forward (popstate) the router looks up the
|
|
100
|
+
entry, sees it's stale, and revalidates — so your `revalidate()` predicates re-run
|
|
101
|
+
and the segment refreshes (SWR: the stale view paints instantly, fresh data
|
|
102
|
+
streams in). It's the client-side analog of the server-cache correctness problem,
|
|
103
|
+
solved on the partial-render axis.
|
|
104
|
+
|
|
105
|
+
### Request-scoped data: the `cache: false` taint
|
|
106
|
+
|
|
107
|
+
`createVar({ cache: false })` (or a `ctx.set(var, v, { cache: false })` write)
|
|
108
|
+
taints a value as request-scoped; reading it **directly** with `ctx.get()` inside
|
|
109
|
+
a `cache()` boundary throws — the guard against the catastrophic "serve user A's
|
|
110
|
+
data to user B" bug. The guarantee is precise and intentionally narrow — see
|
|
111
|
+
"Context Variable Cache Safety" below for exactly what it does and does not catch.
|
|
112
|
+
|
|
113
|
+
## Stale-while-revalidate
|
|
114
|
+
|
|
115
|
+
SWR is a first-class cache behavior when the backing store supports it: while an
|
|
116
|
+
entry is within its SWR window the cache serves the **stale value instantly** and
|
|
117
|
+
refreshes it in the **background** (`waitUntil`), so users never wait on a
|
|
118
|
+
recompute for a merely-aging entry.
|
|
119
|
+
|
|
120
|
+
- **`"use cache"`** resolves to the `default` profile `{ ttl: 900, swr: 1800 }`,
|
|
121
|
+
so function/component caching gets a 30-minute SWR window **out of the box**.
|
|
122
|
+
Tune or add profiles via `createRouter({ cacheProfiles: { … } })`
|
|
123
|
+
(`"use cache: short"` → the `short` profile).
|
|
124
|
+
- **`cache()` DSL and loader caches** take an explicit `swr` in seconds (or
|
|
125
|
+
inherit `store.defaults.swr`): `cache({ ttl: 60, swr: 300 })` → fresh ≤60s,
|
|
126
|
+
stale-served 60–360s, miss after 360s in stores that implement SWR for that
|
|
127
|
+
layer.
|
|
128
|
+
- **Client forward/back** is SWR after a mutation — see "Correctness &
|
|
129
|
+
invalidation" → Client cache.
|
|
130
|
+
- **Edge / document layer** uses the HTTP `stale-while-revalidate` directive; see
|
|
131
|
+
`/document-cache`.
|
|
132
|
+
|
|
133
|
+
SWR softens normal TTL expiry, **not** a cross-deploy cold cache — a new build
|
|
134
|
+
has no stale entry to serve (see version-segmented store keys above).
|
|
135
|
+
|
|
136
|
+
Store support is layer-specific. `CFCacheStore` supports SWR for segment,
|
|
137
|
+
document/response, and `"use cache"` item entries. `MemorySegmentCacheStore`
|
|
138
|
+
supports SWR for response and `"use cache"` item entries, but its route-segment
|
|
139
|
+
entries expire at TTL and never background-revalidate. Use the memory store for
|
|
140
|
+
local/dev behavior, not as proof that segment SWR is active.
|
|
11
141
|
|
|
12
142
|
## Key Differences
|
|
13
143
|
|
|
@@ -18,7 +148,7 @@ invalidation. They differ in scope, cache key, execution model, and runtime cont
|
|
|
18
148
|
| **Cache key** | Request type + pathname + params (+ optional custom) | Function identity + serialized non-tainted args |
|
|
19
149
|
| **Execution on hit** | All-or-nothing: entire handler skipped | Partial: function body skipped, calling code runs |
|
|
20
150
|
| **Runtime control** | `condition` to disable, custom `key` function | None — if the directive is present, it caches |
|
|
21
|
-
| **Side effects** |
|
|
151
|
+
| **Side effects** | Response side effects throw inside the boundary | `ctx.header()`, `ctx.set()`, etc. throw at runtime |
|
|
22
152
|
| **Handle data** | Captured and replayed | Captured and replayed |
|
|
23
153
|
| **Loaders** | Always fresh — excluded from cache, opt-in per loader | Can be used inside loaders |
|
|
24
154
|
| **Nesting** | Nest `cache()` boundaries with different TTLs | Compose by calling cached functions from uncached |
|
|
@@ -144,13 +274,38 @@ On cache hit for the route, the handler doesn't run and `getProductData` is neve
|
|
|
144
274
|
called. On cache miss, the handler runs and `getProductData` may itself return a
|
|
145
275
|
cached value from a previous call with the same slug.
|
|
146
276
|
|
|
277
|
+
### Nesting rule: the outer window bounds the inner
|
|
278
|
+
|
|
279
|
+
A cache's window bounds everything rendered inside it (loaders excepted). An
|
|
280
|
+
inner shorter TTL only takes effect when the **enclosing** cache recomputes — it
|
|
281
|
+
does **not** keep a value fresher than its parent:
|
|
282
|
+
|
|
283
|
+
- Outer `cache()` **fresh hit** → the subtree is served from stored RSC, so inner
|
|
284
|
+
`"use cache"` functions are **not consulted** (frozen at the outer's age — no
|
|
285
|
+
code inside the boundary runs on a hit).
|
|
286
|
+
- Outer **miss / SWR revalidation** → inner caches are consulted, each per its own
|
|
287
|
+
ttl/swr. With SWR on the outer, a stale subtree serves instantly and refreshes
|
|
288
|
+
in the background, so under traffic it keeps refreshing rather than rotting to
|
|
289
|
+
the worst case.
|
|
290
|
+
- **Loaders are the exception** — excluded from the segment cache, re-resolved
|
|
291
|
+
live even on an outer hit.
|
|
292
|
+
|
|
293
|
+
So `"use cache: short"` (60s) inside `cache({ ttl: 600 })` yields ~600s freshness
|
|
294
|
+
on hits, **not** 60s. This is not a bug: setting `cache({ ttl: 600 })` declares
|
|
295
|
+
"this subtree may be ~600s stale." **If a value must be fresher than its
|
|
296
|
+
enclosing segment, put it in a loader** (always live). `debugPerformance` prints
|
|
297
|
+
cache hits per layer, so the actual per-request behavior is observable.
|
|
298
|
+
|
|
147
299
|
## Headers and Cookies
|
|
148
300
|
|
|
149
301
|
Neither mechanism caches response headers or cookies.
|
|
150
302
|
|
|
151
|
-
- **cache()**:
|
|
152
|
-
|
|
153
|
-
(
|
|
303
|
+
- **cache()**: Response-level side effects throw inside the cache boundary even
|
|
304
|
+
on a miss: `ctx.header()`, `ctx.setCookie()`, `ctx.deleteCookie()`,
|
|
305
|
+
`ctx.setStatus()`, `ctx.onResponse()`, and direct `ctx.headers` mutation. On a
|
|
306
|
+
hit the handler would be skipped, so allowing the write on a miss would produce
|
|
307
|
+
inconsistent responses. If you need headers or cookies on every response, set
|
|
308
|
+
them in middleware or a live segment outside the cache boundary.
|
|
154
309
|
- **"use cache"**: cookies() and headers() throw inside the cached function
|
|
155
310
|
(both reads and writes). ctx.header() also throws. Move them outside.
|
|
156
311
|
|
|
@@ -162,6 +317,88 @@ middleware(async (ctx, next) => {
|
|
|
162
317
|
});
|
|
163
318
|
```
|
|
164
319
|
|
|
320
|
+
## Context Variable Cache Safety
|
|
321
|
+
|
|
322
|
+
Context variables created with `createVar()` are cacheable by default and can
|
|
323
|
+
be read freely inside cached scopes. A non-cacheable var throws when read
|
|
324
|
+
**directly** with `ctx.get()` inside a `cache()` boundary — where the value would
|
|
325
|
+
otherwise be serialized into the stored segment.
|
|
326
|
+
|
|
327
|
+
There are two ways to mark a value as non-cacheable:
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
// Var-level policy — inherently request-specific data
|
|
331
|
+
const Session = createVar<SessionData>({ cache: false });
|
|
332
|
+
|
|
333
|
+
// Write-level escalation — this specific write is non-cacheable
|
|
334
|
+
ctx.set(Theme, derivedTheme, { cache: false });
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
"Least cacheable wins": if either the var definition or the `ctx.set()` call
|
|
338
|
+
specifies `cache: false`, the value is non-cacheable.
|
|
339
|
+
|
|
340
|
+
**Behavior inside a `cache()` boundary:**
|
|
341
|
+
|
|
342
|
+
| Operation | Inside a `cache()` boundary |
|
|
343
|
+
| ----------------------------------------- | ------------------------------------------------------ |
|
|
344
|
+
| `cookies()` / `headers()` (read or write) | Throws (request-scoped, would poison the shared entry) |
|
|
345
|
+
| `ctx.get(cacheableVar)` | Allowed |
|
|
346
|
+
| `ctx.get(nonCacheableVar)` | Throws (would be baked in) |
|
|
347
|
+
| `ctx.set(var, value)` (cacheable) | Allowed |
|
|
348
|
+
| `ctx.header()` / cookie writes | Throws (response side effect would be lost on hit) |
|
|
349
|
+
| Any of the above **inside a loader** | Allowed (loaders always run fresh) |
|
|
350
|
+
|
|
351
|
+
(Both scopes block the same request-scoped APIs — `cookies()`, `headers()`,
|
|
352
|
+
response side effects, and non-cacheable `ctx.get()` — because each would leak
|
|
353
|
+
per-request data into a shared cache entry. The `cache()` boundary tracks the
|
|
354
|
+
scope via `isInsideCacheScope()`; `"use cache"` uses the exec guard and also
|
|
355
|
+
excludes tainted `ctx`/`env`/`req` args from the cache key. Loaders are exempt in
|
|
356
|
+
both — see "Headers and Cookies" and the precise guarantee below.)
|
|
357
|
+
|
|
358
|
+
Write is dumb — `ctx.set()` stores the cache metadata but does not enforce.
|
|
359
|
+
Enforcement happens at read time (`ctx.get()`), where ALS detects the cache
|
|
360
|
+
scope and rejects non-cacheable reads.
|
|
361
|
+
|
|
362
|
+
### The guarantee is precise — a direct read inside `cache()`, not propagating
|
|
363
|
+
|
|
364
|
+
The guard fires on a **direct** `ctx.get(taintedVar)` **inside a `cache()`
|
|
365
|
+
boundary** (the scope `isInsideCacheScope` detects). The taint lives on the
|
|
366
|
+
variable; a value **derived** from it and read **outside** the boundary is not
|
|
367
|
+
tracked:
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
// CAUGHT — direct read of a tainted var inside a cache() boundary
|
|
371
|
+
cache({ ttl: 60 }, () => [
|
|
372
|
+
path("/dashboard", (ctx) => {
|
|
373
|
+
const user = ctx.get(User); // throws: non-cacheable read inside cache()
|
|
374
|
+
return <Dashboard user={user} />;
|
|
375
|
+
}, { name: "dashboard" }),
|
|
376
|
+
]);
|
|
377
|
+
|
|
378
|
+
// NOT CAUGHT — read outside the boundary, derived value cached
|
|
379
|
+
layout((ctx) => {
|
|
380
|
+
const name = ctx.get(User).name; // allowed — this layout is not cached
|
|
381
|
+
ctx.set(UserName, name); // now a plain (cacheable) string
|
|
382
|
+
return <Outlet />;
|
|
383
|
+
}, () => [
|
|
384
|
+
cache({ ttl: 60 }, () => [
|
|
385
|
+
// a child reads ctx.get(UserName) and silently caches user-derived data
|
|
386
|
+
]),
|
|
387
|
+
]);
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
So do **not** read this as "you can't cache user data" — that overstates it and
|
|
391
|
+
breeds the false confidence that makes the derived leak _more_ likely. The guard
|
|
392
|
+
is deliberately non-propagating (propagation would cost a wrapper per derivation
|
|
393
|
+
on the hot path), and it is scoped to the `cache()` segment boundary. `"use
|
|
394
|
+
cache"` functions block the same request-scoped reads (`cookies()` / `headers()`
|
|
395
|
+
throw inside them) and additionally exclude tainted `ctx`/`env`/`req` args from
|
|
396
|
+
the cache key. The pattern that stays safe is also the natural one:
|
|
397
|
+
**read tainted context at the point of use, in the path that needs it (a loader or
|
|
398
|
+
live segment) — never extract user data into a plain value and cache that.**
|
|
399
|
+
Loaders are exempt because they run outside the cache scope and resolve fresh
|
|
400
|
+
every request.
|
|
401
|
+
|
|
165
402
|
## Loaders Are Always Fresh
|
|
166
403
|
|
|
167
404
|
Loaders are **never cached** by route-level `cache()`. Even on a full cache hit
|
|
@@ -240,21 +477,6 @@ data is cached independently from the route's segment cache. Loader caching
|
|
|
240
477
|
supports custom keys, tags, SWR, conditional bypass, and per-loader store
|
|
241
478
|
overrides — see `/loader` for the full reference.
|
|
242
479
|
|
|
243
|
-
## Decision Flowchart
|
|
244
|
-
|
|
245
|
-
1. Do you want to cache an entire route or group of routes?
|
|
246
|
-
**Yes** -> `cache()`
|
|
247
|
-
2. Do you need runtime conditions (skip for auth users, key by locale)?
|
|
248
|
-
**Yes** -> `cache()` with `condition` / `key`
|
|
249
|
-
3. Do you want to cache a data fetch shared across routes?
|
|
250
|
-
**Yes** -> `"use cache"`
|
|
251
|
-
4. Do you need different cache entries for different arguments?
|
|
252
|
-
**Yes** -> `"use cache"` (keyed by args)
|
|
253
|
-
5. Is the expensive part rendering, not data fetching?
|
|
254
|
-
**Yes** -> `cache()` (caches rendered segments)
|
|
255
|
-
6. Is the expensive part a single query inside a larger handler?
|
|
256
|
-
**Yes** -> `"use cache"` on the query function
|
|
257
|
-
|
|
258
480
|
## See Also
|
|
259
481
|
|
|
260
482
|
- `/caching` — cache() DSL setup, stores, nested boundaries
|