@rangojs/router 0.0.0-experimental.116 → 0.0.0-experimental.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__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.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 +82 -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 +8 -10
- 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/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 +18 -17
- package/skills/css/SKILL.md +76 -0
- package/skills/host-router/SKILL.md +21 -0
- package/skills/loader/SKILL.md +17 -17
- package/skills/rango/SKILL.md +1 -0
- package/skills/tailwind/SKILL.md +27 -3
- package/src/browser/app-shell.ts +14 -27
- package/src/browser/navigation-bridge.ts +2 -51
- package/src/browser/navigation-client.ts +70 -68
- package/src/browser/navigation-store.ts +1 -25
- package/src/browser/partial-update.ts +19 -32
- package/src/browser/prefetch/cache.ts +97 -48
- package/src/browser/prefetch/fetch.ts +101 -33
- package/src/browser/rango-state.ts +6 -22
- package/src/browser/react/NavigationProvider.tsx +12 -9
- package/src/browser/react/use-router.ts +4 -3
- package/src/browser/response-adapter.ts +27 -1
- package/src/browser/rsc-router.tsx +20 -13
- package/src/browser/server-action-bridge.ts +21 -0
- package/src/browser/types.ts +4 -15
- package/src/cache/cache-runtime.ts +17 -5
- package/src/cache/cache-scope.ts +23 -7
- package/src/cache/cf/cf-cache-store.ts +4 -4
- package/src/cache/handle-snapshot.ts +103 -0
- package/src/cache/memory-segment-store.ts +3 -2
- package/src/cache/types.ts +10 -6
- package/src/prerender/store.ts +9 -7
- package/src/router/lazy-includes.ts +1 -1
- package/src/router/loader-resolution.ts +63 -34
- package/src/router/manifest.ts +1 -1
- package/src/router/match-middleware/cache-lookup.ts +13 -4
- package/src/router/prerender-match.ts +39 -14
- package/src/router/request-classification.ts +36 -9
- package/src/router/router-interfaces.ts +6 -7
- package/src/router/segment-resolution/static-store.ts +19 -5
- package/src/rsc/handler.ts +30 -8
- package/src/rsc/origin-guard.ts +2 -0
- package/src/rsc/response-route-handler.ts +20 -1
- package/src/rsc/rsc-rendering.ts +10 -0
- package/src/rsc/server-action.ts +16 -2
- package/src/server/context.ts +32 -0
- package/src/server/request-context.ts +47 -9
- package/src/types/loader-types.ts +6 -3
- package/src/urls/path-helper-types.ts +6 -0
- package/src/vite/discovery/prerender-collection.ts +5 -5
- package/src/vite/router-discovery.ts +3 -4
|
@@ -61,13 +61,6 @@ export interface PartialUpdateConfig {
|
|
|
61
61
|
) => Promise<ReactNode> | ReactNode;
|
|
62
62
|
/** RSC version getter — returns the current version (may change after HMR) */
|
|
63
63
|
getVersion?: () => string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Replace the active app-shell when a cross-app navigation is detected.
|
|
66
|
-
* Called before the full-update tree replacement renders, so the new
|
|
67
|
-
* payload's rootLayout, basename, and version are picked up. Theme,
|
|
68
|
-
* warmup, and prefetch TTL are not part of the shell — see AppShell.
|
|
69
|
-
*/
|
|
70
|
-
applyAppShell?: (next: import("./app-shell.js").AppShell) => void;
|
|
71
64
|
}
|
|
72
65
|
|
|
73
66
|
/**
|
|
@@ -137,7 +130,6 @@ export function createPartialUpdater(
|
|
|
137
130
|
onUpdate,
|
|
138
131
|
renderSegments,
|
|
139
132
|
getVersion = () => undefined,
|
|
140
|
-
applyAppShell,
|
|
141
133
|
} = config;
|
|
142
134
|
|
|
143
135
|
/**
|
|
@@ -245,30 +237,25 @@ export function createPartialUpdater(
|
|
|
245
237
|
streamingToken.end();
|
|
246
238
|
});
|
|
247
239
|
|
|
248
|
-
//
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
//
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
basename: payload.metadata.basename,
|
|
268
|
-
version: payload.metadata.version,
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
store.setRouterId?.(payload.metadata.routerId);
|
|
240
|
+
// Integrity guard (defense in depth). The server redirects on a cross-app
|
|
241
|
+
// routerId mismatch (X-RSC-Reload), so a partial payload's routerId must
|
|
242
|
+
// match this client's. If it doesn't — a stale/edge cache keyed without the
|
|
243
|
+
// routerId, a proxy mixing app responses, or a server classification bug —
|
|
244
|
+
// do NOT splice a foreign app's segments and client references into this
|
|
245
|
+
// document. Force a full reload so the server re-establishes the
|
|
246
|
+
// authoritative document for this URL.
|
|
247
|
+
const currentRouterId = store.getRouterId?.();
|
|
248
|
+
if (
|
|
249
|
+
payload.metadata?.routerId &&
|
|
250
|
+
currentRouterId &&
|
|
251
|
+
payload.metadata.routerId !== currentRouterId
|
|
252
|
+
) {
|
|
253
|
+
console.error(
|
|
254
|
+
`[rango] Partial response router id "${payload.metadata.routerId}" does not ` +
|
|
255
|
+
`match this client ("${currentRouterId}"); discarding it and reloading to re-sync.`,
|
|
256
|
+
);
|
|
257
|
+
window.location.href = url;
|
|
258
|
+
return;
|
|
272
259
|
}
|
|
273
260
|
|
|
274
261
|
// Handle server-side redirect with state
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prefetch Cache
|
|
3
3
|
*
|
|
4
|
-
* In-memory cache storing
|
|
5
|
-
* on subsequent navigation.
|
|
4
|
+
* In-memory cache storing eagerly-decoded prefetch payloads for instant,
|
|
5
|
+
* already-warm cache hits on subsequent navigation. A prefetch fetches the
|
|
6
|
+
* RSC partial AND decodes it (createFromFetch) up front — decoding the Flight
|
|
7
|
+
* stream resolves the route's client references, so the route's JS chunks are
|
|
8
|
+
* imported during prefetch rather than on click. The decoded payload is reused
|
|
9
|
+
* verbatim by navigation, so a prefetched click loads no new code. Two key
|
|
10
|
+
* scopes are in play:
|
|
6
11
|
* - Wildcard (default): built by `buildPrefetchKey(rangoState, target)` —
|
|
7
12
|
* shape `rangoState\0/target?...`. Shared across all source pages and
|
|
8
13
|
* invalidated automatically when Rango state bumps (deploy or
|
|
@@ -17,8 +22,8 @@
|
|
|
17
22
|
* from other pages.
|
|
18
23
|
*
|
|
19
24
|
* Also tracks in-flight prefetch promises. Each promise resolves to the
|
|
20
|
-
*
|
|
21
|
-
* still-downloading prefetch without
|
|
25
|
+
* decoded prefetch entry (or null), letting navigation adopt a
|
|
26
|
+
* still-downloading prefetch without issuing a duplicate request. A
|
|
22
27
|
* single promise can be registered under multiple alias keys (see
|
|
23
28
|
* `setInflightPromiseWithAliases`) so same-source navigations adopt via
|
|
24
29
|
* their source key while cross-source ones fall through to the wildcard
|
|
@@ -30,6 +35,31 @@
|
|
|
30
35
|
|
|
31
36
|
import { abortAllPrefetches } from "./queue.js";
|
|
32
37
|
import { invalidateRangoState } from "../rango-state.js";
|
|
38
|
+
import type { RscPayload } from "../types.js";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A prefetch that has been fetched AND eagerly decoded. Storing the decoded
|
|
42
|
+
* payload (not the raw Response) is what makes a prefetched navigation "warm":
|
|
43
|
+
* decoding the Flight stream during prefetch pulls the route's client chunks,
|
|
44
|
+
* so the click reuses ready elements and loads no new JS.
|
|
45
|
+
*/
|
|
46
|
+
export interface DecodedPrefetch {
|
|
47
|
+
/** The eagerly-decoded RSC payload. Reused verbatim by navigation. */
|
|
48
|
+
payload: Promise<RscPayload>;
|
|
49
|
+
/**
|
|
50
|
+
* Resolves when the underlying RSC stream finishes draining. Navigation
|
|
51
|
+
* forwards this as its streamComplete so scroll/revalidation gating is
|
|
52
|
+
* unchanged from the fresh-fetch path.
|
|
53
|
+
*/
|
|
54
|
+
streamComplete: Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Prefetch scope as tagged by the server via `X-RSC-Prefetch-Scope`.
|
|
57
|
+
* `"source"` means the response is source-page-sensitive and must not be
|
|
58
|
+
* reused by a navigation from a different page — navigation enforces this
|
|
59
|
+
* when it adopted an inflight entry through the wildcard key.
|
|
60
|
+
*/
|
|
61
|
+
scope: "source" | "wildcard";
|
|
62
|
+
}
|
|
33
63
|
|
|
34
64
|
// Default TTL: 5 minutes. Overridden by initPrefetchCache() with
|
|
35
65
|
// the server-configured prefetchCacheTTL from router options.
|
|
@@ -55,7 +85,7 @@ export function isPrefetchCacheDisabled(): boolean {
|
|
|
55
85
|
const MAX_PREFETCH_CACHE_SIZE = 50;
|
|
56
86
|
|
|
57
87
|
interface PrefetchCacheEntry {
|
|
58
|
-
|
|
88
|
+
entry: DecodedPrefetch;
|
|
59
89
|
timestamp: number;
|
|
60
90
|
}
|
|
61
91
|
|
|
@@ -63,20 +93,37 @@ const cache = new Map<string, PrefetchCacheEntry>();
|
|
|
63
93
|
const inflight = new Set<string>();
|
|
64
94
|
|
|
65
95
|
/**
|
|
66
|
-
* In-flight promise map. When a prefetch fetch is in progress, its
|
|
67
|
-
* Promise<
|
|
68
|
-
*
|
|
96
|
+
* In-flight promise map. When a prefetch fetch+decode is in progress, its
|
|
97
|
+
* Promise<DecodedPrefetch | null> is stored here so navigation can await it
|
|
98
|
+
* instead of starting a duplicate request. Resolves to null when the prefetch
|
|
99
|
+
* failed, was aborted, or carried a control header (reload/redirect) that the
|
|
100
|
+
* navigation must re-fetch to act on.
|
|
69
101
|
*/
|
|
70
|
-
const inflightPromises = new Map<string, Promise<
|
|
102
|
+
const inflightPromises = new Map<string, Promise<DecodedPrefetch | null>>();
|
|
71
103
|
|
|
72
104
|
/**
|
|
73
105
|
* Alias map for in-flight promises registered under multiple keys (see
|
|
74
106
|
* dual inflight in prefetch/fetch.ts). Records each key's sibling set so
|
|
75
107
|
* that consuming or clearing any one key atomically removes every alias —
|
|
76
|
-
* guaranteeing a single consumer for the shared
|
|
108
|
+
* guaranteeing a single consumer for the shared decode.
|
|
77
109
|
*/
|
|
78
110
|
const inflightAliases = new Map<string, string[]>();
|
|
79
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Keys whose in-flight prefetch promise was adopted by a navigation (via
|
|
114
|
+
* `consumeInflightPrefetch`). A `DecodedPrefetch` carries a single-use
|
|
115
|
+
* `metadata.handles` async generator; the adopter drains it. The same entry is
|
|
116
|
+
* also published to the `cache` map by `storePrefetch` when the fetch resolves
|
|
117
|
+
* — which runs AFTER adoption (adoption only succeeds while the fetch is still
|
|
118
|
+
* in flight, so the entry is not yet cached). Without this guard the adopted,
|
|
119
|
+
* now-drained entry would be left in the cache and served to a later navigation
|
|
120
|
+
* whose handle generator yields nothing, silently dropping that route's
|
|
121
|
+
* breadcrumbs. Recording the adopted keys lets `storePrefetch` skip publishing
|
|
122
|
+
* them, keeping the existing one-time-consumption contract (a consumed prefetch
|
|
123
|
+
* is gone; the next navigation re-fetches).
|
|
124
|
+
*/
|
|
125
|
+
const adoptedKeys = new Set<string>();
|
|
126
|
+
|
|
80
127
|
// Generation counter incremented on each clearPrefetchCache(). Fetches that
|
|
81
128
|
// started before a clear carry a stale generation and must not store their
|
|
82
129
|
// response (the data may be stale due to a server action invalidation).
|
|
@@ -152,14 +199,14 @@ export function hasPrefetch(key: string): boolean {
|
|
|
152
199
|
}
|
|
153
200
|
|
|
154
201
|
/**
|
|
155
|
-
* Consume a cached prefetch
|
|
156
|
-
* One-time consumption: the entry is deleted after retrieval.
|
|
202
|
+
* Consume a cached, eagerly-decoded prefetch. Returns null if not found or
|
|
203
|
+
* expired. One-time consumption: the entry is deleted after retrieval.
|
|
157
204
|
* Returns null when caching is disabled (TTL <= 0).
|
|
158
205
|
*
|
|
159
206
|
* Does NOT check in-flight prefetches — use consumeInflightPrefetch()
|
|
160
|
-
* for that (returns a Promise instead of a
|
|
207
|
+
* for that (returns a Promise instead of a resolved entry).
|
|
161
208
|
*/
|
|
162
|
-
export function consumePrefetch(key: string):
|
|
209
|
+
export function consumePrefetch(key: string): DecodedPrefetch | null {
|
|
163
210
|
if (cacheTTL <= 0) return null;
|
|
164
211
|
const entry = cache.get(key);
|
|
165
212
|
if (!entry) return null;
|
|
@@ -168,13 +215,14 @@ export function consumePrefetch(key: string): Response | null {
|
|
|
168
215
|
return null;
|
|
169
216
|
}
|
|
170
217
|
cache.delete(key);
|
|
171
|
-
return entry.
|
|
218
|
+
return entry.entry;
|
|
172
219
|
}
|
|
173
220
|
|
|
174
221
|
/**
|
|
175
222
|
* Consume an in-flight prefetch promise. Returns null if no prefetch is
|
|
176
|
-
* in-flight for this key. The returned Promise resolves to the
|
|
177
|
-
*
|
|
223
|
+
* in-flight for this key. The returned Promise resolves to the decoded
|
|
224
|
+
* prefetch entry (or null if the fetch failed/was aborted, or carried a
|
|
225
|
+
* control header the navigation must re-fetch to honor).
|
|
178
226
|
*
|
|
179
227
|
* One-time consumption: the promise entry is removed (along with any
|
|
180
228
|
* sibling aliases registered via `setInflightPromiseWithAliases`) so a
|
|
@@ -188,38 +236,51 @@ export function consumePrefetch(key: string): Response | null {
|
|
|
188
236
|
*/
|
|
189
237
|
export function consumeInflightPrefetch(
|
|
190
238
|
key: string,
|
|
191
|
-
): Promise<
|
|
239
|
+
): Promise<DecodedPrefetch | null> | null {
|
|
192
240
|
const promise = inflightPromises.get(key);
|
|
193
241
|
if (!promise) return null;
|
|
194
242
|
// Remove the promise under every alias so a second consumer cannot
|
|
195
|
-
// adopt the same stream and race on the body
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
|
|
243
|
+
// adopt the same stream and race on the body, and mark every alias as
|
|
244
|
+
// adopted so the pending `storePrefetch` (which resolves later, after this
|
|
245
|
+
// adoption) does not leave the now-owned, single-use entry in the cache map.
|
|
246
|
+
// `inflightAliases` is intentionally preserved — `clearPrefetchInflight()` in
|
|
247
|
+
// the fetch's `.finally()` still needs it to clear every inflight flag and
|
|
248
|
+
// adopted marker; deleting here would strand the sibling's flag forever.
|
|
249
|
+
forEachAlias(key, (k) => {
|
|
250
|
+
inflightPromises.delete(k);
|
|
251
|
+
adoptedKeys.add(k);
|
|
252
|
+
});
|
|
200
253
|
return promise;
|
|
201
254
|
}
|
|
202
255
|
|
|
203
256
|
/**
|
|
204
|
-
* Store
|
|
205
|
-
* The response should be a clone() of the original so the caller can
|
|
206
|
-
* still consume the body. The clone's body streams independently.
|
|
257
|
+
* Store an eagerly-decoded prefetch in the in-memory cache.
|
|
207
258
|
*
|
|
208
259
|
* Skips storage if the generation has changed since the fetch started
|
|
209
260
|
* (a server action invalidated the cache mid-flight).
|
|
210
261
|
*/
|
|
211
262
|
export function storePrefetch(
|
|
212
263
|
key: string,
|
|
213
|
-
|
|
264
|
+
entry: DecodedPrefetch,
|
|
214
265
|
fetchGeneration: number,
|
|
215
266
|
): void {
|
|
216
267
|
if (cacheTTL <= 0) return;
|
|
217
268
|
if (fetchGeneration !== generation) return;
|
|
218
269
|
|
|
270
|
+
// If a navigation already adopted this prefetch's in-flight promise, it owns
|
|
271
|
+
// the single-use entry (and has drained its handle generator). Do NOT also
|
|
272
|
+
// publish it to the cache map, or a later navigation would be served the
|
|
273
|
+
// exhausted entry and lose that route's handles. Clear the marker (under all
|
|
274
|
+
// aliases) now that the decision is made.
|
|
275
|
+
if (adoptedKeys.has(key)) {
|
|
276
|
+
forEachAlias(key, (k) => adoptedKeys.delete(k));
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
219
280
|
// Evict expired entries
|
|
220
281
|
const now = Date.now();
|
|
221
|
-
for (const [k,
|
|
222
|
-
if (now -
|
|
282
|
+
for (const [k, cached] of cache) {
|
|
283
|
+
if (now - cached.timestamp > cacheTTL) {
|
|
223
284
|
cache.delete(k);
|
|
224
285
|
}
|
|
225
286
|
}
|
|
@@ -230,7 +291,7 @@ export function storePrefetch(
|
|
|
230
291
|
if (oldest) cache.delete(oldest);
|
|
231
292
|
}
|
|
232
293
|
|
|
233
|
-
cache.set(key, {
|
|
294
|
+
cache.set(key, { entry, timestamp: now });
|
|
234
295
|
}
|
|
235
296
|
|
|
236
297
|
/**
|
|
@@ -250,7 +311,7 @@ export function markPrefetchInflight(key: string): void {
|
|
|
250
311
|
*/
|
|
251
312
|
export function setInflightPromise(
|
|
252
313
|
key: string,
|
|
253
|
-
promise: Promise<
|
|
314
|
+
promise: Promise<DecodedPrefetch | null>,
|
|
254
315
|
): void {
|
|
255
316
|
inflightPromises.set(key, promise);
|
|
256
317
|
}
|
|
@@ -263,7 +324,7 @@ export function setInflightPromise(
|
|
|
263
324
|
*/
|
|
264
325
|
export function setInflightPromiseWithAliases(
|
|
265
326
|
keys: string[],
|
|
266
|
-
promise: Promise<
|
|
327
|
+
promise: Promise<DecodedPrefetch | null>,
|
|
267
328
|
): void {
|
|
268
329
|
for (const k of keys) {
|
|
269
330
|
inflightPromises.set(k, promise);
|
|
@@ -276,6 +337,9 @@ export function clearPrefetchInflight(key: string): void {
|
|
|
276
337
|
inflight.delete(k);
|
|
277
338
|
inflightPromises.delete(k);
|
|
278
339
|
inflightAliases.delete(k);
|
|
340
|
+
// Clear any adopted marker too, so a fetch that failed before storePrefetch
|
|
341
|
+
// (the marker's normal consumer) does not strand it across the next prefetch.
|
|
342
|
+
adoptedKeys.delete(k);
|
|
279
343
|
});
|
|
280
344
|
}
|
|
281
345
|
|
|
@@ -292,23 +356,8 @@ export function clearPrefetchCache(): void {
|
|
|
292
356
|
inflight.clear();
|
|
293
357
|
inflightPromises.clear();
|
|
294
358
|
inflightAliases.clear();
|
|
359
|
+
adoptedKeys.clear();
|
|
295
360
|
cache.clear();
|
|
296
361
|
abortAllPrefetches();
|
|
297
362
|
invalidateRangoState();
|
|
298
363
|
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Drop all in-memory prefetch state for this tab without rotating rango-state.
|
|
302
|
-
*
|
|
303
|
-
* Use for local-only invalidations (e.g. app switch in this tab) where
|
|
304
|
-
* other tabs should NOT observe a state rotation. Unlike clearPrefetchCache,
|
|
305
|
-
* does not call invalidateRangoState, so the shared X-Rango-State token
|
|
306
|
-
* stays intact and siblings in the old app keep their prefetches.
|
|
307
|
-
*/
|
|
308
|
-
export function clearPrefetchCacheLocal(): void {
|
|
309
|
-
generation++;
|
|
310
|
-
inflight.clear();
|
|
311
|
-
inflightPromises.clear();
|
|
312
|
-
cache.clear();
|
|
313
|
-
abortAllPrefetches();
|
|
314
|
-
}
|
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Fetch-based prefetch logic used by Link (hover/viewport/render strategies)
|
|
5
5
|
* and useRouter().prefetch(). Sends the same headers and segment IDs as a
|
|
6
|
-
* real navigation so the server returns a proper diff. The
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* real navigation so the server returns a proper diff. The response is fetched
|
|
7
|
+
* AND eagerly decoded (createFromFetch) up front: decoding the Flight stream
|
|
8
|
+
* resolves the route's client references, so the route's JS chunks are imported
|
|
9
|
+
* during prefetch rather than on click. The decoded payload is stored in an
|
|
10
|
+
* in-memory cache and reused verbatim by navigation, so a prefetched click
|
|
11
|
+
* loads no new code.
|
|
9
12
|
*
|
|
10
13
|
* In-flight promises are tracked in the cache so that navigation can reuse
|
|
11
|
-
* a prefetch that is still downloading instead of starting a
|
|
14
|
+
* a prefetch that is still downloading/decoding instead of starting a
|
|
15
|
+
* duplicate request.
|
|
12
16
|
*/
|
|
13
17
|
|
|
14
18
|
import {
|
|
@@ -20,11 +24,34 @@ import {
|
|
|
20
24
|
storePrefetch,
|
|
21
25
|
clearPrefetchInflight,
|
|
22
26
|
currentGeneration,
|
|
27
|
+
type DecodedPrefetch,
|
|
23
28
|
} from "./cache.js";
|
|
24
29
|
import { getRangoState } from "../rango-state.js";
|
|
25
30
|
import { enqueuePrefetch } from "./queue.js";
|
|
26
31
|
import { shouldPrefetch } from "./policy.js";
|
|
27
32
|
import { debugLog } from "../logging.js";
|
|
33
|
+
import { teeWithCompletion, isForeignRouterId } from "../response-adapter.js";
|
|
34
|
+
import type { RscPayload } from "../types.js";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Decoder injected at app startup (see setPrefetchDecoder). This is
|
|
38
|
+
* `deps.createFromFetch` — decoupled from the RSC runtime exactly like the
|
|
39
|
+
* navigation client. Prefetch decodes through it so the route's client chunks
|
|
40
|
+
* are pulled during the prefetch, not on click.
|
|
41
|
+
*/
|
|
42
|
+
type PrefetchDecoder = (response: Promise<Response>) => Promise<RscPayload>;
|
|
43
|
+
|
|
44
|
+
let decoder: PrefetchDecoder | null = null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Wire the RSC decoder used to eagerly decode prefetched responses. Called
|
|
48
|
+
* once from initBrowserApp with the same createFromFetch the navigation client
|
|
49
|
+
* uses. Until set, prefetch warming is inert (prefetches are skipped) — the
|
|
50
|
+
* browser app always sets it before any Link can fire.
|
|
51
|
+
*/
|
|
52
|
+
export function setPrefetchDecoder(fn: PrefetchDecoder): void {
|
|
53
|
+
decoder = fn;
|
|
54
|
+
}
|
|
28
55
|
|
|
29
56
|
/**
|
|
30
57
|
* Check if a URL resolves to the current page (same pathname + search).
|
|
@@ -78,39 +105,50 @@ function buildPrefetchUrl(
|
|
|
78
105
|
}
|
|
79
106
|
|
|
80
107
|
/**
|
|
81
|
-
* Core prefetch fetch logic. Fetches the response,
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* reuse an in-flight prefetch via
|
|
108
|
+
* Core prefetch fetch logic. Fetches the response, eagerly decodes it, and
|
|
109
|
+
* stores the decoded payload in the in-memory cache. The returned Promise
|
|
110
|
+
* resolves to the decoded entry (or null on failure / control header) so
|
|
111
|
+
* navigation can safely reuse an in-flight prefetch via
|
|
112
|
+
* consumeInflightPrefetch().
|
|
113
|
+
*
|
|
114
|
+
* Eager decode is the warming step: createFromFetch parses the Flight stream,
|
|
115
|
+
* which resolves the route's client references and imports its JS chunks. The
|
|
116
|
+
* stored payload is reused as-is by navigation, so the click loads no new code.
|
|
117
|
+
*
|
|
118
|
+
* Control headers are NOT acted on here. A speculative prefetch must never
|
|
119
|
+
* reload the page or throw a redirect — if the response carries X-RSC-Reload
|
|
120
|
+
* or X-RSC-Redirect, we drop it (resolve null) and let the real navigation
|
|
121
|
+
* re-fetch and honor it.
|
|
85
122
|
*
|
|
86
123
|
* Inflight + storage key selection:
|
|
87
124
|
*
|
|
88
125
|
* - `forceSourceScope` (Link opted in with `prefetchKey=":source"`): single
|
|
89
|
-
* inflight registration under `sourceKey`;
|
|
90
|
-
*
|
|
126
|
+
* inflight registration under `sourceKey`; entry stored under `sourceKey`.
|
|
127
|
+
* No wildcard leak is possible.
|
|
91
128
|
*
|
|
92
129
|
* - Otherwise: dual inflight registration under both `wildcardKey` and
|
|
93
130
|
* `sourceKey` so same-source navigations adopt directly via their own
|
|
94
131
|
* source key. Storage key is chosen at response time from the
|
|
95
132
|
* `X-RSC-Prefetch-Scope` header — `"source"` → `sourceKey` (intercept
|
|
96
|
-
* modals etc.), anything else → `wildcardKey`.
|
|
97
|
-
* that adopted via `wildcardKey`
|
|
98
|
-
*
|
|
133
|
+
* modals etc.), anything else → `wildcardKey`. The entry records its scope
|
|
134
|
+
* so cross-source navigations that adopted via `wildcardKey` can bail out
|
|
135
|
+
* in `navigation-client.ts` when the adopted entry turns out source-scoped.
|
|
99
136
|
*/
|
|
100
137
|
function executePrefetchFetch(
|
|
101
138
|
wildcardKey: string,
|
|
102
139
|
sourceKey: string,
|
|
103
140
|
fetchUrl: string,
|
|
104
141
|
forceSourceScope: boolean,
|
|
142
|
+
expectedRouterId?: string,
|
|
105
143
|
signal?: AbortSignal,
|
|
106
|
-
): Promise<
|
|
144
|
+
): Promise<DecodedPrefetch | null> {
|
|
107
145
|
const gen = currentGeneration();
|
|
108
146
|
const inflightKeys = forceSourceScope
|
|
109
147
|
? [sourceKey]
|
|
110
148
|
: [wildcardKey, sourceKey];
|
|
111
149
|
for (const k of inflightKeys) markPrefetchInflight(k);
|
|
112
150
|
|
|
113
|
-
const promise: Promise<
|
|
151
|
+
const promise: Promise<DecodedPrefetch | null> = fetch(fetchUrl, {
|
|
114
152
|
priority: "low" as RequestPriority,
|
|
115
153
|
signal,
|
|
116
154
|
headers: {
|
|
@@ -120,25 +158,53 @@ function executePrefetchFetch(
|
|
|
120
158
|
},
|
|
121
159
|
})
|
|
122
160
|
.then((response) => {
|
|
123
|
-
if (!response.ok) return null;
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
statusText: response.statusText,
|
|
132
|
-
};
|
|
133
|
-
let storageKey: string;
|
|
134
|
-
if (forceSourceScope) {
|
|
135
|
-
storageKey = sourceKey;
|
|
136
|
-
} else {
|
|
137
|
-
const scope = response.headers.get("x-rsc-prefetch-scope");
|
|
138
|
-
storageKey = scope === "source" ? sourceKey : wildcardKey;
|
|
161
|
+
if (!response.ok || !decoder) return null;
|
|
162
|
+
// Control headers mean this response is stale (reload) or redirecting.
|
|
163
|
+
// Don't warm it — drop so navigation re-fetches and acts on the header.
|
|
164
|
+
if (
|
|
165
|
+
response.headers.has("X-RSC-Reload") ||
|
|
166
|
+
response.headers.has("X-RSC-Redirect")
|
|
167
|
+
) {
|
|
168
|
+
return null;
|
|
139
169
|
}
|
|
140
|
-
|
|
141
|
-
|
|
170
|
+
// Integrity check: never warm (or decode/import the chunks of) a foreign
|
|
171
|
+
// app's payload. A speculative prefetch must never reload — just drop it;
|
|
172
|
+
// navigation re-fetches and the server steers it.
|
|
173
|
+
if (isForeignRouterId(response, expectedRouterId)) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const scope: "source" | "wildcard" =
|
|
178
|
+
forceSourceScope ||
|
|
179
|
+
response.headers.get("x-rsc-prefetch-scope") === "source"
|
|
180
|
+
? "source"
|
|
181
|
+
: "wildcard";
|
|
182
|
+
const storageKey = scope === "source" ? sourceKey : wildcardKey;
|
|
183
|
+
|
|
184
|
+
// Track stream completion off a tee so navigation's scroll/revalidation
|
|
185
|
+
// gating matches the fresh-fetch path; decode the other branch.
|
|
186
|
+
let resolveStreamComplete!: () => void;
|
|
187
|
+
const streamComplete = new Promise<void>((resolve) => {
|
|
188
|
+
resolveStreamComplete = resolve;
|
|
189
|
+
});
|
|
190
|
+
const tracked = teeWithCompletion(
|
|
191
|
+
response,
|
|
192
|
+
() => resolveStreamComplete(),
|
|
193
|
+
signal,
|
|
194
|
+
// Speculative prefetch: a never-consumed/aborted stream error is benign.
|
|
195
|
+
true,
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
// Eager decode: parsing the Flight stream imports the route's client
|
|
199
|
+
// chunks now, not on click.
|
|
200
|
+
const payload = decoder(Promise.resolve(tracked));
|
|
201
|
+
// Mark handled so an unconsumed prefetch decode error stays quiet; the
|
|
202
|
+
// error is still surfaced to navigation if it consumes the entry.
|
|
203
|
+
payload.catch(() => {});
|
|
204
|
+
|
|
205
|
+
const entry: DecodedPrefetch = { payload, streamComplete, scope };
|
|
206
|
+
storePrefetch(storageKey, entry, gen);
|
|
207
|
+
return entry;
|
|
142
208
|
})
|
|
143
209
|
.catch(() => null)
|
|
144
210
|
.finally(() => {
|
|
@@ -223,6 +289,7 @@ export function prefetchDirect(
|
|
|
223
289
|
sourceKey,
|
|
224
290
|
targetUrl.toString(),
|
|
225
291
|
forceSourceScope,
|
|
292
|
+
routerId,
|
|
226
293
|
);
|
|
227
294
|
}
|
|
228
295
|
|
|
@@ -275,6 +342,7 @@ export function prefetchQueued(
|
|
|
275
342
|
sourceKey,
|
|
276
343
|
fetchUrlStr,
|
|
277
344
|
forceSourceScope,
|
|
345
|
+
routerId,
|
|
278
346
|
signal,
|
|
279
347
|
).then(() => {});
|
|
280
348
|
});
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* Storage key is namespaced per routerId (`rango-state:{routerId}`) so
|
|
14
14
|
* tabs in different apps on the same origin do not collide. Two tabs in
|
|
15
15
|
* the same app share a key → one tab's invalidation is picked up by the
|
|
16
|
-
* other via the `storage` event.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* other via the `storage` event. The key is bound once at document init; a
|
|
17
|
+
* cross-app navigation is a full document load (X-RSC-Reload), so the target
|
|
18
|
+
* app's document binds its own key on load (tabs in the old app keep theirs).
|
|
19
19
|
*
|
|
20
20
|
* If no routerId is supplied, falls back to a single legacy key for
|
|
21
21
|
* backward compatibility (single-app deployments unaffected).
|
|
@@ -31,10 +31,9 @@ function buildStorageKey(routerId: string | undefined): string {
|
|
|
31
31
|
// Initialized from localStorage on first access or by initRangoState().
|
|
32
32
|
let cachedState: string | null = null;
|
|
33
33
|
|
|
34
|
-
// The localStorage key this tab is currently bound to.
|
|
35
|
-
// initRangoState (document boot)
|
|
36
|
-
//
|
|
37
|
-
// events from tabs in a different app are ignored.
|
|
34
|
+
// The localStorage key this tab is currently bound to. Bound on
|
|
35
|
+
// initRangoState (document boot). The storage listener filters cross-tab
|
|
36
|
+
// events by this key so events from tabs in a different app are ignored.
|
|
38
37
|
let currentStorageKey: string = LEGACY_STORAGE_KEY;
|
|
39
38
|
|
|
40
39
|
// Cross-tab sync: the `storage` event fires in OTHER tabs when one tab writes
|
|
@@ -114,21 +113,6 @@ export function getRangoState(): string {
|
|
|
114
113
|
return "0:0";
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
/**
|
|
118
|
-
* Update the in-memory rango-state to a new version WITHOUT writing
|
|
119
|
-
* localStorage. Intended for smooth cross-app transitions in this tab only:
|
|
120
|
-
* subsequent requests from this tab send the new token, but other tabs
|
|
121
|
-
* still in the previous app do not observe a storage event. Rebinds this
|
|
122
|
-
* tab's storage key to the target app's namespace (`rango-state:{routerId}`)
|
|
123
|
-
* so subsequent storage events only reflect the new app. On the next hard
|
|
124
|
-
* reload, initRangoState reconciles localStorage from the server's
|
|
125
|
-
* authoritative version.
|
|
126
|
-
*/
|
|
127
|
-
export function setRangoStateLocal(version: string, routerId?: string): void {
|
|
128
|
-
currentStorageKey = buildStorageKey(routerId);
|
|
129
|
-
cachedState = `${version}:${Date.now()}`;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
116
|
/**
|
|
133
117
|
* Invalidate the Rango state key. Called when server actions mutate data.
|
|
134
118
|
* Updates the timestamp portion while keeping the version prefix.
|
|
@@ -157,9 +157,11 @@ export interface NavigationProviderProps {
|
|
|
157
157
|
basename?: string;
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
160
|
+
* App-shell ref. When provided, the context's `basename` and `version` are
|
|
161
|
+
* read through it (live getters) so they don't close over a stale snapshot or
|
|
162
|
+
* invalidate the memoized context value. The shell is set once at init and is
|
|
163
|
+
* not swapped within a session — a cross-app navigation is a full document
|
|
164
|
+
* load (X-RSC-Reload), so the target app establishes its own shell on load.
|
|
163
165
|
*/
|
|
164
166
|
appShellRef?: AppShellRef;
|
|
165
167
|
}
|
|
@@ -218,8 +220,9 @@ export function NavigationProvider({
|
|
|
218
220
|
}, []);
|
|
219
221
|
|
|
220
222
|
// basename/version are always read through a shell ref so the context value
|
|
221
|
-
// has a single shape: a supplied appShellRef
|
|
222
|
-
//
|
|
223
|
+
// has a single shape. Both are set once: a supplied appShellRef is seeded
|
|
224
|
+
// from the init payload (a cross-app navigation reloads, so it is not swapped
|
|
225
|
+
// in-session), and the standalone fallback wraps the mount-time props.
|
|
223
226
|
const fallbackShellRef = useRef<AppShellRef | null>(null);
|
|
224
227
|
if (!fallbackShellRef.current) {
|
|
225
228
|
fallbackShellRef.current = createAppShellRef({ basename, version });
|
|
@@ -436,10 +439,10 @@ export function NavigationProvider({
|
|
|
436
439
|
let content = <RootErrorBoundary>{root}</RootErrorBoundary>;
|
|
437
440
|
|
|
438
441
|
// Wrap with ThemeProvider when theme is enabled. The ThemeProvider is
|
|
439
|
-
// document-lifetime: its config comes from the initial load and
|
|
440
|
-
//
|
|
441
|
-
//
|
|
442
|
-
//
|
|
442
|
+
// document-lifetime: its config comes from the initial load and persists for
|
|
443
|
+
// the session. It sits above the segment tree and is not remounted in-session;
|
|
444
|
+
// a cross-app navigation is a full document load (X-RSC-Reload), so the target
|
|
445
|
+
// app's theme config takes effect on its own load.
|
|
443
446
|
if (themeConfig) {
|
|
444
447
|
content = (
|
|
445
448
|
<ThemeProvider config={themeConfig} initialTheme={initialTheme}>
|
|
@@ -13,9 +13,10 @@ import type { RouterInstance, RouterNavigateOptions } from "../types.js";
|
|
|
13
13
|
* useRouter() do not re-render on navigation state changes.
|
|
14
14
|
* For reactive navigation state, use useNavigation() instead.
|
|
15
15
|
*
|
|
16
|
-
* Methods read `basename` from the
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Methods read `basename` from the context on each call. It is set once from
|
|
17
|
+
* the initial payload and is stable within a session — a cross-app navigation
|
|
18
|
+
* is a full document load (X-RSC-Reload), so the target app mounts fresh with
|
|
19
|
+
* its own basename.
|
|
19
20
|
*
|
|
20
21
|
* @example
|
|
21
22
|
* ```tsx
|