@rangojs/router 0.0.0-experimental.259 → 0.0.0-experimental.25dbaac3
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/{CLAUDE.md → AGENTS.md} +4 -0
- package/README.md +471 -51
- 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 +490 -94
- 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/{src/href-context.ts → dist/href-context.d.ts} +7 -11
- 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/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 +3423 -1718
- 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 +21 -18
- package/skills/breadcrumbs/SKILL.md +252 -0
- package/skills/cache-guide/SKILL.md +41 -5
- package/skills/caching/SKILL.md +49 -8
- package/skills/document-cache/SKILL.md +2 -2
- package/skills/handler-use/SKILL.md +362 -0
- package/skills/hooks/SKILL.md +94 -52
- package/skills/host-router/SKILL.md +218 -0
- package/skills/intercept/SKILL.md +99 -0
- package/skills/layout/SKILL.md +84 -2
- package/skills/links/SKILL.md +93 -17
- package/skills/loader/SKILL.md +367 -36
- package/skills/middleware/SKILL.md +145 -33
- package/skills/migrate-nextjs/SKILL.md +562 -0
- package/skills/migrate-react-router/SKILL.md +769 -0
- package/skills/parallel/SKILL.md +249 -2
- package/skills/prerender/SKILL.md +261 -49
- package/skills/rango/SKILL.md +26 -24
- package/skills/response-routes/SKILL.md +11 -3
- package/skills/route/SKILL.md +100 -5
- package/skills/router-setup/SKILL.md +172 -5
- package/skills/server-actions/SKILL.md +739 -0
- package/skills/streams-and-websockets/SKILL.md +283 -0
- package/skills/theme/SKILL.md +5 -4
- package/skills/typesafety/SKILL.md +95 -38
- package/skills/use-cache/SKILL.md +16 -2
- package/src/__internal.ts +93 -1
- package/src/bin/rango.ts +56 -19
- package/src/browser/action-coordinator.ts +97 -0
- package/src/browser/app-shell.ts +52 -0
- package/src/browser/app-version.ts +14 -0
- package/src/browser/event-controller.ts +78 -52
- package/src/browser/history-state.ts +80 -0
- package/src/browser/intercept-utils.ts +1 -1
- package/src/browser/link-interceptor.ts +23 -3
- package/src/browser/merge-segment-loaders.ts +9 -2
- package/src/browser/navigation-bridge.ts +234 -453
- package/src/browser/navigation-client.ts +191 -86
- package/src/browser/navigation-store.ts +71 -41
- package/src/browser/navigation-transaction.ts +297 -0
- package/src/browser/partial-update.ts +215 -167
- package/src/browser/prefetch/cache.ts +314 -0
- package/src/browser/prefetch/fetch.ts +282 -0
- package/src/browser/prefetch/observer.ts +65 -0
- package/src/browser/prefetch/policy.ts +48 -0
- package/src/browser/prefetch/queue.ts +191 -0
- package/src/browser/prefetch/resource-ready.ts +77 -0
- package/src/browser/rango-state.ts +152 -0
- package/src/browser/react/Link.tsx +241 -47
- package/src/browser/react/NavigationProvider.tsx +136 -16
- package/src/browser/react/context.ts +11 -0
- package/src/browser/react/filter-segment-order.ts +55 -0
- package/src/browser/react/index.ts +2 -6
- package/src/browser/react/location-state-shared.ts +29 -11
- package/src/browser/react/location-state.ts +6 -4
- package/src/browser/react/nonce-context.ts +23 -0
- package/src/browser/react/shallow-equal.ts +27 -0
- package/src/browser/react/use-action.ts +23 -45
- package/src/browser/react/use-client-cache.ts +5 -3
- package/src/browser/react/use-handle.ts +28 -120
- package/src/browser/react/use-navigation.ts +29 -34
- package/src/browser/react/use-params.ts +16 -35
- package/src/browser/react/use-pathname.ts +2 -3
- package/src/browser/react/use-router.ts +31 -14
- package/src/browser/react/use-search-params.ts +2 -1
- package/src/browser/react/use-segments.ts +82 -118
- package/src/browser/response-adapter.ts +73 -0
- package/src/browser/rsc-router.tsx +202 -67
- package/src/browser/scroll-restoration.ts +47 -45
- package/src/browser/segment-reconciler.ts +36 -9
- package/src/browser/server-action-bridge.ts +464 -409
- package/src/browser/types.ts +100 -40
- package/src/browser/validate-redirect-origin.ts +29 -0
- package/src/build/generate-manifest.ts +44 -19
- package/src/build/generate-route-types.ts +7 -0
- package/src/build/index.ts +1 -0
- package/src/build/route-trie.ts +67 -25
- package/src/build/route-types/codegen.ts +13 -4
- package/src/build/route-types/include-resolution.ts +21 -1
- package/src/build/route-types/per-module-writer.ts +15 -3
- package/src/build/route-types/router-processing.ts +391 -90
- package/src/build/route-types/scan-filter.ts +8 -1
- package/src/build/runtime-discovery.ts +13 -1
- package/src/cache/background-task.ts +34 -0
- package/src/cache/cache-key-utils.ts +44 -0
- package/src/cache/cache-policy.ts +125 -0
- package/src/cache/cache-runtime.ts +140 -123
- package/src/cache/cache-scope.ts +124 -90
- package/src/cache/cf/cf-cache-store.ts +467 -22
- package/src/cache/cf/index.ts +5 -1
- package/src/cache/document-cache.ts +109 -75
- package/src/cache/handle-capture.ts +81 -0
- package/src/cache/index.ts +1 -15
- package/src/cache/memory-segment-store.ts +43 -69
- package/src/cache/profile-registry.ts +43 -8
- package/src/cache/read-through-swr.ts +134 -0
- package/src/cache/segment-codec.ts +140 -117
- package/src/cache/taint.ts +85 -3
- package/src/cache/types.ts +1 -115
- package/src/client.rsc.tsx +2 -1
- package/src/client.tsx +86 -254
- package/src/context-var.ts +72 -2
- package/src/debug.ts +2 -2
- package/src/errors.ts +6 -1
- package/src/handle.ts +41 -1
- package/src/handles/MetaTags.tsx +5 -2
- package/src/handles/breadcrumbs.ts +66 -0
- package/src/handles/index.ts +1 -0
- package/src/host/cookie-handler.ts +8 -3
- package/src/host/index.ts +0 -3
- package/src/host/router.ts +14 -1
- package/src/href-client.ts +3 -1
- package/src/index.rsc.ts +48 -32
- package/src/index.ts +104 -64
- package/src/loader.rsc.ts +12 -4
- package/src/loader.ts +8 -0
- package/src/outlet-context.ts +1 -1
- package/src/prerender/store.ts +61 -18
- package/src/prerender.ts +207 -88
- package/src/response-utils.ts +28 -0
- package/src/reverse.ts +36 -7
- package/src/root-error-boundary.tsx +30 -26
- package/src/route-definition/dsl-helpers.ts +249 -46
- package/src/route-definition/helpers-types.ts +73 -20
- package/src/route-definition/index.ts +3 -3
- package/src/route-definition/redirect.ts +24 -4
- package/src/route-definition/resolve-handler-use.ts +155 -0
- package/src/route-map-builder.ts +45 -3
- package/src/route-name.ts +53 -0
- package/src/route-types.ts +25 -0
- package/src/router/content-negotiation.ts +101 -2
- package/src/router/debug-manifest.ts +16 -3
- package/src/router/find-match.ts +4 -2
- package/src/router/handler-context.ts +221 -39
- package/src/router/intercept-resolution.ts +17 -8
- package/src/router/lazy-includes.ts +12 -5
- package/src/router/loader-resolution.ts +164 -31
- package/src/router/logging.ts +104 -4
- package/src/router/manifest.ts +53 -9
- package/src/router/match-api.ts +150 -206
- package/src/router/match-context.ts +3 -0
- package/src/router/match-handlers.ts +186 -11
- package/src/router/match-middleware/background-revalidation.ts +94 -86
- package/src/router/match-middleware/cache-lookup.ts +164 -19
- package/src/router/match-middleware/cache-store.ts +55 -10
- package/src/router/match-middleware/intercept-resolution.ts +9 -7
- package/src/router/match-middleware/segment-resolution.ts +61 -5
- package/src/router/match-pipelines.ts +8 -43
- package/src/router/match-result.ts +122 -18
- package/src/router/metrics.ts +238 -13
- package/src/router/middleware-types.ts +64 -61
- package/src/router/middleware.ts +316 -145
- package/src/router/navigation-snapshot.ts +182 -0
- package/src/router/pattern-matching.ts +134 -15
- package/src/router/prerender-match.ts +150 -16
- package/src/router/preview-match.ts +30 -96
- package/src/router/request-classification.ts +310 -0
- package/src/router/revalidation.ts +102 -9
- package/src/router/route-snapshot.ts +245 -0
- package/src/router/router-context.ts +20 -0
- package/src/router/router-interfaces.ts +200 -43
- package/src/router/router-options.ts +265 -12
- package/src/router/router-registry.ts +5 -2
- package/src/router/segment-resolution/fresh.ts +365 -256
- package/src/router/segment-resolution/helpers.ts +268 -0
- package/src/router/segment-resolution/loader-cache.ts +103 -98
- package/src/router/segment-resolution/revalidation.ts +711 -423
- package/src/router/segment-resolution/static-store.ts +2 -2
- package/src/router/segment-resolution.ts +1 -3
- package/src/router/segment-wrappers.ts +5 -0
- package/src/router/telemetry-otel.ts +299 -0
- package/src/router/telemetry.ts +300 -0
- package/src/router/timeout.ts +148 -0
- package/src/router/trie-matching.ts +30 -6
- package/src/router/types.ts +8 -1
- package/src/router/url-params.ts +49 -0
- package/src/router.ts +269 -25
- package/src/rsc/handler-context.ts +13 -2
- package/src/rsc/handler.ts +784 -629
- package/src/rsc/helpers.ts +168 -20
- package/src/rsc/index.ts +0 -20
- package/src/rsc/loader-fetch.ts +105 -43
- package/src/rsc/manifest-init.ts +7 -2
- package/src/rsc/origin-guard.ts +141 -0
- package/src/rsc/progressive-enhancement.ts +262 -20
- package/src/rsc/response-route-handler.ts +360 -0
- package/src/rsc/rsc-rendering.ts +70 -44
- package/src/rsc/runtime-warnings.ts +42 -0
- package/src/rsc/server-action.ts +178 -66
- package/src/rsc/ssr-setup.ts +128 -0
- package/src/rsc/types.ts +37 -3
- package/src/search-params.ts +38 -23
- package/src/segment-content-promise.ts +67 -0
- package/src/segment-loader-promise.ts +122 -0
- package/src/segment-system.tsx +109 -23
- package/src/server/context.ts +227 -24
- package/src/server/cookie-store.ts +190 -0
- package/src/server/fetchable-loader-store.ts +11 -6
- package/src/server/handle-store.ts +103 -12
- package/src/server/loader-registry.ts +20 -54
- package/src/server/request-context.ts +475 -105
- package/src/server.ts +6 -0
- package/src/ssr/index.tsx +74 -27
- package/src/static-handler.ts +25 -6
- package/src/theme/ThemeProvider.tsx +6 -1
- package/src/theme/index.ts +4 -18
- package/src/theme/theme-context.ts +1 -28
- package/src/theme/theme-script.ts +2 -1
- package/src/types/cache-types.ts +10 -5
- package/src/types/error-types.ts +3 -0
- package/src/types/global-namespace.ts +22 -0
- package/src/types/handler-context.ts +242 -82
- package/src/types/index.ts +1 -1
- package/src/types/loader-types.ts +50 -21
- package/src/types/request-scope.ts +126 -0
- package/src/types/route-config.ts +17 -26
- package/src/types/route-entry.ts +46 -0
- package/src/types/segments.ts +19 -5
- package/src/urls/include-helper.ts +72 -21
- package/src/urls/index.ts +1 -0
- package/src/urls/path-helper-types.ts +69 -18
- package/src/urls/path-helper.ts +65 -15
- package/src/urls/pattern-types.ts +33 -1
- package/src/urls/response-types.ts +47 -23
- package/src/urls/type-extraction.ts +23 -15
- package/src/use-loader.tsx +103 -13
- package/src/vite/debug.ts +184 -0
- package/src/vite/discovery/bundle-postprocess.ts +62 -85
- package/src/vite/discovery/discover-routers.ts +87 -29
- package/src/vite/discovery/gate-state.ts +171 -0
- package/src/vite/discovery/prerender-collection.ts +224 -106
- package/src/vite/discovery/route-types-writer.ts +7 -7
- package/src/vite/discovery/self-gen-tracking.ts +27 -1
- package/src/vite/discovery/state.ts +20 -13
- package/src/vite/discovery/virtual-module-codegen.ts +5 -2
- package/src/vite/index.ts +14 -51
- package/src/vite/plugin-types.ts +51 -79
- package/src/vite/plugins/cjs-to-esm.ts +5 -0
- package/src/vite/plugins/client-ref-dedup.ts +131 -0
- package/src/vite/plugins/client-ref-hashing.ts +19 -7
- 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 +53 -31
- package/src/vite/plugins/expose-id-utils.ts +12 -0
- package/src/vite/plugins/expose-ids/handler-transform.ts +30 -0
- package/src/vite/plugins/expose-ids/router-transform.ts +20 -3
- package/src/vite/plugins/expose-internal-ids.ts +567 -319
- package/src/vite/plugins/performance-tracks.ts +96 -0
- package/src/vite/plugins/refresh-cmd.ts +127 -0
- package/src/vite/plugins/use-cache-transform.ts +139 -38
- package/src/vite/plugins/version-injector.ts +37 -11
- package/src/vite/plugins/version-plugin.ts +200 -18
- package/src/vite/rango.ts +233 -221
- package/src/vite/router-discovery.ts +887 -176
- package/src/vite/utils/banner.ts +4 -4
- package/src/vite/utils/package-resolution.ts +41 -1
- package/src/vite/utils/prerender-utils.ts +113 -0
- package/src/vite/utils/shared-utils.ts +22 -11
- package/skills/testing/SKILL.md +0 -226
- package/src/browser/lru-cache.ts +0 -61
- package/src/browser/react/prefetch.ts +0 -27
- package/src/browser/request-controller.ts +0 -164
- package/src/cache/memory-store.ts +0 -253
- package/src/route-definition/route-function.ts +0 -119
- package/src/router.gen.ts +0 -6
- package/src/static-handler.gen.ts +0 -5
- package/src/urls.gen.ts +0 -8
|
@@ -61,7 +61,14 @@ export function findTsFiles(dir: string, filter?: ScanFilter): string[] {
|
|
|
61
61
|
for (const entry of entries) {
|
|
62
62
|
const fullPath = join(dir, entry.name);
|
|
63
63
|
if (entry.isDirectory()) {
|
|
64
|
-
if (
|
|
64
|
+
if (
|
|
65
|
+
entry.name === "node_modules" ||
|
|
66
|
+
entry.name.startsWith(".") ||
|
|
67
|
+
entry.name === "dist" ||
|
|
68
|
+
entry.name === "build" ||
|
|
69
|
+
entry.name === "coverage"
|
|
70
|
+
)
|
|
71
|
+
continue;
|
|
65
72
|
results.push(...findTsFiles(fullPath, filter));
|
|
66
73
|
} else if (
|
|
67
74
|
(entry.name.endsWith(".ts") ||
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
generateRouteTypesSource,
|
|
5
5
|
buildCombinedRouteMapForRouterFile,
|
|
6
6
|
} from "./generate-route-types.ts";
|
|
7
|
+
import { isAutoGeneratedRouteName } from "../route-name.js";
|
|
7
8
|
|
|
8
9
|
export interface RuntimeDiscoveryOptions {
|
|
9
10
|
/** Project root directory (where package.json / node_modules live). */
|
|
@@ -140,7 +141,18 @@ export async function discoverAndWriteRouteTypes(
|
|
|
140
141
|
const manifest = generateManifest(router.urlpatterns, routerMountIndex);
|
|
141
142
|
routerMountIndex++;
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
// Filter out auto-generated route names that the runtime creates for
|
|
145
|
+
// unnamed routes (path() with no name option). These get names like
|
|
146
|
+
// "$path__health" at root level or "docs.$path__health" under include().
|
|
147
|
+
// Match the Vite discovery writer's predicate: any name starting with "$"
|
|
148
|
+
// is internal. For prefixed names, check each dot-separated segment.
|
|
149
|
+
const rawManifest: Record<string, string> = manifest.routeManifest;
|
|
150
|
+
const routeManifest: Record<string, string> = {};
|
|
151
|
+
for (const [name, pattern] of Object.entries(rawManifest)) {
|
|
152
|
+
if (!isAutoGeneratedRouteName(name)) {
|
|
153
|
+
routeManifest[name] = pattern;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
144
156
|
let routeSearchSchemas:
|
|
145
157
|
| Record<string, Record<string, string>>
|
|
146
158
|
| undefined = manifest.routeSearchSchemas;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background Task Runner
|
|
3
|
+
*
|
|
4
|
+
* Unified helper for scheduling async work via waitUntil.
|
|
5
|
+
* When waitUntil is unavailable, falls back to blocking or skipping.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface WaitUntilHost {
|
|
9
|
+
waitUntil?: (fn: () => Promise<void>) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Schedule an async task in the background via waitUntil.
|
|
14
|
+
*
|
|
15
|
+
* @param host - Object with optional waitUntil (request context or similar)
|
|
16
|
+
* @param task - Async function to execute
|
|
17
|
+
* @param blockWhenNoWaitUntil - If true, awaits the task when waitUntil is
|
|
18
|
+
* unavailable (e.g., Node.js dev server). If false (default), the task
|
|
19
|
+
* is silently skipped when waitUntil is unavailable.
|
|
20
|
+
* @returns A promise when blocking fallback is used, void otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export function runBackground(
|
|
23
|
+
host: WaitUntilHost | null | undefined,
|
|
24
|
+
task: () => Promise<void>,
|
|
25
|
+
blockWhenNoWaitUntil = false,
|
|
26
|
+
): Promise<void> | void {
|
|
27
|
+
if (host?.waitUntil) {
|
|
28
|
+
host.waitUntil(task);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (blockWhenNoWaitUntil) {
|
|
32
|
+
return task();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Cache Key Utilities
|
|
3
|
+
*
|
|
4
|
+
* Deterministic normalization of search params and route params
|
|
5
|
+
* for cache key generation. Used by cache-runtime, cache-scope,
|
|
6
|
+
* document-cache, and loader-cache.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Build a sorted, deterministic query string from URLSearchParams,
|
|
11
|
+
* excluding internal _rsc* and __* params.
|
|
12
|
+
*
|
|
13
|
+
* Returns empty string when no user-facing params exist.
|
|
14
|
+
*/
|
|
15
|
+
export function sortedSearchString(searchParams: URLSearchParams): string {
|
|
16
|
+
const pairs: [string, string][] = [];
|
|
17
|
+
for (const [k, v] of searchParams) {
|
|
18
|
+
if (!k.startsWith("_rsc") && !k.startsWith("__")) {
|
|
19
|
+
pairs.push([k, v]);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (pairs.length === 0) return "";
|
|
23
|
+
pairs.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
24
|
+
return pairs
|
|
25
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
26
|
+
.join("&");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Build a sorted, deterministic string from route params.
|
|
31
|
+
*
|
|
32
|
+
* Returns empty string when params is empty or undefined.
|
|
33
|
+
*/
|
|
34
|
+
export function sortedRouteParams(
|
|
35
|
+
params: Record<string, string> | undefined,
|
|
36
|
+
): string {
|
|
37
|
+
if (!params) return "";
|
|
38
|
+
const entries = Object.entries(params);
|
|
39
|
+
if (entries.length === 0) return "";
|
|
40
|
+
return entries
|
|
41
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
42
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
43
|
+
.join("&");
|
|
44
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Cache Policy Utilities
|
|
3
|
+
*
|
|
4
|
+
* Resolution cascades for TTL, SWR, cache key, and cache store.
|
|
5
|
+
* Consolidates the multi-tier resolution pattern:
|
|
6
|
+
* explicit option → store defaults → fallback constant
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { CacheDefaults, SegmentCacheStore } from "./types.js";
|
|
10
|
+
import { _getRequestContext } from "../server/request-context.js";
|
|
11
|
+
import type { RequestContext } from "../server/request-context.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default TTL for route-level cache() DSL and loader cache.
|
|
15
|
+
* Applied when neither the cache options nor the store defaults specify a TTL.
|
|
16
|
+
*/
|
|
17
|
+
export const DEFAULT_ROUTE_TTL = 60;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Default TTL for function-level "use cache" (setItem).
|
|
21
|
+
* Applied when neither the item options nor the store defaults specify a TTL.
|
|
22
|
+
*/
|
|
23
|
+
export const DEFAULT_FUNCTION_TTL = 900;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Resolve effective TTL from the 3-tier cascade:
|
|
27
|
+
* explicit → store defaults → fallback.
|
|
28
|
+
*/
|
|
29
|
+
export function resolveTtl(
|
|
30
|
+
explicit: number | undefined,
|
|
31
|
+
defaults: CacheDefaults | undefined,
|
|
32
|
+
fallback: number,
|
|
33
|
+
): number {
|
|
34
|
+
if (explicit !== undefined) return explicit;
|
|
35
|
+
if (defaults?.ttl !== undefined) return defaults.ttl;
|
|
36
|
+
return fallback;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Resolve effective SWR window from the 2-tier cascade:
|
|
41
|
+
* explicit → store defaults.
|
|
42
|
+
* Returns 0 when unset (no SWR window).
|
|
43
|
+
*/
|
|
44
|
+
export function resolveSwrWindow(
|
|
45
|
+
explicit: number | undefined,
|
|
46
|
+
defaults: CacheDefaults | undefined,
|
|
47
|
+
): number {
|
|
48
|
+
if (explicit !== undefined) return explicit;
|
|
49
|
+
if (defaults?.swr !== undefined) return defaults.swr;
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Compute staleAt and expiresAt timestamps from TTL and SWR window.
|
|
55
|
+
*
|
|
56
|
+
* - staleAt: when the entry becomes stale (TTL boundary)
|
|
57
|
+
* - expiresAt: when the entry should be evicted (TTL + SWR)
|
|
58
|
+
*
|
|
59
|
+
* When swrWindow is 0, staleAt === expiresAt (no SWR).
|
|
60
|
+
*/
|
|
61
|
+
export function computeExpiration(
|
|
62
|
+
ttlSeconds: number,
|
|
63
|
+
swrSeconds: number = 0,
|
|
64
|
+
): { staleAt: number; expiresAt: number } {
|
|
65
|
+
const now = Date.now();
|
|
66
|
+
const staleAt = now + ttlSeconds * 1000;
|
|
67
|
+
const expiresAt = staleAt + swrSeconds * 1000;
|
|
68
|
+
return { staleAt, expiresAt };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Cache Key Resolution
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Resolve cache key using the 3-tier priority:
|
|
77
|
+
* 1. keyFn (full override from route/loader cache options)
|
|
78
|
+
* 2. store.keyGenerator (modifies default key)
|
|
79
|
+
* 3. defaultKey (used when neither keyFn nor keyGenerator is provided)
|
|
80
|
+
*
|
|
81
|
+
* Errors from keyFn and store.keyGenerator propagate to the caller.
|
|
82
|
+
* Cache identity is correctness-critical: if explicit key logic throws,
|
|
83
|
+
* silently remapping to a different key could cause cache collisions or
|
|
84
|
+
* serve stale/wrong data. Callers must handle the error or let it surface.
|
|
85
|
+
*
|
|
86
|
+
* Uses _getRequestContext (non-throwing) so that calls outside ALS
|
|
87
|
+
* (e.g. build-time) gracefully fall back to defaultKey.
|
|
88
|
+
*/
|
|
89
|
+
export async function resolveCacheKey(
|
|
90
|
+
keyFn: ((ctx: RequestContext) => string | Promise<string>) | undefined,
|
|
91
|
+
store: SegmentCacheStore | null,
|
|
92
|
+
defaultKey: string,
|
|
93
|
+
_label: string,
|
|
94
|
+
): Promise<string> {
|
|
95
|
+
const requestCtx = _getRequestContext();
|
|
96
|
+
|
|
97
|
+
// Priority 1: Route/loader-level key function (full override)
|
|
98
|
+
if (keyFn && requestCtx) {
|
|
99
|
+
return await keyFn(requestCtx);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Priority 2: Store-level keyGenerator (modifies default key)
|
|
103
|
+
if (store?.keyGenerator && requestCtx) {
|
|
104
|
+
return await store.keyGenerator(requestCtx, defaultKey);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Priority 3: Default key (no custom key logic provided)
|
|
108
|
+
return defaultKey;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ============================================================================
|
|
112
|
+
// Cache Store Resolution
|
|
113
|
+
// ============================================================================
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Resolve cache store from the 2-tier priority:
|
|
117
|
+
* 1. Explicit store from cache options
|
|
118
|
+
* 2. App-level store from request context
|
|
119
|
+
*/
|
|
120
|
+
export function resolveCacheStore(
|
|
121
|
+
explicitStore: SegmentCacheStore | undefined,
|
|
122
|
+
): SegmentCacheStore | null {
|
|
123
|
+
if (explicitStore) return explicitStore;
|
|
124
|
+
return _getRequestContext()?._cacheStore ?? null;
|
|
125
|
+
}
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
/// <reference types="@vitejs/plugin-rsc/types" />
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
|
-
renderToReadableStream,
|
|
21
|
-
createFromReadableStream,
|
|
22
|
-
createTemporaryReferenceSet,
|
|
23
20
|
encodeReply,
|
|
24
21
|
createClientTemporaryReferenceSet,
|
|
25
22
|
} from "@vitejs/plugin-rsc/rsc";
|
|
@@ -28,38 +25,17 @@ import {
|
|
|
28
25
|
isTainted,
|
|
29
26
|
CACHED_FN_SYMBOL,
|
|
30
27
|
isCachedFunction,
|
|
31
|
-
|
|
28
|
+
stampCacheExec,
|
|
29
|
+
unstampCacheExec,
|
|
32
30
|
} from "./taint.js";
|
|
33
31
|
|
|
34
32
|
export { isCachedFunction };
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
38
|
-
import type
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Serialization Helpers
|
|
42
|
-
// ============================================================================
|
|
43
|
-
|
|
44
|
-
async function serializeResult(value: unknown): Promise<string | null> {
|
|
45
|
-
try {
|
|
46
|
-
const temporaryReferences = createTemporaryReferenceSet();
|
|
47
|
-
const stream = renderToReadableStream(value, { temporaryReferences });
|
|
48
|
-
return await streamToString(stream);
|
|
49
|
-
} catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async function deserializeResult<T>(encoded: string): Promise<T> {
|
|
55
|
-
const temporaryReferences = createTemporaryReferenceSet();
|
|
56
|
-
const stream = stringToStream(encoded);
|
|
57
|
-
return createFromReadableStream<T>(stream, { temporaryReferences });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// ============================================================================
|
|
61
|
-
// Cache Key Generation
|
|
62
|
-
// ============================================================================
|
|
33
|
+
import { serializeResult, deserializeResult } from "./segment-codec.js";
|
|
34
|
+
import { createHandleStore } from "../server/handle-store.js";
|
|
35
|
+
import { restoreHandles } from "./handle-snapshot.js";
|
|
36
|
+
import { startHandleCapture, type HandleCapture } from "./handle-capture.js";
|
|
37
|
+
import { sortedSearchString } from "./cache-key-utils.js";
|
|
38
|
+
import { runBackground } from "./background-task.js";
|
|
63
39
|
|
|
64
40
|
/**
|
|
65
41
|
* Convert encodeReply result to a stable string key.
|
|
@@ -72,58 +48,6 @@ async function replyToCacheKey(encoded: string | FormData): Promise<string> {
|
|
|
72
48
|
return text;
|
|
73
49
|
}
|
|
74
50
|
|
|
75
|
-
// ============================================================================
|
|
76
|
-
// Handle Capture
|
|
77
|
-
// ============================================================================
|
|
78
|
-
|
|
79
|
-
interface HandleCapture {
|
|
80
|
-
data: Record<string, SegmentHandleData>;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function startHandleCapture(handleStore: HandleStore): HandleCapture {
|
|
84
|
-
const capture: HandleCapture = { data: {} };
|
|
85
|
-
const originalPush = handleStore.push.bind(handleStore);
|
|
86
|
-
|
|
87
|
-
// Intercept push() calls to record them
|
|
88
|
-
handleStore.push = (
|
|
89
|
-
handleName: string,
|
|
90
|
-
segmentId: string,
|
|
91
|
-
value: unknown,
|
|
92
|
-
) => {
|
|
93
|
-
if (!capture.data[segmentId]) {
|
|
94
|
-
capture.data[segmentId] = {};
|
|
95
|
-
}
|
|
96
|
-
if (!capture.data[segmentId][handleName]) {
|
|
97
|
-
capture.data[segmentId][handleName] = [];
|
|
98
|
-
}
|
|
99
|
-
capture.data[segmentId][handleName].push(value);
|
|
100
|
-
// Still call the original so the data flows through normally
|
|
101
|
-
originalPush(handleName, segmentId, value);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
return capture;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function stopHandleCapture(
|
|
108
|
-
handleStore: HandleStore,
|
|
109
|
-
_capture: HandleCapture,
|
|
110
|
-
): void {
|
|
111
|
-
// Restore original push by deleting the override
|
|
112
|
-
// (the original is on the prototype/closure, our override is an own property)
|
|
113
|
-
delete (handleStore as any).push;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function restoreHandles(
|
|
117
|
-
handles: Record<string, SegmentHandleData>,
|
|
118
|
-
handleStore: HandleStore,
|
|
119
|
-
): void {
|
|
120
|
-
for (const [segId, segHandles] of Object.entries(handles)) {
|
|
121
|
-
if (Object.keys(segHandles).length > 0) {
|
|
122
|
-
handleStore.replaySegmentData(segId, segHandles);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
51
|
// ============================================================================
|
|
128
52
|
// Core: registerCachedFunction
|
|
129
53
|
// ============================================================================
|
|
@@ -144,17 +68,30 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
144
68
|
const wrapped = async function (this: any, ...args: any[]): Promise<any> {
|
|
145
69
|
const requestCtx = getRequestContext();
|
|
146
70
|
const store = requestCtx?._cacheStore;
|
|
147
|
-
const
|
|
71
|
+
const resolvedProfileName = profileName || "default";
|
|
148
72
|
|
|
149
|
-
// Bypass: no store
|
|
150
|
-
if (!store?.getItem
|
|
73
|
+
// Bypass: no store or no getItem support
|
|
74
|
+
if (!store?.getItem) {
|
|
151
75
|
return fn.apply(this, args);
|
|
152
76
|
}
|
|
153
77
|
|
|
78
|
+
// Resolve profile strictly from request-scoped config (set by the
|
|
79
|
+
// active router via createRequestContext). No global fallback —
|
|
80
|
+
// global profile state is only for DSL-time cache("profileName").
|
|
81
|
+
const profile = requestCtx?._cacheProfiles?.[resolvedProfileName];
|
|
82
|
+
|
|
83
|
+
if (!profile) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
`[use cache] "${id}" uses unknown cache profile "${resolvedProfileName}". ` +
|
|
86
|
+
`Define it in createRouter({ cacheProfiles: { "${resolvedProfileName}": { ttl: ... } } }).`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
154
90
|
// Separate tainted args (ctx, env, req) from key-generating args.
|
|
155
|
-
// For tainted objects that carry route context (params, pathname
|
|
156
|
-
// extract
|
|
157
|
-
//
|
|
91
|
+
// For tainted objects that carry route context (params, pathname,
|
|
92
|
+
// searchParams), extract serializable values into the key so
|
|
93
|
+
// different routes, param combinations, and query variants produce
|
|
94
|
+
// distinct cache entries.
|
|
158
95
|
const keyArgs: unknown[] = [];
|
|
159
96
|
let hasTaintedArgs = false;
|
|
160
97
|
for (const arg of args) {
|
|
@@ -162,10 +99,28 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
162
99
|
hasTaintedArgs = true;
|
|
163
100
|
const ctx = arg as any;
|
|
164
101
|
if (ctx.params && typeof ctx.params === "object") {
|
|
102
|
+
// Include host to prevent cross-host cache collisions (same
|
|
103
|
+
// pattern as route-level cache-scope.ts key generation).
|
|
104
|
+
if (ctx.url?.host) {
|
|
105
|
+
keyArgs.push(ctx.url.host);
|
|
106
|
+
}
|
|
107
|
+
// Include route name to prevent collisions when the same cached
|
|
108
|
+
// function is reused across routes with identical pathname/params
|
|
109
|
+
// but different local reverse() scope.
|
|
110
|
+
if (ctx._routeName) {
|
|
111
|
+
keyArgs.push(ctx._routeName);
|
|
112
|
+
}
|
|
165
113
|
keyArgs.push(ctx.pathname, ctx.params);
|
|
166
114
|
if (ctx._responseType) {
|
|
167
115
|
keyArgs.push(ctx._responseType);
|
|
168
116
|
}
|
|
117
|
+
// Include user-facing search params (exclude internal _rsc*/__ params)
|
|
118
|
+
if (ctx.searchParams instanceof URLSearchParams) {
|
|
119
|
+
const normalized = sortedSearchString(ctx.searchParams);
|
|
120
|
+
if (normalized) {
|
|
121
|
+
keyArgs.push(normalized);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
169
124
|
}
|
|
170
125
|
} else {
|
|
171
126
|
keyArgs.push(arg);
|
|
@@ -234,24 +189,79 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
234
189
|
restoreHandles(cached.handles, handleStore);
|
|
235
190
|
}
|
|
236
191
|
}
|
|
237
|
-
// Background revalidation
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
192
|
+
// Background revalidation — must capture handles if tainted args present.
|
|
193
|
+
// Use an isolated handle store so background pushes don't pollute the
|
|
194
|
+
// live response or throw LateHandlePushError on the completed store.
|
|
195
|
+
// Same isolation pattern as route-level background-revalidation.ts.
|
|
196
|
+
runBackground(requestCtx, async () => {
|
|
197
|
+
// Reuse closure-captured requestCtx instead of calling
|
|
198
|
+
// getRequestContext() — ALS context may be gone inside waitUntil.
|
|
199
|
+
let originalHandleStore:
|
|
200
|
+
| ReturnType<typeof createHandleStore>
|
|
201
|
+
| undefined;
|
|
202
|
+
if (hasTaintedArgs && requestCtx) {
|
|
203
|
+
originalHandleStore = requestCtx._handleStore;
|
|
204
|
+
requestCtx._handleStore = createHandleStore();
|
|
205
|
+
}
|
|
206
|
+
const bgHandleStore = hasTaintedArgs
|
|
207
|
+
? requestCtx?._handleStore
|
|
208
|
+
: undefined;
|
|
209
|
+
let bgCapture: HandleCapture | undefined;
|
|
210
|
+
let bgStopCapture: (() => void) | undefined;
|
|
211
|
+
if (bgHandleStore) {
|
|
212
|
+
const c = startHandleCapture(bgHandleStore);
|
|
213
|
+
bgCapture = c.capture;
|
|
214
|
+
bgStopCapture = c.stop;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Stamp tainted ARGS only — not requestCtx. The args stamp guards
|
|
218
|
+
// direct ctx method calls (ctx.set, ctx.header, ctx.onResponse, etc.)
|
|
219
|
+
// which is sufficient for correctness.
|
|
220
|
+
//
|
|
221
|
+
// We intentionally skip stamping requestCtx here because:
|
|
222
|
+
// 1. runBackground starts the async task synchronously (before the
|
|
223
|
+
// first await), so stampCacheExec would pollute the shared
|
|
224
|
+
// requestCtx while the foreground pipeline is still running.
|
|
225
|
+
// This causes assertNotInsideCacheExec to fire when cache-store
|
|
226
|
+
// later calls requestCtx.onResponse().
|
|
227
|
+
// 2. requestCtx methods are closure-bound to the original ctx, so
|
|
228
|
+
// neither Object.create() nor a proxy can isolate the stamp.
|
|
229
|
+
// 3. The foreground miss path already stamps requestCtx and catches
|
|
230
|
+
// cookies()/headers() misuse on first execution. The background
|
|
231
|
+
// re-runs the same function with the same request.
|
|
232
|
+
const bgTaintedArgs: unknown[] = [];
|
|
233
|
+
for (const arg of args) {
|
|
234
|
+
if (isTainted(arg)) {
|
|
235
|
+
stampCacheExec(arg as object);
|
|
236
|
+
bgTaintedArgs.push(arg);
|
|
252
237
|
}
|
|
253
|
-
}
|
|
254
|
-
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
try {
|
|
241
|
+
const freshResult = await fn.apply(this, args);
|
|
242
|
+
bgStopCapture?.();
|
|
243
|
+
const serialized = await serializeResult(freshResult);
|
|
244
|
+
if (serialized !== null) {
|
|
245
|
+
await store.setItem!(cacheKey, serialized, {
|
|
246
|
+
handles: bgCapture?.data,
|
|
247
|
+
ttl: profile.ttl,
|
|
248
|
+
swr: profile.swr,
|
|
249
|
+
tags: profile.tags,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
} catch (bgError) {
|
|
253
|
+
bgStopCapture?.();
|
|
254
|
+
requestCtx?._reportBackgroundError?.(bgError, "stale-revalidation");
|
|
255
|
+
} finally {
|
|
256
|
+
for (const arg of bgTaintedArgs) {
|
|
257
|
+
unstampCacheExec(arg as object);
|
|
258
|
+
}
|
|
259
|
+
// Restore original handle store
|
|
260
|
+
if (originalHandleStore && requestCtx) {
|
|
261
|
+
requestCtx._handleStore = originalHandleStore;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
255
265
|
return result;
|
|
256
266
|
} catch {
|
|
257
267
|
// Deserialization of stale value failed, fall through
|
|
@@ -261,32 +271,44 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
261
271
|
// Cache miss: execute, serialize, store
|
|
262
272
|
const handleStore = hasTaintedArgs ? requestCtx?._handleStore : undefined;
|
|
263
273
|
let capture: HandleCapture | undefined;
|
|
274
|
+
let stopCapture: (() => void) | undefined;
|
|
264
275
|
if (handleStore && hasTaintedArgs) {
|
|
265
|
-
|
|
276
|
+
const c = startHandleCapture(handleStore);
|
|
277
|
+
capture = c.capture;
|
|
278
|
+
stopCapture = c.stop;
|
|
266
279
|
}
|
|
267
280
|
|
|
268
281
|
// Stamp tainted args so ctx.set(), ctx.header(), etc. throw if called
|
|
269
282
|
// inside the cached function body (those side effects are lost on hit).
|
|
283
|
+
// Uses ref-counted stamp/unstamp so overlapping executions
|
|
284
|
+
// sharing the same ctx don't clear each other's guards.
|
|
270
285
|
const taintedArgs: unknown[] = [];
|
|
271
286
|
for (const arg of args) {
|
|
272
287
|
if (isTainted(arg)) {
|
|
273
|
-
(arg as
|
|
288
|
+
stampCacheExec(arg as object);
|
|
274
289
|
taintedArgs.push(arg);
|
|
275
290
|
}
|
|
276
291
|
}
|
|
292
|
+
// Always stamp the ALS RequestContext so cookies()/headers() guards fire
|
|
293
|
+
// even when the cached function receives no tainted args. The guard in
|
|
294
|
+
// cookie-store.ts checks RequestContext, not function args.
|
|
295
|
+
if (requestCtx) {
|
|
296
|
+
stampCacheExec(requestCtx as object);
|
|
297
|
+
}
|
|
277
298
|
|
|
278
299
|
let result: any;
|
|
279
300
|
try {
|
|
280
301
|
result = await fn.apply(this, args);
|
|
281
302
|
} finally {
|
|
282
|
-
//
|
|
303
|
+
// Decrement ref count; symbol is deleted when it reaches zero
|
|
283
304
|
for (const arg of taintedArgs) {
|
|
284
|
-
|
|
305
|
+
unstampCacheExec(arg as object);
|
|
285
306
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
307
|
+
if (requestCtx) {
|
|
308
|
+
unstampCacheExec(requestCtx as object);
|
|
309
|
+
}
|
|
310
|
+
// Remove this capture token (order-independent, safe for concurrent use)
|
|
311
|
+
stopCapture?.();
|
|
290
312
|
}
|
|
291
313
|
|
|
292
314
|
// Serialize and store — fully non-blocking when waitUntil is available.
|
|
@@ -302,17 +324,12 @@ export function registerCachedFunction<T extends (...args: any[]) => any>(
|
|
|
302
324
|
tags: profile.tags,
|
|
303
325
|
});
|
|
304
326
|
}
|
|
305
|
-
} catch {
|
|
306
|
-
|
|
327
|
+
} catch (writeError) {
|
|
328
|
+
requestCtx?._reportBackgroundError?.(writeError, "cache-write");
|
|
307
329
|
}
|
|
308
330
|
};
|
|
309
331
|
|
|
310
|
-
|
|
311
|
-
requestCtx.waitUntil(cacheWrite);
|
|
312
|
-
} else {
|
|
313
|
-
// No waitUntil (e.g. Node.js dev server): run inline as best-effort
|
|
314
|
-
await cacheWrite();
|
|
315
|
-
}
|
|
332
|
+
await runBackground(requestCtx, cacheWrite, true);
|
|
316
333
|
|
|
317
334
|
return result;
|
|
318
335
|
};
|