@rangojs/router 0.0.0-experimental.2 → 0.0.0-experimental.21
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/AGENTS.md +5 -0
- package/README.md +850 -4
- 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/{src/__mocks__/version.ts → dist/__mocks__/version.js} +1 -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 +1601 -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/{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 +4630 -749
- 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/{src/vite/virtual-entries.ts → dist/vite/virtual-entries.js} +18 -17
- package/dist/vite/virtual-entries.js.map +1 -0
- package/package.json +82 -46
- package/skills/cache-guide/SKILL.md +262 -0
- package/skills/caching/SKILL.md +139 -238
- package/skills/composability/SKILL.md +172 -0
- package/skills/debug-manifest/SKILL.md +112 -0
- package/skills/document-cache/SKILL.md +87 -57
- package/skills/fonts/SKILL.md +167 -0
- package/skills/hooks/SKILL.md +403 -60
- package/skills/intercept/SKILL.md +224 -203
- package/skills/layout/SKILL.md +243 -149
- package/skills/links/SKILL.md +239 -0
- package/skills/loader/SKILL.md +444 -253
- package/skills/middleware/SKILL.md +222 -325
- package/skills/mime-routes/SKILL.md +128 -0
- package/skills/parallel/SKILL.md +220 -170
- package/skills/prerender/SKILL.md +643 -0
- package/skills/rango/SKILL.md +119 -0
- package/skills/response-routes/SKILL.md +411 -0
- package/skills/route/SKILL.md +334 -89
- package/skills/router-setup/SKILL.md +305 -274
- package/skills/tailwind/SKILL.md +129 -0
- package/skills/testing/SKILL.md +226 -0
- package/skills/theme/SKILL.md +36 -11
- package/skills/typesafety/SKILL.md +437 -168
- package/skills/use-cache/SKILL.md +324 -0
- package/src/__internal.ts +181 -0
- package/src/bin/rango.ts +321 -0
- package/src/browser/action-coordinator.ts +97 -0
- package/src/browser/action-response-classifier.ts +99 -0
- package/src/browser/event-controller.ts +87 -64
- package/src/browser/history-state.ts +80 -0
- package/src/browser/intercept-utils.ts +52 -0
- package/src/browser/link-interceptor.ts +20 -4
- package/src/browser/logging.ts +55 -0
- package/src/browser/merge-segment-loaders.ts +20 -12
- package/src/browser/navigation-bridge.ts +217 -549
- package/src/browser/navigation-client.ts +74 -46
- package/src/browser/navigation-store.ts +33 -50
- package/src/browser/navigation-transaction.ts +295 -0
- package/src/browser/network-error-handler.ts +61 -0
- package/src/browser/partial-update.ts +288 -297
- package/src/browser/prefetch/cache.ts +67 -0
- package/src/browser/prefetch/fetch.ts +137 -0
- package/src/browser/prefetch/observer.ts +65 -0
- package/src/browser/prefetch/policy.ts +42 -0
- package/src/browser/prefetch/queue.ts +88 -0
- package/src/browser/rango-state.ts +112 -0
- package/src/browser/react/Link.tsx +173 -73
- package/src/browser/react/NavigationProvider.tsx +138 -27
- package/src/browser/react/context.ts +6 -0
- package/src/browser/react/filter-segment-order.ts +11 -0
- package/src/browser/react/index.ts +12 -12
- package/src/browser/react/location-state-shared.ts +95 -53
- package/src/browser/react/location-state.ts +60 -15
- package/src/browser/react/mount-context.ts +37 -0
- 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 +29 -51
- package/src/browser/react/use-client-cache.ts +5 -3
- package/src/browser/react/use-handle.ts +49 -65
- package/src/browser/react/use-href.tsx +20 -188
- package/src/browser/react/use-link-status.ts +6 -5
- package/src/browser/react/use-mount.ts +31 -0
- package/src/browser/react/use-navigation.ts +27 -78
- package/src/browser/react/use-params.ts +65 -0
- package/src/browser/react/use-pathname.ts +47 -0
- package/src/browser/react/use-router.ts +63 -0
- package/src/browser/react/use-search-params.ts +56 -0
- package/src/browser/react/use-segments.ts +80 -97
- package/src/browser/response-adapter.ts +73 -0
- package/src/browser/rsc-router.tsx +104 -34
- package/src/browser/scroll-restoration.ts +92 -16
- package/src/browser/segment-reconciler.ts +216 -0
- package/src/browser/segment-structure-assert.ts +83 -0
- package/src/browser/server-action-bridge.ts +504 -584
- package/src/browser/shallow.ts +6 -1
- package/src/browser/types.ts +107 -57
- package/src/browser/validate-redirect-origin.ts +29 -0
- package/src/build/generate-manifest.ts +438 -0
- package/src/build/generate-route-types.ts +36 -0
- package/src/build/index.ts +35 -0
- package/src/build/route-trie.ts +249 -0
- package/src/build/route-types/ast-helpers.ts +25 -0
- package/src/build/route-types/ast-route-extraction.ts +98 -0
- package/src/build/route-types/codegen.ts +102 -0
- package/src/build/route-types/include-resolution.ts +411 -0
- package/src/build/route-types/param-extraction.ts +48 -0
- package/src/build/route-types/per-module-writer.ts +128 -0
- package/src/build/route-types/router-processing.ts +469 -0
- package/src/build/route-types/scan-filter.ts +78 -0
- package/src/build/runtime-discovery.ts +231 -0
- 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 +338 -0
- package/src/cache/cache-scope.ts +120 -303
- package/src/cache/cf/cf-cache-store.ts +119 -7
- package/src/cache/cf/index.ts +8 -2
- package/src/cache/document-cache.ts +101 -72
- package/src/cache/handle-capture.ts +81 -0
- package/src/cache/handle-snapshot.ts +41 -0
- package/src/cache/index.ts +0 -15
- package/src/cache/memory-segment-store.ts +191 -13
- package/src/cache/profile-registry.ts +73 -0
- package/src/cache/read-through-swr.ts +134 -0
- package/src/cache/segment-codec.ts +256 -0
- package/src/cache/taint.ts +98 -0
- package/src/cache/types.ts +76 -121
- package/src/client.rsc.tsx +10 -14
- package/src/client.tsx +114 -89
- package/src/component-utils.ts +4 -4
- package/src/components/DefaultDocument.tsx +6 -2
- package/src/context-var.ts +86 -0
- package/src/debug.ts +243 -0
- package/src/errors.ts +108 -2
- package/src/handle.ts +34 -19
- package/src/handles/MetaTags.tsx +76 -23
- package/src/handles/meta.ts +32 -15
- package/src/host/cookie-handler.ts +165 -0
- package/src/host/errors.ts +97 -0
- package/src/host/index.ts +56 -0
- package/src/host/pattern-matcher.ts +214 -0
- package/src/host/router.ts +352 -0
- package/src/host/testing.ts +79 -0
- package/src/host/types.ts +146 -0
- package/src/host/utils.ts +25 -0
- package/src/href-client.ts +141 -47
- package/src/index.rsc.ts +209 -23
- package/src/index.ts +256 -32
- package/src/internal-debug.ts +11 -0
- package/src/loader.rsc.ts +27 -142
- package/src/loader.ts +27 -10
- package/src/network-error-thrower.tsx +3 -1
- package/src/outlet-provider.tsx +45 -0
- package/src/prerender/param-hash.ts +37 -0
- package/src/prerender/store.ts +185 -0
- package/src/prerender.ts +463 -0
- package/src/reverse.ts +330 -0
- package/src/root-error-boundary.tsx +41 -29
- package/src/route-content-wrapper.tsx +9 -11
- package/src/route-definition/dsl-helpers.ts +934 -0
- package/src/route-definition/helper-factories.ts +200 -0
- package/src/route-definition/helpers-types.ts +430 -0
- package/src/route-definition/index.ts +55 -0
- package/src/route-definition/redirect.ts +93 -0
- package/src/route-definition/route-function.ts +119 -0
- package/src/route-definition.ts +1 -1371
- package/src/route-map-builder.ts +241 -112
- package/src/route-name.ts +53 -0
- package/src/route-types.ts +70 -9
- package/src/router/content-negotiation.ts +116 -0
- package/src/router/debug-manifest.ts +72 -0
- package/src/router/error-handling.ts +9 -9
- package/src/router/find-match.ts +158 -0
- package/src/router/handler-context.ts +348 -82
- package/src/router/intercept-resolution.ts +395 -0
- package/src/router/lazy-includes.ts +234 -0
- package/src/router/loader-resolution.ts +215 -121
- package/src/router/logging.ts +248 -0
- package/src/router/manifest.ts +172 -43
- package/src/router/match-api.ts +620 -0
- package/src/router/match-context.ts +6 -4
- package/src/router/match-handlers.ts +440 -0
- package/src/router/match-middleware/background-revalidation.ts +80 -93
- package/src/router/match-middleware/cache-lookup.ts +382 -9
- package/src/router/match-middleware/cache-store.ts +51 -22
- package/src/router/match-middleware/intercept-resolution.ts +55 -17
- package/src/router/match-middleware/segment-resolution.ts +24 -6
- package/src/router/match-pipelines.ts +10 -45
- package/src/router/match-result.ts +34 -20
- package/src/router/metrics.ts +3 -3
- package/src/router/middleware-cookies.ts +55 -0
- package/src/router/middleware-types.ts +179 -0
- package/src/router/middleware.ts +239 -328
- package/src/router/pattern-matching.ts +302 -26
- package/src/router/prerender-match.ts +398 -0
- package/src/router/preview-match.ts +170 -0
- package/src/router/revalidation.ts +112 -33
- package/src/router/router-context.ts +40 -23
- package/src/router/router-interfaces.ts +439 -0
- package/src/router/router-options.ts +587 -0
- package/src/router/router-registry.ts +24 -0
- package/src/router/segment-resolution/fresh.ts +552 -0
- package/src/router/segment-resolution/helpers.ts +263 -0
- package/src/router/segment-resolution/loader-cache.ts +198 -0
- package/src/router/segment-resolution/revalidation.ts +1226 -0
- package/src/router/segment-resolution/static-store.ts +67 -0
- package/src/router/segment-resolution.ts +21 -0
- package/src/router/segment-wrappers.ts +289 -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 +221 -0
- package/src/router/types.ts +78 -4
- package/src/router.ts +672 -3566
- package/src/rsc/handler-context.ts +45 -0
- package/src/rsc/handler.ts +691 -757
- package/src/rsc/helpers.ts +140 -6
- package/src/rsc/index.ts +5 -5
- package/src/rsc/loader-fetch.ts +209 -0
- package/src/rsc/manifest-init.ts +86 -0
- package/src/rsc/nonce.ts +14 -0
- package/src/rsc/origin-guard.ts +141 -0
- package/src/rsc/progressive-enhancement.ts +366 -0
- package/src/rsc/response-error.ts +37 -0
- package/src/rsc/response-route-handler.ts +347 -0
- package/src/rsc/rsc-rendering.ts +250 -0
- package/src/rsc/runtime-warnings.ts +42 -0
- package/src/rsc/server-action.ts +344 -0
- package/src/rsc/types.ts +38 -14
- package/src/search-params.ts +227 -0
- package/src/segment-system.tsx +59 -61
- package/src/server/context.ts +217 -49
- package/src/server/cookie-store.ts +190 -0
- package/src/server/fetchable-loader-store.ts +37 -0
- package/src/server/handle-store.ts +98 -20
- package/src/server/loader-registry.ts +15 -56
- package/src/server/request-context.ts +406 -65
- package/src/server.ts +32 -133
- package/src/ssr/index.tsx +157 -26
- package/src/static-handler.ts +114 -0
- package/src/theme/ThemeProvider.tsx +21 -15
- package/src/theme/ThemeScript.tsx +5 -5
- package/src/theme/constants.ts +11 -4
- package/src/theme/index.ts +6 -7
- package/src/theme/theme-context.ts +5 -31
- package/src/theme/theme-script.ts +21 -18
- package/src/theme/types.ts +1 -1
- package/src/types/boundaries.ts +158 -0
- package/src/types/cache-types.ts +198 -0
- package/src/types/error-types.ts +192 -0
- package/src/types/global-namespace.ts +100 -0
- package/src/types/handler-context.ts +691 -0
- package/src/types/index.ts +88 -0
- package/src/types/loader-types.ts +183 -0
- package/src/types/route-config.ts +161 -0
- package/src/types/route-entry.ts +102 -0
- package/src/types/segments.ts +153 -0
- package/src/types.ts +1 -1561
- package/src/urls/include-helper.ts +197 -0
- package/src/urls/index.ts +53 -0
- package/src/urls/path-helper-types.ts +339 -0
- package/src/urls/path-helper.ts +329 -0
- package/src/urls/pattern-types.ts +95 -0
- package/src/urls/response-types.ts +106 -0
- package/src/urls/type-extraction.ts +372 -0
- package/src/urls/urls-function.ts +98 -0
- package/src/urls.ts +1 -726
- package/src/use-loader.tsx +85 -77
- package/src/vite/discovery/bundle-postprocess.ts +184 -0
- package/src/vite/discovery/discover-routers.ts +345 -0
- package/src/vite/discovery/prerender-collection.ts +385 -0
- package/src/vite/discovery/route-types-writer.ts +258 -0
- package/src/vite/discovery/self-gen-tracking.ts +47 -0
- package/src/vite/discovery/state.ts +110 -0
- package/src/vite/discovery/virtual-module-codegen.ts +203 -0
- package/src/vite/index.ts +10 -782
- package/src/vite/plugin-types.ts +131 -0
- package/src/vite/plugins/cjs-to-esm.ts +93 -0
- package/src/vite/plugins/client-ref-dedup.ts +115 -0
- package/src/vite/plugins/client-ref-hashing.ts +105 -0
- package/src/vite/{expose-action-id.ts → plugins/expose-action-id.ts} +72 -51
- package/src/vite/plugins/expose-id-utils.ts +287 -0
- package/src/vite/plugins/expose-ids/export-analysis.ts +296 -0
- package/src/vite/plugins/expose-ids/handler-transform.ts +179 -0
- package/src/vite/plugins/expose-ids/loader-transform.ts +74 -0
- package/src/vite/plugins/expose-ids/router-transform.ts +110 -0
- package/src/vite/plugins/expose-ids/types.ts +45 -0
- package/src/vite/plugins/expose-internal-ids.ts +569 -0
- package/src/vite/plugins/use-cache-transform.ts +323 -0
- package/src/vite/plugins/version-injector.ts +83 -0
- package/src/vite/plugins/version-plugin.ts +254 -0
- package/src/vite/plugins/virtual-entries.ts +123 -0
- package/src/vite/plugins/virtual-stub-plugin.ts +29 -0
- package/src/vite/rango.ts +510 -0
- package/src/vite/router-discovery.ts +785 -0
- package/src/vite/utils/ast-handler-extract.ts +517 -0
- package/src/vite/utils/banner.ts +36 -0
- package/src/vite/utils/bundle-analysis.ts +137 -0
- package/src/vite/utils/manifest-utils.ts +70 -0
- package/src/vite/{package-resolution.ts → utils/package-resolution.ts} +25 -29
- package/src/vite/utils/prerender-utils.ts +189 -0
- package/src/vite/utils/shared-utils.ts +169 -0
- package/CLAUDE.md +0 -7
- package/src/__tests__/component-utils.test.ts +0 -76
- package/src/__tests__/route-definition.test.ts +0 -63
- package/src/__tests__/urls.test.tsx +0 -436
- package/src/browser/lru-cache.ts +0 -69
- package/src/browser/request-controller.ts +0 -164
- package/src/cache/__tests__/document-cache.test.ts +0 -522
- package/src/cache/__tests__/memory-segment-store.test.ts +0 -487
- package/src/cache/__tests__/memory-store.test.ts +0 -484
- package/src/cache/cf/__tests__/cf-cache-store.test.ts +0 -428
- package/src/cache/memory-store.ts +0 -253
- package/src/href.ts +0 -177
- package/src/route-utils.ts +0 -89
- package/src/router/__tests__/match-context.test.ts +0 -104
- package/src/router/__tests__/match-pipelines.test.ts +0 -537
- package/src/router/__tests__/match-result.test.ts +0 -566
- package/src/router/__tests__/on-error.test.ts +0 -935
- package/src/router/__tests__/pattern-matching.test.ts +0 -577
- package/src/router/middleware.test.ts +0 -1355
- package/src/rsc/__tests__/helpers.test.ts +0 -175
- package/src/server/__tests__/request-context.test.ts +0 -171
- package/src/ssr/__tests__/ssr-handler.test.tsx +0 -188
- package/src/theme/__tests__/theme.test.ts +0 -120
- package/src/vite/__tests__/expose-loader-id.test.ts +0 -117
- package/src/vite/expose-handle-id.ts +0 -209
- package/src/vite/expose-loader-id.ts +0 -357
- package/src/vite/expose-location-state-id.ts +0 -177
- /package/src/vite/{version.d.ts → plugins/version.d.ts} +0 -0
|
@@ -1,442 +1,45 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
NavigationBridge,
|
|
3
3
|
NavigationBridgeConfig,
|
|
4
|
-
|
|
5
|
-
NavigationStore,
|
|
4
|
+
NavigateOptionsInternal,
|
|
6
5
|
ResolvedSegment,
|
|
7
6
|
} from "./types.js";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { startTransition } from "react";
|
|
8
9
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./
|
|
10
|
+
createNavigationTransaction,
|
|
11
|
+
resolveNavigationState,
|
|
12
|
+
} from "./navigation-transaction.js";
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function isTypedLocationState(
|
|
17
|
-
state: unknown
|
|
18
|
-
): state is Record<string, unknown> {
|
|
19
|
-
if (state === null || typeof state !== "object") return false;
|
|
20
|
-
return Object.keys(state).some((key) => key.startsWith("__rsc_ls_"));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Resolve navigation state - handles both LocationStateEntry[] and legacy formats
|
|
25
|
-
*/
|
|
26
|
-
function resolveNavigationState(state: unknown): unknown {
|
|
27
|
-
// Check if it's an array of LocationStateEntry
|
|
28
|
-
if (
|
|
29
|
-
Array.isArray(state) &&
|
|
30
|
-
state.length > 0 &&
|
|
31
|
-
isLocationStateEntry(state[0])
|
|
32
|
-
) {
|
|
33
|
-
return resolveLocationStateEntries(state);
|
|
34
|
-
}
|
|
35
|
-
// Return as-is for legacy formats
|
|
36
|
-
return state;
|
|
37
|
-
}
|
|
14
|
+
// addTransitionType is only available in React experimental
|
|
15
|
+
const addTransitionType: ((type: string) => void) | undefined =
|
|
16
|
+
"addTransitionType" in React ? (React as any).addTransitionType : undefined;
|
|
38
17
|
|
|
39
|
-
/**
|
|
40
|
-
* Build history state object from user state
|
|
41
|
-
* - Typed state: spread directly into history.state
|
|
42
|
-
* - Legacy state: store in history.state.state
|
|
43
|
-
*/
|
|
44
|
-
function buildHistoryState(
|
|
45
|
-
userState: unknown,
|
|
46
|
-
routerState?: { intercept?: boolean; sourceUrl?: string }
|
|
47
|
-
): Record<string, unknown> | null {
|
|
48
|
-
const result: Record<string, unknown> = {};
|
|
49
|
-
|
|
50
|
-
// Add router internal state
|
|
51
|
-
if (routerState?.intercept) {
|
|
52
|
-
result.intercept = true;
|
|
53
|
-
if (routerState.sourceUrl) {
|
|
54
|
-
result.sourceUrl = routerState.sourceUrl;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Add user state
|
|
59
|
-
if (userState !== undefined) {
|
|
60
|
-
if (isTypedLocationState(userState)) {
|
|
61
|
-
// Typed state: spread directly
|
|
62
|
-
Object.assign(result, userState);
|
|
63
|
-
} else {
|
|
64
|
-
// Legacy state: store in .state
|
|
65
|
-
result.state = userState;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return Object.keys(result).length > 0 ? result : null;
|
|
70
|
-
}
|
|
71
18
|
import { setupLinkInterception } from "./link-interceptor.js";
|
|
72
19
|
import { createPartialUpdater } from "./partial-update.js";
|
|
73
20
|
import { generateHistoryKey } from "./navigation-store.js";
|
|
21
|
+
import { handleNavigationEnd } from "./scroll-restoration.js";
|
|
22
|
+
import type { EventController } from "./event-controller.js";
|
|
23
|
+
import { isInterceptOnlyCache } from "./intercept-utils.js";
|
|
74
24
|
import {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} from "./
|
|
79
|
-
import
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import { createElement, startTransition } from "react";
|
|
25
|
+
toNetworkError,
|
|
26
|
+
emitNetworkError,
|
|
27
|
+
isBackgroundSuppressible,
|
|
28
|
+
} from "./network-error-handler.js";
|
|
29
|
+
import { debugLog } from "./logging.js";
|
|
30
|
+
import { ServerRedirect } from "../errors.js";
|
|
31
|
+
import { validateRedirectOrigin } from "./validate-redirect-origin.js";
|
|
83
32
|
|
|
84
33
|
// Polyfill Symbol.dispose for Safari and older browsers
|
|
85
34
|
if (typeof Symbol.dispose === "undefined") {
|
|
86
35
|
(Symbol as any).dispose = Symbol("Symbol.dispose");
|
|
87
36
|
}
|
|
88
37
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
function isInterceptSegment(s: ResolvedSegment): boolean {
|
|
94
|
-
return (
|
|
95
|
-
s.namespace?.startsWith("intercept:") ||
|
|
96
|
-
(s.type === "parallel" && s.id.includes(".@"))
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Check if cached segments are intercept-only (no main route segments)
|
|
102
|
-
* Intercept responses shouldn't be used for optimistic rendering since
|
|
103
|
-
* whether interception happens depends on the current page context
|
|
104
|
-
*/
|
|
105
|
-
function isInterceptOnlyCache(segments: ResolvedSegment[]): boolean {
|
|
106
|
-
return segments.some(isInterceptSegment);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Options for committing a navigation transaction
|
|
111
|
-
*/
|
|
112
|
-
interface CommitOptions {
|
|
113
|
-
url: string;
|
|
114
|
-
segmentIds: string[];
|
|
115
|
-
segments: ResolvedSegment[];
|
|
116
|
-
replace?: boolean;
|
|
117
|
-
scroll?: boolean;
|
|
118
|
-
/** User-provided state to store in history.state */
|
|
119
|
-
state?: unknown;
|
|
120
|
-
/** If true, only update store without changing URL/history (for server actions) */
|
|
121
|
-
storeOnly?: boolean;
|
|
122
|
-
/** If true, this is an intercept route - store in history.state for popstate handling */
|
|
123
|
-
intercept?: boolean;
|
|
124
|
-
/** Source URL where the intercept was triggered from (stored in history.state) */
|
|
125
|
-
interceptSourceUrl?: string;
|
|
126
|
-
/** If true, only update cache without touching store or history (for background stale revalidation) */
|
|
127
|
-
cacheOnly?: boolean;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Options that can override the pre-configured commit settings
|
|
132
|
-
*/
|
|
133
|
-
interface BoundCommitOverrides {
|
|
134
|
-
/** Override scroll behavior (e.g., disable for intercepts) */
|
|
135
|
-
scroll?: boolean;
|
|
136
|
-
/** Override replace behavior (e.g., force replace for intercepts) */
|
|
137
|
-
replace?: boolean;
|
|
138
|
-
/** Override user-provided state */
|
|
139
|
-
state?: unknown;
|
|
140
|
-
/** Mark this as an intercept route */
|
|
141
|
-
intercept?: boolean;
|
|
142
|
-
/** Source URL where intercept was triggered from */
|
|
143
|
-
interceptSourceUrl?: string;
|
|
144
|
-
/** If true, only update cache (for stale revalidation) */
|
|
145
|
-
cacheOnly?: boolean;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Token for tracking an active stream - call end() when stream completes
|
|
150
|
-
*/
|
|
151
|
-
export interface StreamingToken {
|
|
152
|
-
end(): void;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Bound transaction with pre-configured commit options (without segmentIds/segments)
|
|
157
|
-
*/
|
|
158
|
-
export interface BoundTransaction {
|
|
159
|
-
readonly currentUrl: string;
|
|
160
|
-
/** Start streaming and get a token to end it when the stream completes */
|
|
161
|
-
startStreaming(): StreamingToken;
|
|
162
|
-
commit(
|
|
163
|
-
segmentIds: string[],
|
|
164
|
-
segments: ResolvedSegment[],
|
|
165
|
-
overrides?: BoundCommitOverrides
|
|
166
|
-
): void;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Navigation transaction for managing state during navigation
|
|
171
|
-
* Uses the event controller handle for lifecycle management
|
|
172
|
-
*/
|
|
173
|
-
interface NavigationTransaction extends Disposable {
|
|
174
|
-
/** Optimistically commit from cache - instant render before revalidation */
|
|
175
|
-
optimisticCommit(options: CommitOptions): void;
|
|
176
|
-
/** Final commit with server data (or reconciliation after optimistic) */
|
|
177
|
-
commit(options: CommitOptions): void;
|
|
178
|
-
with(
|
|
179
|
-
options: Omit<CommitOptions, "segmentIds" | "segments">
|
|
180
|
-
): BoundTransaction;
|
|
181
|
-
/** The navigation handle from the event controller */
|
|
182
|
-
handle: NavigationHandle;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Creates a navigation transaction that coordinates with the event controller.
|
|
187
|
-
* Handles loading state transitions and cleanup on completion/abort.
|
|
188
|
-
*
|
|
189
|
-
* Supports optimistic navigation: render from cache immediately,
|
|
190
|
-
* then revalidate in background and reconcile if data changed.
|
|
191
|
-
*/
|
|
192
|
-
function createNavigationTransaction(
|
|
193
|
-
store: NavigationStore,
|
|
194
|
-
eventController: EventController,
|
|
195
|
-
url: string,
|
|
196
|
-
options?: NavigateOptions & { skipLoadingState?: boolean }
|
|
197
|
-
): NavigationTransaction {
|
|
198
|
-
let committed = false;
|
|
199
|
-
let optimisticallyCommitted = false;
|
|
200
|
-
let earlyStatePushed = false;
|
|
201
|
-
const currentUrl = window.location.href;
|
|
202
|
-
|
|
203
|
-
// Start navigation in event controller (this sets loading state)
|
|
204
|
-
const handle = eventController.startNavigation(url, options);
|
|
205
|
-
|
|
206
|
-
// If state is provided, push it to history immediately so loading UI can access it
|
|
207
|
-
// This enables "optimistic state" - showing product names in skeletons etc.
|
|
208
|
-
if (options?.state !== undefined && !options?.replace) {
|
|
209
|
-
const earlyHistoryState = buildHistoryState(options.state);
|
|
210
|
-
window.history.pushState(earlyHistoryState, "", url);
|
|
211
|
-
earlyStatePushed = true;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Optimistically commit from cache - renders immediately before revalidation
|
|
216
|
-
* Sets optimisticallyCommitted flag so final commit() knows to reconcile
|
|
217
|
-
*/
|
|
218
|
-
function optimisticCommit(opts: CommitOptions): void {
|
|
219
|
-
optimisticallyCommitted = true;
|
|
220
|
-
|
|
221
|
-
const { url, segmentIds, segments, replace, scroll } = opts;
|
|
222
|
-
const parsedUrl = new URL(url, window.location.origin);
|
|
223
|
-
|
|
224
|
-
// Save current scroll position before navigating
|
|
225
|
-
handleNavigationStart();
|
|
226
|
-
|
|
227
|
-
// Update segment state
|
|
228
|
-
store.setSegmentIds(segmentIds);
|
|
229
|
-
store.setCurrentUrl(url);
|
|
230
|
-
store.setPath(parsedUrl.pathname);
|
|
231
|
-
|
|
232
|
-
// Generate history key from URL
|
|
233
|
-
const historyKey = generateHistoryKey(url);
|
|
234
|
-
store.setHistoryKey(historyKey);
|
|
235
|
-
|
|
236
|
-
// Cache segments with current handleData (will be overwritten by fresh data on final commit)
|
|
237
|
-
const currentHandleData = eventController.getHandleState().data;
|
|
238
|
-
store.cacheSegmentsForHistory(historyKey, segments, currentHandleData);
|
|
239
|
-
|
|
240
|
-
// Build history state with user state if provided
|
|
241
|
-
const historyState = buildHistoryState(opts.state);
|
|
242
|
-
|
|
243
|
-
// Update browser URL
|
|
244
|
-
// Use replaceState if we already pushed early (for optimistic state access)
|
|
245
|
-
if (replace || earlyStatePushed) {
|
|
246
|
-
window.history.replaceState(historyState, "", url);
|
|
247
|
-
} else {
|
|
248
|
-
window.history.pushState(historyState, "", url);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// Ensure new history entry has a scroll restoration key
|
|
252
|
-
ensureHistoryKey();
|
|
253
|
-
|
|
254
|
-
// Complete the navigation in event controller (sets idle state)
|
|
255
|
-
handle.complete(parsedUrl);
|
|
256
|
-
|
|
257
|
-
// Handle scroll after navigation
|
|
258
|
-
handleNavigationEnd({ scroll });
|
|
259
|
-
|
|
260
|
-
console.log(
|
|
261
|
-
"[Browser] Optimistic commit from cache, historyKey:",
|
|
262
|
-
historyKey
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Commit the navigation - updates store and URL atomically
|
|
268
|
-
* If optimisticCommit was called, this becomes a reconciliation
|
|
269
|
-
*/
|
|
270
|
-
function commit(opts: CommitOptions): void {
|
|
271
|
-
committed = true;
|
|
272
|
-
|
|
273
|
-
// If optimistic commit already done, adjust options for reconciliation
|
|
274
|
-
const isReconciliation = optimisticallyCommitted;
|
|
275
|
-
const {
|
|
276
|
-
url,
|
|
277
|
-
segmentIds,
|
|
278
|
-
segments,
|
|
279
|
-
storeOnly,
|
|
280
|
-
intercept,
|
|
281
|
-
interceptSourceUrl,
|
|
282
|
-
cacheOnly,
|
|
283
|
-
} = opts;
|
|
284
|
-
// For reconciliation: always replace (URL already pushed), no scroll
|
|
285
|
-
const replace = isReconciliation ? true : opts.replace;
|
|
286
|
-
const scroll = isReconciliation ? false : opts.scroll;
|
|
287
|
-
|
|
288
|
-
const parsedUrl = new URL(url, window.location.origin);
|
|
289
|
-
|
|
290
|
-
// Generate history key from URL (with intercept suffix for separate caching)
|
|
291
|
-
const historyKey = generateHistoryKey(url, { intercept });
|
|
292
|
-
|
|
293
|
-
// For cache-only commits (stale revalidation), only update cache and return
|
|
294
|
-
// Don't touch store state or history - user may have navigated elsewhere
|
|
295
|
-
if (cacheOnly) {
|
|
296
|
-
const currentHandleData = eventController.getHandleState().data;
|
|
297
|
-
store.cacheSegmentsForHistory(historyKey, segments, currentHandleData);
|
|
298
|
-
console.log("[Browser] Cache-only commit, historyKey:", historyKey);
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// Save current scroll position before navigating (only for non-reconciliation)
|
|
303
|
-
if (!isReconciliation) {
|
|
304
|
-
handleNavigationStart();
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// Update segment state atomically
|
|
308
|
-
store.setSegmentIds(segmentIds);
|
|
309
|
-
store.setCurrentUrl(url);
|
|
310
|
-
store.setPath(parsedUrl.pathname);
|
|
311
|
-
|
|
312
|
-
store.setHistoryKey(historyKey);
|
|
313
|
-
|
|
314
|
-
// Cache segments with current handleData for this history entry (fresh data overwrites optimistic)
|
|
315
|
-
const currentHandleData = eventController.getHandleState().data;
|
|
316
|
-
store.cacheSegmentsForHistory(historyKey, segments, currentHandleData);
|
|
317
|
-
|
|
318
|
-
// For server actions, skip URL/history updates but still complete navigation
|
|
319
|
-
if (storeOnly) {
|
|
320
|
-
console.log("[Browser] Store updated (action)");
|
|
321
|
-
// Complete navigation to clear loading state
|
|
322
|
-
handle.complete(parsedUrl);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// Build history state - include user state and intercept info for popstate handling
|
|
327
|
-
const historyState = buildHistoryState(opts.state, {
|
|
328
|
-
intercept,
|
|
329
|
-
sourceUrl: interceptSourceUrl,
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
// Update browser URL (skip if reconciliation - already done in optimisticCommit)
|
|
333
|
-
if (!isReconciliation) {
|
|
334
|
-
// Use replaceState if we already pushed early (for optimistic state access) or replace requested
|
|
335
|
-
if (replace || earlyStatePushed) {
|
|
336
|
-
window.history.replaceState(historyState, "", url);
|
|
337
|
-
} else {
|
|
338
|
-
window.history.pushState(historyState, "", url);
|
|
339
|
-
}
|
|
340
|
-
// Ensure new history entry has a scroll restoration key
|
|
341
|
-
ensureHistoryKey();
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// Complete the navigation in event controller (sets idle state, updates location)
|
|
345
|
-
handle.complete(parsedUrl);
|
|
346
|
-
|
|
347
|
-
// Handle scroll after navigation (skip if reconciliation)
|
|
348
|
-
if (!isReconciliation) {
|
|
349
|
-
handleNavigationEnd({ scroll });
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
if (isReconciliation) {
|
|
353
|
-
console.log("[Browser] Reconciliation commit, historyKey:", historyKey);
|
|
354
|
-
} else {
|
|
355
|
-
console.log(
|
|
356
|
-
"[Browser] Navigation committed, historyKey:",
|
|
357
|
-
historyKey,
|
|
358
|
-
intercept ? "(intercept)" : ""
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
return {
|
|
364
|
-
handle,
|
|
365
|
-
optimisticCommit,
|
|
366
|
-
commit,
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Create a bound transaction with pre-configured URL options
|
|
370
|
-
* segmentIds and segments provided at commit time (after they're resolved)
|
|
371
|
-
*/
|
|
372
|
-
with(
|
|
373
|
-
opts: Omit<CommitOptions, "segmentIds" | "segments">
|
|
374
|
-
): BoundTransaction {
|
|
375
|
-
return {
|
|
376
|
-
get currentUrl() {
|
|
377
|
-
return currentUrl;
|
|
378
|
-
},
|
|
379
|
-
startStreaming() {
|
|
380
|
-
return handle.startStreaming();
|
|
381
|
-
},
|
|
382
|
-
commit: (
|
|
383
|
-
segmentIds: string[],
|
|
384
|
-
segments: ResolvedSegment[],
|
|
385
|
-
overrides?: BoundCommitOverrides
|
|
386
|
-
) => {
|
|
387
|
-
// Allow overrides to disable scroll (e.g., for intercepts)
|
|
388
|
-
const finalScroll =
|
|
389
|
-
overrides?.scroll !== undefined ? overrides.scroll : opts.scroll;
|
|
390
|
-
// Allow overrides to force replace (e.g., for intercepts)
|
|
391
|
-
const finalReplace =
|
|
392
|
-
overrides?.replace !== undefined ? overrides.replace : opts.replace;
|
|
393
|
-
// Intercept info: overrides take precedence, fallback to opts
|
|
394
|
-
const intercept =
|
|
395
|
-
overrides?.intercept !== undefined
|
|
396
|
-
? overrides.intercept
|
|
397
|
-
: opts.intercept;
|
|
398
|
-
const interceptSourceUrl =
|
|
399
|
-
overrides?.interceptSourceUrl !== undefined
|
|
400
|
-
? overrides.interceptSourceUrl
|
|
401
|
-
: opts.interceptSourceUrl;
|
|
402
|
-
// Cache-only mode: overrides take precedence, fallback to opts
|
|
403
|
-
const cacheOnly =
|
|
404
|
-
overrides?.cacheOnly !== undefined
|
|
405
|
-
? overrides.cacheOnly
|
|
406
|
-
: opts.cacheOnly;
|
|
407
|
-
// User state: overrides take precedence, fallback to opts
|
|
408
|
-
const state =
|
|
409
|
-
overrides?.state !== undefined ? overrides.state : opts.state;
|
|
410
|
-
commit({
|
|
411
|
-
...opts,
|
|
412
|
-
segmentIds,
|
|
413
|
-
segments,
|
|
414
|
-
scroll: finalScroll,
|
|
415
|
-
replace: finalReplace,
|
|
416
|
-
state,
|
|
417
|
-
intercept,
|
|
418
|
-
interceptSourceUrl,
|
|
419
|
-
cacheOnly,
|
|
420
|
-
});
|
|
421
|
-
},
|
|
422
|
-
};
|
|
423
|
-
},
|
|
424
|
-
|
|
425
|
-
[Symbol.dispose]() {
|
|
426
|
-
// If aborted, another navigation took over - don't touch state
|
|
427
|
-
if (handle.signal.aborted) return;
|
|
428
|
-
|
|
429
|
-
// If not committed (and not optimistically committed), the handle's dispose
|
|
430
|
-
// will reset state to idle via the event controller
|
|
431
|
-
if (!committed && !optimisticallyCommitted) {
|
|
432
|
-
handle[Symbol.dispose]();
|
|
433
|
-
// The NavigationHandle's [Symbol.dispose] handles this
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
};
|
|
38
|
+
/** Get IDs of non-loader segments (layouts, routes, parallels). */
|
|
39
|
+
function getNonLoaderSegmentIds(segments: ResolvedSegment[]): string[] {
|
|
40
|
+
return segments.filter((s) => s.type !== "loader").map((s) => s.id);
|
|
437
41
|
}
|
|
438
42
|
|
|
439
|
-
// Export for use by server-action-bridge
|
|
440
43
|
export { createNavigationTransaction };
|
|
441
44
|
|
|
442
45
|
/**
|
|
@@ -462,9 +65,10 @@ export interface NavigationBridgeConfigWithController extends NavigationBridgeCo
|
|
|
462
65
|
* @returns NavigationBridge instance
|
|
463
66
|
*/
|
|
464
67
|
export function createNavigationBridge(
|
|
465
|
-
config: NavigationBridgeConfigWithController
|
|
68
|
+
config: NavigationBridgeConfigWithController,
|
|
466
69
|
): NavigationBridge {
|
|
467
|
-
const { store, client, eventController, onUpdate, renderSegments, version } =
|
|
70
|
+
const { store, client, eventController, onUpdate, renderSegments, version } =
|
|
71
|
+
config;
|
|
468
72
|
|
|
469
73
|
// Create shared partial updater
|
|
470
74
|
const fetchPartialUpdate = createPartialUpdater({
|
|
@@ -478,23 +82,61 @@ export function createNavigationBridge(
|
|
|
478
82
|
return {
|
|
479
83
|
/**
|
|
480
84
|
* Navigate to a URL
|
|
481
|
-
* Uses
|
|
85
|
+
* Uses cached segments for SWR revalidation when available
|
|
482
86
|
*/
|
|
483
|
-
async navigate(
|
|
87
|
+
async navigate(
|
|
88
|
+
url: string,
|
|
89
|
+
options?: NavigateOptionsInternal,
|
|
90
|
+
): Promise<void> {
|
|
484
91
|
// Resolve LocationStateEntry[] to flat object if needed
|
|
485
92
|
const resolvedState =
|
|
486
93
|
options?.state !== undefined
|
|
487
94
|
? resolveNavigationState(options.state)
|
|
488
95
|
: undefined;
|
|
489
96
|
|
|
97
|
+
// Cross-origin URLs are not handled by SPA navigation.
|
|
98
|
+
// Fall back to a full browser navigation for http/https only.
|
|
99
|
+
let targetUrl: URL;
|
|
100
|
+
try {
|
|
101
|
+
targetUrl = new URL(url, window.location.origin);
|
|
102
|
+
} catch {
|
|
103
|
+
console.warn(`[rango] navigate() ignored: malformed URL "${url}"`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (targetUrl.origin !== window.location.origin) {
|
|
107
|
+
if (targetUrl.protocol !== "http:" && targetUrl.protocol !== "https:") {
|
|
108
|
+
console.error(
|
|
109
|
+
`[rango] navigate() blocked: unsupported scheme "${targetUrl.protocol}"`,
|
|
110
|
+
);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
window.location.href = targetUrl.href;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
490
117
|
// Only abort pending requests when navigating to a different route
|
|
491
118
|
// Same-route navigation (e.g., /todos -> /todos) should not cancel in-flight actions
|
|
492
119
|
const currentPath = new URL(window.location.href).pathname;
|
|
493
|
-
const targetPath =
|
|
120
|
+
const targetPath = targetUrl.pathname;
|
|
494
121
|
if (currentPath !== targetPath) {
|
|
495
122
|
eventController.abortNavigation();
|
|
496
123
|
}
|
|
497
124
|
|
|
125
|
+
// Check if we're "leaving intercept" - navigating from intercept to same URL without intercept
|
|
126
|
+
// This happens when clicking "View Full Details" in an intercept modal
|
|
127
|
+
const currentHistoryState = window.history.state;
|
|
128
|
+
const isCurrentlyIntercept = currentHistoryState?.intercept === true;
|
|
129
|
+
const isSamePathNavigation = currentPath === targetPath;
|
|
130
|
+
const isLeavingIntercept = isCurrentlyIntercept && isSamePathNavigation;
|
|
131
|
+
|
|
132
|
+
if (isLeavingIntercept) {
|
|
133
|
+
debugLog(
|
|
134
|
+
"[Browser] Leaving intercept - same URL navigation from intercept",
|
|
135
|
+
);
|
|
136
|
+
// Clear intercept source URL to ensure server doesn't treat this as intercept
|
|
137
|
+
store.setInterceptSourceUrl(null);
|
|
138
|
+
}
|
|
139
|
+
|
|
498
140
|
// Before navigating away, update the source page's cache with the latest handleData.
|
|
499
141
|
// This ensures the cache has correct handleData even if handles were streaming.
|
|
500
142
|
const sourceHistoryKey = store.getHistoryKey();
|
|
@@ -504,7 +146,7 @@ export function createNavigationBridge(
|
|
|
504
146
|
store.cacheSegmentsForHistory(
|
|
505
147
|
sourceHistoryKey,
|
|
506
148
|
sourceCached.segments,
|
|
507
|
-
currentHandleData
|
|
149
|
+
currentHandleData,
|
|
508
150
|
);
|
|
509
151
|
}
|
|
510
152
|
|
|
@@ -519,7 +161,7 @@ export function createNavigationBridge(
|
|
|
519
161
|
const cachedHandleData = cached?.handleData;
|
|
520
162
|
if (cachedSegments && sourceCached?.segments) {
|
|
521
163
|
const sourceSegmentMap = new Map(
|
|
522
|
-
sourceCached.segments.map((s) => [s.id, s])
|
|
164
|
+
sourceCached.segments.map((s) => [s.id, s]),
|
|
523
165
|
);
|
|
524
166
|
cachedSegments = cachedSegments.map((targetSeg) => {
|
|
525
167
|
const sourceSeg = sourceSegmentMap.get(targetSeg.id);
|
|
@@ -534,16 +176,20 @@ export function createNavigationBridge(
|
|
|
534
176
|
const interceptHistoryKey = generateHistoryKey(url, { intercept: true });
|
|
535
177
|
const hasInterceptCache = store.hasHistoryCache(interceptHistoryKey);
|
|
536
178
|
|
|
537
|
-
// Skip
|
|
179
|
+
// Skip cached SWR for:
|
|
538
180
|
// 1. intercept caches - interception depends on source page context
|
|
539
181
|
// 2. routes that CAN be intercepted - we don't know if this navigation will intercept
|
|
182
|
+
// 3. when leaving intercept - we need fresh non-intercept segments from server
|
|
183
|
+
// 4. redirect-with-state - force re-render so hooks read fresh state
|
|
540
184
|
const hasUsableCache =
|
|
541
185
|
cachedSegments &&
|
|
542
186
|
cachedSegments.length > 0 &&
|
|
543
187
|
!isInterceptOnlyCache(cachedSegments) &&
|
|
544
|
-
!hasInterceptCache
|
|
188
|
+
!hasInterceptCache &&
|
|
189
|
+
!isLeavingIntercept &&
|
|
190
|
+
!options?._skipCache;
|
|
545
191
|
|
|
546
|
-
|
|
192
|
+
const tx = createNavigationTransaction(store, eventController, url, {
|
|
547
193
|
...options,
|
|
548
194
|
state: resolvedState,
|
|
549
195
|
skipLoadingState: hasUsableCache,
|
|
@@ -553,7 +199,11 @@ export function createNavigationBridge(
|
|
|
553
199
|
try {
|
|
554
200
|
await fetchPartialUpdate(
|
|
555
201
|
url,
|
|
556
|
-
hasUsableCache
|
|
202
|
+
hasUsableCache
|
|
203
|
+
? getNonLoaderSegmentIds(cachedSegments!)
|
|
204
|
+
: options?._skipCache
|
|
205
|
+
? [] // Action redirect: send no segments so server renders everything fresh
|
|
206
|
+
: undefined,
|
|
557
207
|
false,
|
|
558
208
|
tx.handle.signal,
|
|
559
209
|
tx.with({
|
|
@@ -562,50 +212,56 @@ export function createNavigationBridge(
|
|
|
562
212
|
scroll: options?.scroll,
|
|
563
213
|
state: resolvedState,
|
|
564
214
|
}),
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
215
|
+
hasUsableCache
|
|
216
|
+
? {
|
|
217
|
+
type: "navigate" as const,
|
|
218
|
+
targetCacheSegments: cachedSegments,
|
|
219
|
+
targetCacheHandleData: cachedHandleData,
|
|
220
|
+
}
|
|
221
|
+
: isLeavingIntercept
|
|
222
|
+
? { type: "leave-intercept" as const }
|
|
223
|
+
: undefined,
|
|
571
224
|
);
|
|
572
225
|
} catch (error) {
|
|
573
|
-
//
|
|
226
|
+
// Server-side redirect with location state: the current transaction's
|
|
227
|
+
// cleanup resets loading state. Re-navigate to the redirect
|
|
228
|
+
// target carrying the server-set state into history.pushState.
|
|
229
|
+
if (error instanceof ServerRedirect) {
|
|
230
|
+
const redirectUrl = validateRedirectOrigin(
|
|
231
|
+
error.url,
|
|
232
|
+
window.location.origin,
|
|
233
|
+
);
|
|
234
|
+
if (!redirectUrl) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
return this.navigate(redirectUrl, {
|
|
238
|
+
state: error.state,
|
|
239
|
+
replace: options?.replace,
|
|
240
|
+
_skipCache: true,
|
|
241
|
+
} as NavigateOptionsInternal);
|
|
242
|
+
}
|
|
243
|
+
|
|
574
244
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
575
|
-
|
|
245
|
+
debugLog("[Browser] Navigation aborted by newer navigation");
|
|
576
246
|
return;
|
|
577
247
|
}
|
|
578
248
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
: new NetworkError(
|
|
585
|
-
"Unable to connect to server. Please check your connection.",
|
|
586
|
-
{ cause: error, url, operation: "navigation" }
|
|
587
|
-
);
|
|
588
|
-
|
|
249
|
+
const networkError = toNetworkError(error, {
|
|
250
|
+
url,
|
|
251
|
+
operation: "navigation",
|
|
252
|
+
});
|
|
253
|
+
if (networkError) {
|
|
589
254
|
console.error(
|
|
590
255
|
"[Browser] Network error during navigation:",
|
|
591
|
-
networkError
|
|
256
|
+
networkError,
|
|
592
257
|
);
|
|
593
|
-
|
|
594
|
-
// Emit update with NetworkErrorThrower to trigger root error boundary
|
|
595
|
-
startTransition(() => {
|
|
596
|
-
onUpdate({
|
|
597
|
-
root: createElement(NetworkErrorThrower, { error: networkError }),
|
|
598
|
-
metadata: {
|
|
599
|
-
pathname: url,
|
|
600
|
-
segments: [],
|
|
601
|
-
isError: true,
|
|
602
|
-
},
|
|
603
|
-
});
|
|
604
|
-
});
|
|
258
|
+
emitNetworkError(onUpdate, networkError, url);
|
|
605
259
|
return;
|
|
606
260
|
}
|
|
607
261
|
|
|
608
262
|
throw error;
|
|
263
|
+
} finally {
|
|
264
|
+
tx[Symbol.dispose]();
|
|
609
265
|
}
|
|
610
266
|
},
|
|
611
267
|
|
|
@@ -615,11 +271,11 @@ export function createNavigationBridge(
|
|
|
615
271
|
async refresh(): Promise<void> {
|
|
616
272
|
eventController.abortNavigation();
|
|
617
273
|
|
|
618
|
-
|
|
274
|
+
const tx = createNavigationTransaction(
|
|
619
275
|
store,
|
|
620
276
|
eventController,
|
|
621
277
|
window.location.href,
|
|
622
|
-
{ replace: true }
|
|
278
|
+
{ replace: true },
|
|
623
279
|
);
|
|
624
280
|
|
|
625
281
|
try {
|
|
@@ -629,41 +285,24 @@ export function createNavigationBridge(
|
|
|
629
285
|
[],
|
|
630
286
|
false,
|
|
631
287
|
tx.handle.signal,
|
|
632
|
-
tx.with({ url: window.location.href, replace: true, scroll: false })
|
|
288
|
+
tx.with({ url: window.location.href, replace: true, scroll: false }),
|
|
633
289
|
);
|
|
634
290
|
} catch (error) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
: new NetworkError(
|
|
641
|
-
"Unable to connect to server. Please check your connection.",
|
|
642
|
-
{
|
|
643
|
-
cause: error,
|
|
644
|
-
url: window.location.href,
|
|
645
|
-
operation: "revalidation",
|
|
646
|
-
}
|
|
647
|
-
);
|
|
648
|
-
|
|
291
|
+
const networkError = toNetworkError(error, {
|
|
292
|
+
url: window.location.href,
|
|
293
|
+
operation: "revalidation",
|
|
294
|
+
});
|
|
295
|
+
if (networkError) {
|
|
649
296
|
console.error(
|
|
650
297
|
"[Browser] Network error during refresh:",
|
|
651
|
-
networkError
|
|
298
|
+
networkError,
|
|
652
299
|
);
|
|
653
|
-
|
|
654
|
-
startTransition(() => {
|
|
655
|
-
onUpdate({
|
|
656
|
-
root: createElement(NetworkErrorThrower, { error: networkError }),
|
|
657
|
-
metadata: {
|
|
658
|
-
pathname: window.location.href,
|
|
659
|
-
segments: [],
|
|
660
|
-
isError: true,
|
|
661
|
-
},
|
|
662
|
-
});
|
|
663
|
-
});
|
|
300
|
+
emitNetworkError(onUpdate, networkError, window.location.href);
|
|
664
301
|
return;
|
|
665
302
|
}
|
|
666
303
|
throw error;
|
|
304
|
+
} finally {
|
|
305
|
+
tx[Symbol.dispose]();
|
|
667
306
|
}
|
|
668
307
|
},
|
|
669
308
|
|
|
@@ -687,8 +326,8 @@ export function createNavigationBridge(
|
|
|
687
326
|
const currentInterceptSource = store.getInterceptSourceUrl();
|
|
688
327
|
const newInterceptSource = interceptSourceUrl ?? null;
|
|
689
328
|
if (currentInterceptSource !== newInterceptSource) {
|
|
690
|
-
|
|
691
|
-
`[Browser] Intercept context changing (${currentInterceptSource} -> ${newInterceptSource}), aborting in-flight actions
|
|
329
|
+
debugLog(
|
|
330
|
+
`[Browser] Intercept context changing (${currentInterceptSource} -> ${newInterceptSource}), aborting in-flight actions`,
|
|
692
331
|
);
|
|
693
332
|
eventController.abortAllActions();
|
|
694
333
|
}
|
|
@@ -696,11 +335,11 @@ export function createNavigationBridge(
|
|
|
696
335
|
// Compute history key from URL (with intercept suffix if applicable)
|
|
697
336
|
const historyKey = generateHistoryKey(url, { intercept: isIntercept });
|
|
698
337
|
|
|
699
|
-
|
|
338
|
+
debugLog(
|
|
700
339
|
"[Browser] Popstate -",
|
|
701
340
|
isIntercept ? "intercept" : "normal",
|
|
702
341
|
"key:",
|
|
703
|
-
historyKey
|
|
342
|
+
historyKey,
|
|
704
343
|
);
|
|
705
344
|
|
|
706
345
|
// Update location in event controller
|
|
@@ -731,10 +370,19 @@ export function createNavigationBridge(
|
|
|
731
370
|
|
|
732
371
|
// Render from cache - force await to skip loading fallbacks
|
|
733
372
|
try {
|
|
734
|
-
const root = renderSegments(cachedSegments, {
|
|
373
|
+
const root = await renderSegments(cachedSegments, {
|
|
735
374
|
forceAwait: true,
|
|
736
375
|
});
|
|
737
|
-
|
|
376
|
+
// Merge params from cached segments for useParams restoration.
|
|
377
|
+
// Set params on event controller before onUpdate so both location
|
|
378
|
+
// and params are current when the debounced notify() fires.
|
|
379
|
+
const cachedParams: Record<string, string> = {};
|
|
380
|
+
for (const s of cachedSegments) {
|
|
381
|
+
if (s.params) Object.assign(cachedParams, s.params);
|
|
382
|
+
}
|
|
383
|
+
eventController.setParams(cachedParams);
|
|
384
|
+
|
|
385
|
+
const popstateUpdate = {
|
|
738
386
|
root,
|
|
739
387
|
metadata: {
|
|
740
388
|
pathname: new URL(url).pathname,
|
|
@@ -743,23 +391,35 @@ export function createNavigationBridge(
|
|
|
743
391
|
matched: cachedSegments.map((s) => s.id),
|
|
744
392
|
diff: [],
|
|
745
393
|
cachedHandleData,
|
|
394
|
+
params: cachedParams,
|
|
746
395
|
},
|
|
747
|
-
}
|
|
396
|
+
};
|
|
397
|
+
const hasTransition = cachedSegments.some((s) => s.transition);
|
|
398
|
+
if (hasTransition) {
|
|
399
|
+
startTransition(() => {
|
|
400
|
+
if (addTransitionType) {
|
|
401
|
+
addTransitionType("navigation-back");
|
|
402
|
+
}
|
|
403
|
+
onUpdate(popstateUpdate);
|
|
404
|
+
});
|
|
405
|
+
} else {
|
|
406
|
+
onUpdate(popstateUpdate);
|
|
407
|
+
}
|
|
748
408
|
|
|
749
409
|
// Restore scroll position for back/forward navigation
|
|
750
410
|
handleNavigationEnd({ restore: true, isStreaming });
|
|
751
411
|
|
|
752
412
|
// SWR: If stale, trigger background revalidation
|
|
753
413
|
if (isStale) {
|
|
754
|
-
|
|
414
|
+
debugLog("[Browser] Cache is stale, background revalidating...");
|
|
755
415
|
// Background revalidation - don't await, just fire and forget
|
|
756
|
-
const segmentIds = cachedSegments
|
|
416
|
+
const segmentIds = getNonLoaderSegmentIds(cachedSegments);
|
|
757
417
|
|
|
758
|
-
|
|
418
|
+
const tx = createNavigationTransaction(
|
|
759
419
|
store,
|
|
760
420
|
eventController,
|
|
761
421
|
url,
|
|
762
|
-
{ skipLoadingState: true, replace: true }
|
|
422
|
+
{ skipLoadingState: true, replace: true },
|
|
763
423
|
);
|
|
764
424
|
|
|
765
425
|
fetchPartialUpdate(
|
|
@@ -775,41 +435,33 @@ export function createNavigationBridge(
|
|
|
775
435
|
interceptSourceUrl,
|
|
776
436
|
cacheOnly: true,
|
|
777
437
|
}),
|
|
778
|
-
{
|
|
779
|
-
)
|
|
780
|
-
|
|
781
|
-
error
|
|
782
|
-
error
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
// For background revalidation, network errors are logged but don't trigger error boundary
|
|
788
|
-
// since the user is already seeing cached content
|
|
789
|
-
if (error instanceof NetworkError || isNetworkError(error)) {
|
|
790
|
-
console.warn(
|
|
791
|
-
"[Browser] Background revalidation network error (cached content preserved):",
|
|
792
|
-
error.message
|
|
438
|
+
{ type: "stale-revalidation", interceptSourceUrl },
|
|
439
|
+
)
|
|
440
|
+
.catch((error) => {
|
|
441
|
+
if (isBackgroundSuppressible(error)) return;
|
|
442
|
+
console.error(
|
|
443
|
+
"[Browser] Background revalidation failed:",
|
|
444
|
+
error,
|
|
793
445
|
);
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
446
|
+
})
|
|
447
|
+
.finally(() => {
|
|
448
|
+
tx[Symbol.dispose]();
|
|
449
|
+
});
|
|
798
450
|
}
|
|
799
451
|
return;
|
|
800
452
|
} catch (error) {
|
|
801
453
|
console.warn(
|
|
802
454
|
"[Browser] Failed to render from cache, fetching:",
|
|
803
|
-
error
|
|
455
|
+
error,
|
|
804
456
|
);
|
|
805
457
|
// Fall through to fetch
|
|
806
458
|
}
|
|
807
459
|
} else {
|
|
808
|
-
|
|
460
|
+
debugLog("[Browser] History cache miss for key:", historyKey);
|
|
809
461
|
}
|
|
810
462
|
|
|
811
463
|
// Fetch if not cached
|
|
812
|
-
|
|
464
|
+
const tx = createNavigationTransaction(store, eventController, url, {
|
|
813
465
|
replace: true,
|
|
814
466
|
});
|
|
815
467
|
|
|
@@ -819,45 +471,39 @@ export function createNavigationBridge(
|
|
|
819
471
|
undefined,
|
|
820
472
|
false,
|
|
821
473
|
tx.handle.signal,
|
|
822
|
-
tx.with({
|
|
474
|
+
tx.with({
|
|
475
|
+
url,
|
|
476
|
+
replace: true,
|
|
477
|
+
scroll: false,
|
|
478
|
+
intercept: isIntercept,
|
|
479
|
+
interceptSourceUrl,
|
|
480
|
+
}),
|
|
481
|
+
isIntercept ? { type: "navigate", interceptSourceUrl } : undefined,
|
|
823
482
|
);
|
|
824
483
|
// Restore scroll position after fetch completes
|
|
825
484
|
handleNavigationEnd({ restore: true, isStreaming });
|
|
826
485
|
} catch (error) {
|
|
827
486
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
828
|
-
|
|
487
|
+
debugLog("[Browser] Popstate navigation aborted");
|
|
829
488
|
return;
|
|
830
489
|
}
|
|
831
490
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
: new NetworkError(
|
|
838
|
-
"Unable to connect to server. Please check your connection.",
|
|
839
|
-
{ cause: error, url, operation: "navigation" }
|
|
840
|
-
);
|
|
841
|
-
|
|
491
|
+
const networkError = toNetworkError(error, {
|
|
492
|
+
url,
|
|
493
|
+
operation: "navigation",
|
|
494
|
+
});
|
|
495
|
+
if (networkError) {
|
|
842
496
|
console.error(
|
|
843
|
-
"[Browser] Network error during popstate
|
|
844
|
-
networkError
|
|
497
|
+
"[Browser] Network error during popstate:",
|
|
498
|
+
networkError,
|
|
845
499
|
);
|
|
846
|
-
|
|
847
|
-
startTransition(() => {
|
|
848
|
-
onUpdate({
|
|
849
|
-
root: createElement(NetworkErrorThrower, { error: networkError }),
|
|
850
|
-
metadata: {
|
|
851
|
-
pathname: url,
|
|
852
|
-
segments: [],
|
|
853
|
-
isError: true,
|
|
854
|
-
},
|
|
855
|
-
});
|
|
856
|
-
});
|
|
500
|
+
emitNetworkError(onUpdate, networkError, url);
|
|
857
501
|
return;
|
|
858
502
|
}
|
|
859
503
|
|
|
860
504
|
throw error;
|
|
505
|
+
} finally {
|
|
506
|
+
tx[Symbol.dispose]();
|
|
861
507
|
}
|
|
862
508
|
},
|
|
863
509
|
|
|
@@ -874,17 +520,39 @@ export function createNavigationBridge(
|
|
|
874
520
|
this.handlePopstate();
|
|
875
521
|
};
|
|
876
522
|
|
|
523
|
+
// When the browser restores a page from bfcache (back-forward cache),
|
|
524
|
+
// any in-flight navigation state is stale. This happens when:
|
|
525
|
+
// 1. A navigation triggers X-RSC-Reload (e.g., response route hit via SPA)
|
|
526
|
+
// 2. window.location.href does a hard navigation
|
|
527
|
+
// 3. The user presses back and the browser restores from bfcache
|
|
528
|
+
// At that point, currentNavigation is still set from step 1, so
|
|
529
|
+
// getState() returns "loading" and the progress bar shows.
|
|
530
|
+
// Abort the stale navigation to reset state to idle.
|
|
531
|
+
const handlePageShow = (event: PageTransitionEvent) => {
|
|
532
|
+
if (event.persisted) {
|
|
533
|
+
debugLog(
|
|
534
|
+
"[Browser] Page restored from bfcache, resetting navigation state",
|
|
535
|
+
);
|
|
536
|
+
eventController.abortNavigation();
|
|
537
|
+
// pagehide flips scrollRestoration to "auto" for bfcache compat;
|
|
538
|
+
// restore "manual" so the router controls scroll on SPA navigations.
|
|
539
|
+
window.history.scrollRestoration = "manual";
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
|
|
877
543
|
// Register cross-tab refresh callback with the store
|
|
878
544
|
store.setCrossTabRefreshCallback(() => {
|
|
879
545
|
this.refresh();
|
|
880
546
|
});
|
|
881
547
|
|
|
882
548
|
window.addEventListener("popstate", handlePopstate);
|
|
883
|
-
|
|
549
|
+
window.addEventListener("pageshow", handlePageShow);
|
|
550
|
+
debugLog("[Browser] Navigation bridge ready");
|
|
884
551
|
|
|
885
552
|
return () => {
|
|
886
553
|
cleanupLinks();
|
|
887
554
|
window.removeEventListener("popstate", handlePopstate);
|
|
555
|
+
window.removeEventListener("pageshow", handlePageShow);
|
|
888
556
|
};
|
|
889
557
|
},
|
|
890
558
|
};
|