@rangojs/router 0.0.0-experimental.124 → 0.0.0-experimental.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rango.js +3 -4
- package/dist/vite/index.js +9 -43
- package/package.json +1 -1
- package/skills/hooks/SKILL.md +2 -2
- package/skills/route/SKILL.md +6 -0
- package/src/__internal.ts +0 -65
- package/src/browser/action-coordinator.ts +1 -1
- package/src/browser/action-fence.ts +10 -0
- package/src/browser/event-controller.ts +1 -83
- package/src/browser/navigation-store-handle.ts +3 -4
- package/src/browser/navigation-store.ts +0 -39
- package/src/browser/navigation-transaction.ts +0 -32
- package/src/browser/partial-update.ts +1 -83
- package/src/browser/prefetch/cache.ts +6 -45
- package/src/browser/prefetch/queue.ts +6 -3
- package/src/browser/rango-state.ts +2 -23
- package/src/browser/react/Link.tsx +0 -2
- package/src/browser/react/NavigationProvider.tsx +2 -1
- package/src/browser/react/ScrollRestoration.tsx +10 -6
- package/src/browser/react/filter-segment-order.ts +0 -2
- package/src/browser/react/index.ts +0 -45
- package/src/browser/react/location-state-shared.ts +0 -13
- package/src/browser/react/location-state.ts +0 -1
- package/src/browser/react/use-action.ts +6 -15
- package/src/browser/react/use-handle.ts +0 -5
- package/src/browser/react/use-link-status.ts +0 -4
- package/src/browser/react/use-navigation.ts +0 -3
- package/src/browser/react/use-params.ts +0 -2
- package/src/browser/react/use-search-params.ts +0 -5
- package/src/browser/react/use-segments.ts +0 -13
- package/src/browser/rsc-router.tsx +2 -2
- package/src/browser/types.ts +0 -1
- package/src/browser/validate-redirect-origin.ts +4 -5
- package/src/build/route-trie.ts +3 -0
- package/src/build/route-types/param-extraction.ts +6 -3
- package/src/build/route-types/router-processing.ts +0 -8
- package/src/cache/cache-policy.ts +0 -54
- package/src/cache/cache-runtime.ts +27 -24
- package/src/cache/cache-scope.ts +0 -27
- package/src/cache/cache-tag.ts +0 -37
- package/src/cache/cf/cf-cache-store.ts +72 -45
- package/src/cache/cf/index.ts +0 -24
- package/src/cache/document-cache.ts +0 -36
- package/src/cache/handle-snapshot.ts +0 -40
- package/src/cache/index.ts +0 -27
- package/src/cache/memory-segment-store.ts +0 -52
- package/src/cache/profile-registry.ts +7 -3
- package/src/cache/read-through-swr.ts +41 -11
- package/src/cache/segment-codec.ts +0 -16
- package/src/cache/types.ts +0 -98
- package/src/client.rsc.tsx +1 -22
- package/src/client.tsx +14 -32
- package/src/deps/ssr.ts +0 -1
- package/src/handle.ts +2 -12
- package/src/handles/MetaTags.tsx +0 -14
- package/src/handles/meta.ts +0 -39
- package/src/host/cookie-handler.ts +0 -36
- package/src/host/errors.ts +0 -24
- package/src/host/index.ts +6 -0
- package/src/host/pattern-matcher.ts +7 -50
- package/src/host/router.ts +1 -65
- package/src/host/testing.ts +0 -16
- package/src/host/types.ts +6 -2
- package/src/href-client.ts +0 -4
- package/src/index.rsc.ts +20 -2
- package/src/internal-debug.ts +2 -4
- package/src/loader.rsc.ts +4 -15
- package/src/loader.ts +3 -9
- package/src/network-error-thrower.tsx +1 -6
- package/src/outlet-provider.tsx +1 -5
- package/src/prerender/param-hash.ts +10 -11
- package/src/prerender/store.ts +23 -30
- package/src/prerender.ts +34 -0
- package/src/root-error-boundary.tsx +1 -19
- package/src/route-content-wrapper.tsx +1 -44
- package/src/route-definition/dsl-helpers.ts +7 -19
- package/src/route-definition/helpers-types.ts +3 -3
- package/src/route-definition/redirect.ts +11 -1
- package/src/route-map-builder.ts +0 -16
- package/src/router/content-negotiation.ts +0 -13
- package/src/router/error-handling.ts +12 -16
- package/src/router/find-match.ts +4 -30
- package/src/router/intercept-resolution.ts +10 -1
- package/src/router/lazy-includes.ts +1 -57
- package/src/router/loader-resolution.ts +3 -2
- package/src/router/logging.ts +0 -6
- package/src/router/manifest.ts +1 -25
- package/src/router/match-api.ts +0 -20
- package/src/router/match-context.ts +0 -22
- package/src/router/match-handlers.ts +0 -43
- package/src/router/match-middleware/background-revalidation.ts +0 -7
- package/src/router/match-middleware/cache-lookup.ts +1 -54
- package/src/router/match-middleware/cache-store.ts +0 -31
- package/src/router/match-middleware/intercept-resolution.ts +0 -22
- package/src/router/match-middleware/segment-resolution.ts +0 -21
- package/src/router/match-pipelines.ts +1 -42
- package/src/router/match-result.ts +1 -52
- package/src/router/metrics.ts +0 -34
- package/src/router/middleware-cookies.ts +0 -13
- package/src/router/middleware-types.ts +0 -115
- package/src/router/middleware.ts +7 -30
- package/src/router/navigation-snapshot.ts +0 -51
- package/src/router/params-util.ts +23 -0
- package/src/router/pattern-matching.ts +1 -33
- package/src/router/prerender-match.ts +29 -45
- package/src/router/request-classification.ts +1 -38
- package/src/router/revalidation.ts +5 -58
- package/src/router/router-context.ts +0 -26
- package/src/router/segment-resolution/fresh.ts +25 -57
- package/src/router/segment-resolution/helpers.ts +34 -0
- package/src/router/segment-resolution/loader-cache.ts +10 -13
- package/src/router/segment-resolution/revalidation.ts +5 -42
- package/src/router/segment-resolution/streamed-handler-telemetry.ts +52 -0
- package/src/router/segment-resolution.ts +4 -1
- package/src/router/telemetry-otel.ts +0 -20
- package/src/router/telemetry.ts +0 -22
- package/src/router/timeout.ts +0 -20
- package/src/router/trie-matching.ts +63 -40
- package/src/router/types.ts +1 -63
- package/src/router/url-params.ts +0 -5
- package/src/router.ts +4 -2
- package/src/rsc/handler.ts +11 -2
- package/src/rsc/helpers.ts +15 -0
- package/src/rsc/origin-guard.ts +0 -12
- package/src/rsc/progressive-enhancement.ts +2 -1
- package/src/rsc/rsc-rendering.ts +2 -7
- package/src/rsc/runtime-warnings.ts +14 -0
- package/src/rsc/server-action.ts +30 -28
- package/src/rsc/types.ts +0 -1
- package/src/search-params.ts +0 -16
- package/src/segment-loader-promise.ts +14 -2
- package/src/segment-system.tsx +79 -88
- package/src/server/handle-store.ts +7 -24
- package/src/server/loader-registry.ts +5 -24
- package/src/server/request-context.ts +6 -78
- package/src/ssr/index.tsx +14 -14
- package/src/static-handler.ts +2 -27
- package/src/testing/cache-status.ts +0 -47
- package/src/testing/collect-handle.ts +1 -24
- package/src/testing/e2e/index.ts +0 -22
- package/src/testing/e2e/matchers.ts +0 -16
- package/src/testing/flight-matchers.ts +0 -13
- package/src/testing/flight-normalize.ts +3 -30
- package/src/testing/flight.ts +0 -48
- package/src/testing/generated-routes.ts +1 -41
- package/src/testing/index.ts +0 -21
- package/src/testing/internal/context.ts +3 -45
- package/src/testing/internal/seed-vars.ts +0 -26
- package/src/testing/render-handler.ts +0 -49
- package/src/testing/render-route.tsx +0 -90
- package/src/testing/run-loader.ts +0 -96
- package/src/testing/run-middleware.ts +0 -26
- package/src/theme/ThemeProvider.tsx +0 -52
- package/src/theme/ThemeScript.tsx +0 -6
- package/src/theme/constants.ts +0 -12
- package/src/theme/index.ts +0 -7
- package/src/theme/theme-context.ts +1 -5
- package/src/theme/theme-script.ts +0 -14
- package/src/theme/use-theme.ts +0 -3
- package/src/types/boundaries.ts +0 -35
- package/src/types/error-types.ts +25 -89
- package/src/types/global-namespace.ts +4 -14
- package/src/types/handler-context.ts +0 -8
- package/src/types/index.ts +0 -10
- package/src/types/request-scope.ts +0 -19
- package/src/types/route-config.ts +6 -50
- package/src/types/route-entry.ts +0 -6
- package/src/types/segments.ts +0 -13
- package/src/urls/include-helper.ts +0 -4
- package/src/urls/index.ts +0 -6
- package/src/urls/path-helper-types.ts +2 -2
- package/src/urls/path-helper.ts +0 -54
- package/src/urls/urls-function.ts +0 -13
- package/src/use-loader.tsx +0 -186
- package/src/vite/discovery/bundle-postprocess.ts +2 -1
- package/src/vite/discovery/discover-routers.ts +6 -7
- package/src/vite/discovery/virtual-module-codegen.ts +1 -11
- package/src/vite/plugin-types.ts +3 -1
- package/src/vite/plugins/cjs-to-esm.ts +0 -11
- package/src/vite/plugins/client-ref-dedup.ts +0 -11
- package/src/vite/plugins/client-ref-hashing.ts +0 -10
- package/src/vite/plugins/cloudflare-protocol-stub.ts +0 -20
- package/src/vite/plugins/expose-action-id.ts +2 -73
- package/src/vite/plugins/expose-id-utils.ts +0 -55
- package/src/vite/plugins/expose-ids/export-analysis.ts +0 -38
- package/src/vite/plugins/expose-ids/handler-transform.ts +0 -15
- package/src/vite/plugins/expose-ids/loader-transform.ts +0 -15
- package/src/vite/plugins/expose-ids/router-transform.ts +0 -13
- package/src/vite/plugins/expose-internal-ids.ts +10 -0
- package/src/vite/plugins/performance-tracks.ts +0 -3
- package/src/vite/plugins/use-cache-transform.ts +0 -36
- package/src/vite/plugins/version-injector.ts +0 -20
- package/src/vite/plugins/version-plugin.ts +1 -49
- package/src/vite/plugins/virtual-entries.ts +0 -15
- package/src/vite/rango.ts +1 -108
- package/src/vite/router-discovery.ts +2 -1
- package/src/vite/utils/ast-handler-extract.ts +0 -16
- package/src/vite/utils/bundle-analysis.ts +6 -13
- package/src/vite/utils/client-chunks.ts +0 -6
- package/src/vite/utils/forward-user-plugins.ts +0 -22
- package/src/vite/utils/manifest-utils.ts +0 -4
- package/src/vite/utils/package-resolution.ts +1 -73
- package/src/vite/utils/prerender-utils.ts +0 -35
- package/src/vite/utils/shared-utils.ts +3 -35
- package/dist/__internal.d.ts +0 -83
- package/dist/__internal.d.ts.map +0 -1
- package/dist/__internal.js +0 -19
- package/dist/__internal.js.map +0 -1
- package/dist/__mocks__/version.d.ts +0 -7
- package/dist/__mocks__/version.d.ts.map +0 -1
- package/dist/__mocks__/version.js +0 -7
- package/dist/__mocks__/version.js.map +0 -1
- package/dist/__tests__/client-href.test.d.ts +0 -2
- package/dist/__tests__/client-href.test.d.ts.map +0 -1
- package/dist/__tests__/client-href.test.js +0 -74
- package/dist/__tests__/client-href.test.js.map +0 -1
- package/dist/__tests__/component-utils.test.d.ts +0 -2
- package/dist/__tests__/component-utils.test.d.ts.map +0 -1
- package/dist/__tests__/component-utils.test.js +0 -51
- package/dist/__tests__/component-utils.test.js.map +0 -1
- package/dist/__tests__/event-controller.test.d.ts +0 -2
- package/dist/__tests__/event-controller.test.d.ts.map +0 -1
- package/dist/__tests__/event-controller.test.js +0 -538
- package/dist/__tests__/event-controller.test.js.map +0 -1
- package/dist/__tests__/helpers/route-tree.d.ts +0 -118
- package/dist/__tests__/helpers/route-tree.d.ts.map +0 -1
- package/dist/__tests__/helpers/route-tree.js +0 -374
- package/dist/__tests__/helpers/route-tree.js.map +0 -1
- package/dist/__tests__/match-result.test.d.ts +0 -2
- package/dist/__tests__/match-result.test.d.ts.map +0 -1
- package/dist/__tests__/match-result.test.js +0 -154
- package/dist/__tests__/match-result.test.js.map +0 -1
- package/dist/__tests__/navigation-store.test.d.ts +0 -2
- package/dist/__tests__/navigation-store.test.d.ts.map +0 -1
- package/dist/__tests__/navigation-store.test.js +0 -440
- package/dist/__tests__/navigation-store.test.js.map +0 -1
- package/dist/__tests__/partial-update.test.d.ts +0 -2
- package/dist/__tests__/partial-update.test.d.ts.map +0 -1
- package/dist/__tests__/partial-update.test.js +0 -1009
- package/dist/__tests__/partial-update.test.js.map +0 -1
- package/dist/__tests__/reverse-types.test.d.ts +0 -8
- package/dist/__tests__/reverse-types.test.d.ts.map +0 -1
- package/dist/__tests__/reverse-types.test.js +0 -656
- package/dist/__tests__/reverse-types.test.js.map +0 -1
- package/dist/__tests__/route-definition.test.d.ts +0 -2
- package/dist/__tests__/route-definition.test.d.ts.map +0 -1
- package/dist/__tests__/route-definition.test.js +0 -55
- package/dist/__tests__/route-definition.test.js.map +0 -1
- package/dist/__tests__/router-helpers.test.d.ts +0 -2
- package/dist/__tests__/router-helpers.test.d.ts.map +0 -1
- package/dist/__tests__/router-helpers.test.js +0 -377
- package/dist/__tests__/router-helpers.test.js.map +0 -1
- package/dist/__tests__/router-integration-2.test.d.ts +0 -2
- package/dist/__tests__/router-integration-2.test.d.ts.map +0 -1
- package/dist/__tests__/router-integration-2.test.js +0 -426
- package/dist/__tests__/router-integration-2.test.js.map +0 -1
- package/dist/__tests__/router-integration.test.d.ts +0 -2
- package/dist/__tests__/router-integration.test.d.ts.map +0 -1
- package/dist/__tests__/router-integration.test.js +0 -1051
- package/dist/__tests__/router-integration.test.js.map +0 -1
- package/dist/__tests__/search-params.test.d.ts +0 -5
- package/dist/__tests__/search-params.test.d.ts.map +0 -1
- package/dist/__tests__/search-params.test.js +0 -306
- package/dist/__tests__/search-params.test.js.map +0 -1
- package/dist/__tests__/segment-system.test.d.ts +0 -2
- package/dist/__tests__/segment-system.test.d.ts.map +0 -1
- package/dist/__tests__/segment-system.test.js +0 -627
- package/dist/__tests__/segment-system.test.js.map +0 -1
- package/dist/__tests__/static-handler-types.test.d.ts +0 -8
- package/dist/__tests__/static-handler-types.test.d.ts.map +0 -1
- package/dist/__tests__/static-handler-types.test.js +0 -63
- package/dist/__tests__/static-handler-types.test.js.map +0 -1
- package/dist/__tests__/urls.test.d.ts +0 -2
- package/dist/__tests__/urls.test.d.ts.map +0 -1
- package/dist/__tests__/urls.test.js +0 -421
- package/dist/__tests__/urls.test.js.map +0 -1
- package/dist/__tests__/use-mount.test.d.ts +0 -2
- package/dist/__tests__/use-mount.test.d.ts.map +0 -1
- package/dist/__tests__/use-mount.test.js +0 -35
- package/dist/__tests__/use-mount.test.js.map +0 -1
- package/dist/bin/rango.d.ts +0 -2
- package/dist/bin/rango.d.ts.map +0 -1
- package/dist/bin/rango.js.map +0 -1
- package/dist/browser/event-controller.d.ts +0 -191
- package/dist/browser/event-controller.d.ts.map +0 -1
- package/dist/browser/event-controller.js +0 -559
- package/dist/browser/event-controller.js.map +0 -1
- package/dist/browser/index.d.ts +0 -2
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -14
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/link-interceptor.d.ts +0 -38
- package/dist/browser/link-interceptor.d.ts.map +0 -1
- package/dist/browser/link-interceptor.js +0 -99
- package/dist/browser/link-interceptor.js.map +0 -1
- package/dist/browser/logging.d.ts +0 -10
- package/dist/browser/logging.d.ts.map +0 -1
- package/dist/browser/logging.js +0 -29
- package/dist/browser/logging.js.map +0 -1
- package/dist/browser/lru-cache.d.ts +0 -17
- package/dist/browser/lru-cache.d.ts.map +0 -1
- package/dist/browser/lru-cache.js +0 -50
- package/dist/browser/lru-cache.js.map +0 -1
- package/dist/browser/merge-segment-loaders.d.ts +0 -39
- package/dist/browser/merge-segment-loaders.d.ts.map +0 -1
- package/dist/browser/merge-segment-loaders.js +0 -102
- package/dist/browser/merge-segment-loaders.js.map +0 -1
- package/dist/browser/navigation-bridge.d.ts +0 -102
- package/dist/browser/navigation-bridge.d.ts.map +0 -1
- package/dist/browser/navigation-bridge.js +0 -708
- package/dist/browser/navigation-bridge.js.map +0 -1
- package/dist/browser/navigation-client.d.ts +0 -25
- package/dist/browser/navigation-client.d.ts.map +0 -1
- package/dist/browser/navigation-client.js +0 -157
- package/dist/browser/navigation-client.js.map +0 -1
- package/dist/browser/navigation-store.d.ts +0 -101
- package/dist/browser/navigation-store.d.ts.map +0 -1
- package/dist/browser/navigation-store.js +0 -625
- package/dist/browser/navigation-store.js.map +0 -1
- package/dist/browser/partial-update.d.ts +0 -75
- package/dist/browser/partial-update.d.ts.map +0 -1
- package/dist/browser/partial-update.js +0 -426
- package/dist/browser/partial-update.js.map +0 -1
- package/dist/browser/react/Link.d.ts +0 -86
- package/dist/browser/react/Link.d.ts.map +0 -1
- package/dist/browser/react/Link.js +0 -128
- package/dist/browser/react/Link.js.map +0 -1
- package/dist/browser/react/NavigationProvider.d.ts +0 -63
- package/dist/browser/react/NavigationProvider.d.ts.map +0 -1
- package/dist/browser/react/NavigationProvider.js +0 -216
- package/dist/browser/react/NavigationProvider.js.map +0 -1
- package/dist/browser/react/ScrollRestoration.d.ts +0 -75
- package/dist/browser/react/ScrollRestoration.d.ts.map +0 -1
- package/dist/browser/react/ScrollRestoration.js +0 -57
- package/dist/browser/react/ScrollRestoration.js.map +0 -1
- package/dist/browser/react/context.d.ts +0 -46
- package/dist/browser/react/context.d.ts.map +0 -1
- package/dist/browser/react/context.js +0 -10
- package/dist/browser/react/context.js.map +0 -1
- package/dist/browser/react/index.d.ts +0 -11
- package/dist/browser/react/index.d.ts.map +0 -1
- package/dist/browser/react/index.js +0 -22
- package/dist/browser/react/index.js.map +0 -1
- package/dist/browser/react/location-state-shared.d.ts +0 -63
- package/dist/browser/react/location-state-shared.d.ts.map +0 -1
- package/dist/browser/react/location-state-shared.js +0 -81
- package/dist/browser/react/location-state-shared.js.map +0 -1
- package/dist/browser/react/location-state.d.ts +0 -23
- package/dist/browser/react/location-state.d.ts.map +0 -1
- package/dist/browser/react/location-state.js +0 -29
- package/dist/browser/react/location-state.js.map +0 -1
- package/dist/browser/react/mount-context.d.ts +0 -24
- package/dist/browser/react/mount-context.d.ts.map +0 -1
- package/dist/browser/react/mount-context.js +0 -24
- package/dist/browser/react/mount-context.js.map +0 -1
- package/dist/browser/react/use-action.d.ts +0 -64
- package/dist/browser/react/use-action.d.ts.map +0 -1
- package/dist/browser/react/use-action.js +0 -134
- package/dist/browser/react/use-action.js.map +0 -1
- package/dist/browser/react/use-client-cache.d.ts +0 -41
- package/dist/browser/react/use-client-cache.d.ts.map +0 -1
- package/dist/browser/react/use-client-cache.js +0 -39
- package/dist/browser/react/use-client-cache.js.map +0 -1
- package/dist/browser/react/use-handle.d.ts +0 -31
- package/dist/browser/react/use-handle.d.ts.map +0 -1
- package/dist/browser/react/use-handle.js +0 -144
- package/dist/browser/react/use-handle.js.map +0 -1
- package/dist/browser/react/use-href.d.ts +0 -33
- package/dist/browser/react/use-href.d.ts.map +0 -1
- package/dist/browser/react/use-href.js +0 -39
- package/dist/browser/react/use-href.js.map +0 -1
- package/dist/browser/react/use-link-status.d.ts +0 -37
- package/dist/browser/react/use-link-status.d.ts.map +0 -1
- package/dist/browser/react/use-link-status.js +0 -99
- package/dist/browser/react/use-link-status.js.map +0 -1
- package/dist/browser/react/use-mount.d.ts +0 -25
- package/dist/browser/react/use-mount.d.ts.map +0 -1
- package/dist/browser/react/use-mount.js +0 -30
- package/dist/browser/react/use-mount.js.map +0 -1
- package/dist/browser/react/use-navigation.d.ts +0 -27
- package/dist/browser/react/use-navigation.d.ts.map +0 -1
- package/dist/browser/react/use-navigation.js +0 -87
- package/dist/browser/react/use-navigation.js.map +0 -1
- package/dist/browser/react/use-segments.d.ts +0 -38
- package/dist/browser/react/use-segments.d.ts.map +0 -1
- package/dist/browser/react/use-segments.js +0 -130
- package/dist/browser/react/use-segments.js.map +0 -1
- package/dist/browser/request-controller.d.ts +0 -26
- package/dist/browser/request-controller.d.ts.map +0 -1
- package/dist/browser/request-controller.js +0 -147
- package/dist/browser/request-controller.js.map +0 -1
- package/dist/browser/rsc-router.d.ts +0 -129
- package/dist/browser/rsc-router.d.ts.map +0 -1
- package/dist/browser/rsc-router.js +0 -195
- package/dist/browser/rsc-router.js.map +0 -1
- package/dist/browser/scroll-restoration.d.ts +0 -93
- package/dist/browser/scroll-restoration.d.ts.map +0 -1
- package/dist/browser/scroll-restoration.js +0 -321
- package/dist/browser/scroll-restoration.js.map +0 -1
- package/dist/browser/segment-structure-assert.d.ts +0 -17
- package/dist/browser/segment-structure-assert.d.ts.map +0 -1
- package/dist/browser/segment-structure-assert.js +0 -59
- package/dist/browser/segment-structure-assert.js.map +0 -1
- package/dist/browser/server-action-bridge.d.ts +0 -26
- package/dist/browser/server-action-bridge.d.ts.map +0 -1
- package/dist/browser/server-action-bridge.js +0 -668
- package/dist/browser/server-action-bridge.js.map +0 -1
- package/dist/browser/shallow.d.ts +0 -12
- package/dist/browser/shallow.d.ts.map +0 -1
- package/dist/browser/shallow.js +0 -34
- package/dist/browser/shallow.js.map +0 -1
- package/dist/browser/types.d.ts +0 -369
- package/dist/browser/types.d.ts.map +0 -1
- package/dist/browser/types.js +0 -2
- package/dist/browser/types.js.map +0 -1
- package/dist/build/__tests__/generate-cli.test.d.ts +0 -2
- package/dist/build/__tests__/generate-cli.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-cli.test.js +0 -237
- package/dist/build/__tests__/generate-cli.test.js.map +0 -1
- package/dist/build/__tests__/generate-manifest.test.d.ts +0 -2
- package/dist/build/__tests__/generate-manifest.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-manifest.test.js +0 -119
- package/dist/build/__tests__/generate-manifest.test.js.map +0 -1
- package/dist/build/__tests__/generate-route-types.test.d.ts +0 -2
- package/dist/build/__tests__/generate-route-types.test.d.ts.map +0 -1
- package/dist/build/__tests__/generate-route-types.test.js +0 -620
- package/dist/build/__tests__/generate-route-types.test.js.map +0 -1
- package/dist/build/__tests__/per-router-manifest.test.d.ts +0 -2
- package/dist/build/__tests__/per-router-manifest.test.d.ts.map +0 -1
- package/dist/build/__tests__/per-router-manifest.test.js +0 -308
- package/dist/build/__tests__/per-router-manifest.test.js.map +0 -1
- package/dist/build/generate-manifest.d.ts +0 -81
- package/dist/build/generate-manifest.d.ts.map +0 -1
- package/dist/build/generate-manifest.js +0 -276
- package/dist/build/generate-manifest.js.map +0 -1
- package/dist/build/generate-route-types.d.ts +0 -115
- package/dist/build/generate-route-types.d.ts.map +0 -1
- package/dist/build/generate-route-types.js +0 -740
- package/dist/build/generate-route-types.js.map +0 -1
- package/dist/build/index.d.ts +0 -21
- package/dist/build/index.d.ts.map +0 -1
- package/dist/build/index.js +0 -21
- package/dist/build/index.js.map +0 -1
- package/dist/build/route-trie.d.ts +0 -71
- package/dist/build/route-trie.d.ts.map +0 -1
- package/dist/build/route-trie.js +0 -175
- package/dist/build/route-trie.js.map +0 -1
- package/dist/cache/__tests__/cache-scope.test.d.ts +0 -2
- package/dist/cache/__tests__/cache-scope.test.d.ts.map +0 -1
- package/dist/cache/__tests__/cache-scope.test.js +0 -208
- package/dist/cache/__tests__/cache-scope.test.js.map +0 -1
- package/dist/cache/__tests__/document-cache.test.d.ts +0 -2
- package/dist/cache/__tests__/document-cache.test.d.ts.map +0 -1
- package/dist/cache/__tests__/document-cache.test.js +0 -345
- package/dist/cache/__tests__/document-cache.test.js.map +0 -1
- package/dist/cache/__tests__/memory-segment-store.test.d.ts +0 -2
- package/dist/cache/__tests__/memory-segment-store.test.d.ts.map +0 -1
- package/dist/cache/__tests__/memory-segment-store.test.js +0 -425
- package/dist/cache/__tests__/memory-segment-store.test.js.map +0 -1
- package/dist/cache/__tests__/memory-store.test.d.ts +0 -2
- package/dist/cache/__tests__/memory-store.test.d.ts.map +0 -1
- package/dist/cache/__tests__/memory-store.test.js +0 -367
- package/dist/cache/__tests__/memory-store.test.js.map +0 -1
- package/dist/cache/cache-scope.d.ts +0 -102
- package/dist/cache/cache-scope.d.ts.map +0 -1
- package/dist/cache/cache-scope.js +0 -440
- package/dist/cache/cache-scope.js.map +0 -1
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts +0 -2
- package/dist/cache/cf/__tests__/cf-cache-store.test.d.ts.map +0 -1
- package/dist/cache/cf/__tests__/cf-cache-store.test.js +0 -330
- package/dist/cache/cf/__tests__/cf-cache-store.test.js.map +0 -1
- package/dist/cache/cf/cf-cache-store.d.ts +0 -165
- package/dist/cache/cf/cf-cache-store.d.ts.map +0 -1
- package/dist/cache/cf/cf-cache-store.js +0 -242
- package/dist/cache/cf/cf-cache-store.js.map +0 -1
- package/dist/cache/cf/index.d.ts +0 -14
- package/dist/cache/cf/index.d.ts.map +0 -1
- package/dist/cache/cf/index.js +0 -17
- package/dist/cache/cf/index.js.map +0 -1
- package/dist/cache/document-cache.d.ts +0 -64
- package/dist/cache/document-cache.d.ts.map +0 -1
- package/dist/cache/document-cache.js +0 -228
- package/dist/cache/document-cache.js.map +0 -1
- package/dist/cache/index.d.ts +0 -19
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/index.js +0 -21
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/memory-segment-store.d.ts +0 -110
- package/dist/cache/memory-segment-store.d.ts.map +0 -1
- package/dist/cache/memory-segment-store.js +0 -117
- package/dist/cache/memory-segment-store.js.map +0 -1
- package/dist/cache/memory-store.d.ts +0 -41
- package/dist/cache/memory-store.d.ts.map +0 -1
- package/dist/cache/memory-store.js +0 -191
- package/dist/cache/memory-store.js.map +0 -1
- package/dist/cache/types.d.ts +0 -317
- package/dist/cache/types.d.ts.map +0 -1
- package/dist/cache/types.js +0 -12
- package/dist/cache/types.js.map +0 -1
- package/dist/client.d.ts +0 -248
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -367
- package/dist/client.js.map +0 -1
- package/dist/client.rsc.d.ts +0 -26
- package/dist/client.rsc.d.ts.map +0 -1
- package/dist/client.rsc.js +0 -46
- package/dist/client.rsc.js.map +0 -1
- package/dist/component-utils.d.ts +0 -36
- package/dist/component-utils.d.ts.map +0 -1
- package/dist/component-utils.js +0 -61
- package/dist/component-utils.js.map +0 -1
- package/dist/components/DefaultDocument.d.ts +0 -13
- package/dist/components/DefaultDocument.d.ts.map +0 -1
- package/dist/components/DefaultDocument.js +0 -15
- package/dist/components/DefaultDocument.js.map +0 -1
- package/dist/debug.d.ts +0 -58
- package/dist/debug.d.ts.map +0 -1
- package/dist/debug.js +0 -157
- package/dist/debug.js.map +0 -1
- package/dist/default-error-boundary.d.ts +0 -11
- package/dist/default-error-boundary.d.ts.map +0 -1
- package/dist/default-error-boundary.js +0 -45
- package/dist/default-error-boundary.js.map +0 -1
- package/dist/deps/browser.d.ts +0 -2
- package/dist/deps/browser.d.ts.map +0 -1
- package/dist/deps/browser.js +0 -3
- package/dist/deps/browser.js.map +0 -1
- package/dist/deps/html-stream-client.d.ts +0 -2
- package/dist/deps/html-stream-client.d.ts.map +0 -1
- package/dist/deps/html-stream-client.js +0 -3
- package/dist/deps/html-stream-client.js.map +0 -1
- package/dist/deps/html-stream-server.d.ts +0 -2
- package/dist/deps/html-stream-server.d.ts.map +0 -1
- package/dist/deps/html-stream-server.js +0 -3
- package/dist/deps/html-stream-server.js.map +0 -1
- package/dist/deps/rsc.d.ts +0 -2
- package/dist/deps/rsc.d.ts.map +0 -1
- package/dist/deps/rsc.js +0 -4
- package/dist/deps/rsc.js.map +0 -1
- package/dist/deps/ssr.d.ts +0 -2
- package/dist/deps/ssr.d.ts.map +0 -1
- package/dist/deps/ssr.js +0 -3
- package/dist/deps/ssr.js.map +0 -1
- package/dist/errors.d.ts +0 -174
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -241
- package/dist/errors.js.map +0 -1
- package/dist/handle.d.ts +0 -78
- package/dist/handle.d.ts.map +0 -1
- package/dist/handle.js +0 -82
- package/dist/handle.js.map +0 -1
- package/dist/handles/MetaTags.d.ts +0 -14
- package/dist/handles/MetaTags.d.ts.map +0 -1
- package/dist/handles/MetaTags.js +0 -136
- package/dist/handles/MetaTags.js.map +0 -1
- package/dist/handles/index.d.ts +0 -6
- package/dist/handles/index.d.ts.map +0 -1
- package/dist/handles/index.js +0 -6
- package/dist/handles/index.js.map +0 -1
- package/dist/handles/meta.d.ts +0 -39
- package/dist/handles/meta.d.ts.map +0 -1
- package/dist/handles/meta.js +0 -202
- package/dist/handles/meta.js.map +0 -1
- package/dist/host/__tests__/errors.test.d.ts +0 -2
- package/dist/host/__tests__/errors.test.d.ts.map +0 -1
- package/dist/host/__tests__/errors.test.js +0 -76
- package/dist/host/__tests__/errors.test.js.map +0 -1
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts +0 -2
- package/dist/host/__tests__/pattern-comprehensive.test.d.ts.map +0 -1
- package/dist/host/__tests__/pattern-comprehensive.test.js +0 -732
- package/dist/host/__tests__/pattern-comprehensive.test.js.map +0 -1
- package/dist/host/__tests__/pattern-matcher.test.d.ts +0 -2
- package/dist/host/__tests__/pattern-matcher.test.d.ts.map +0 -1
- package/dist/host/__tests__/pattern-matcher.test.js +0 -251
- package/dist/host/__tests__/pattern-matcher.test.js.map +0 -1
- package/dist/host/__tests__/router.test.d.ts +0 -2
- package/dist/host/__tests__/router.test.d.ts.map +0 -1
- package/dist/host/__tests__/router.test.js +0 -241
- package/dist/host/__tests__/router.test.js.map +0 -1
- package/dist/host/__tests__/testing.test.d.ts +0 -2
- package/dist/host/__tests__/testing.test.d.ts.map +0 -1
- package/dist/host/__tests__/testing.test.js +0 -64
- package/dist/host/__tests__/testing.test.js.map +0 -1
- package/dist/host/__tests__/utils.test.d.ts +0 -2
- package/dist/host/__tests__/utils.test.d.ts.map +0 -1
- package/dist/host/__tests__/utils.test.js +0 -29
- package/dist/host/__tests__/utils.test.js.map +0 -1
- package/dist/host/cookie-handler.d.ts +0 -34
- package/dist/host/cookie-handler.d.ts.map +0 -1
- package/dist/host/cookie-handler.js +0 -124
- package/dist/host/cookie-handler.js.map +0 -1
- package/dist/host/errors.d.ts +0 -56
- package/dist/host/errors.d.ts.map +0 -1
- package/dist/host/errors.js +0 -79
- package/dist/host/errors.js.map +0 -1
- package/dist/host/index.d.ts +0 -29
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js +0 -32
- package/dist/host/index.js.map +0 -1
- package/dist/host/pattern-matcher.d.ts +0 -36
- package/dist/host/pattern-matcher.d.ts.map +0 -1
- package/dist/host/pattern-matcher.js +0 -172
- package/dist/host/pattern-matcher.js.map +0 -1
- package/dist/host/router.d.ts +0 -26
- package/dist/host/router.d.ts.map +0 -1
- package/dist/host/router.js +0 -218
- package/dist/host/router.js.map +0 -1
- package/dist/host/testing.d.ts +0 -36
- package/dist/host/testing.d.ts.map +0 -1
- package/dist/host/testing.js +0 -55
- package/dist/host/testing.js.map +0 -1
- package/dist/host/types.d.ts +0 -115
- package/dist/host/types.d.ts.map +0 -1
- package/dist/host/types.js +0 -7
- package/dist/host/types.js.map +0 -1
- package/dist/host/utils.d.ts +0 -21
- package/dist/host/utils.d.ts.map +0 -1
- package/dist/host/utils.js +0 -23
- package/dist/host/utils.js.map +0 -1
- package/dist/href-client.d.ts +0 -131
- package/dist/href-client.d.ts.map +0 -1
- package/dist/href-client.js +0 -64
- package/dist/href-client.js.map +0 -1
- package/dist/href-context.d.ts +0 -29
- package/dist/href-context.d.ts.map +0 -1
- package/dist/href-context.js +0 -21
- package/dist/href-context.js.map +0 -1
- package/dist/index.d.ts +0 -73
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -91
- package/dist/index.js.map +0 -1
- package/dist/index.rsc.d.ts +0 -32
- package/dist/index.rsc.d.ts.map +0 -1
- package/dist/index.rsc.js +0 -40
- package/dist/index.rsc.js.map +0 -1
- package/dist/internal-debug.d.ts +0 -2
- package/dist/internal-debug.d.ts.map +0 -1
- package/dist/internal-debug.js +0 -5
- package/dist/internal-debug.js.map +0 -1
- package/dist/loader.d.ts +0 -14
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -20
- package/dist/loader.js.map +0 -1
- package/dist/loader.rsc.d.ts +0 -19
- package/dist/loader.rsc.d.ts.map +0 -1
- package/dist/loader.rsc.js +0 -99
- package/dist/loader.rsc.js.map +0 -1
- package/dist/network-error-thrower.d.ts +0 -17
- package/dist/network-error-thrower.d.ts.map +0 -1
- package/dist/network-error-thrower.js +0 -14
- package/dist/network-error-thrower.js.map +0 -1
- package/dist/outlet-context.d.ts +0 -13
- package/dist/outlet-context.d.ts.map +0 -1
- package/dist/outlet-context.js +0 -3
- package/dist/outlet-context.js.map +0 -1
- package/dist/prerender/__tests__/param-hash.test.d.ts +0 -2
- package/dist/prerender/__tests__/param-hash.test.d.ts.map +0 -1
- package/dist/prerender/__tests__/param-hash.test.js +0 -148
- package/dist/prerender/__tests__/param-hash.test.js.map +0 -1
- package/dist/prerender/param-hash.d.ts +0 -16
- package/dist/prerender/param-hash.d.ts.map +0 -1
- package/dist/prerender/param-hash.js +0 -36
- package/dist/prerender/param-hash.js.map +0 -1
- package/dist/prerender/store.d.ts +0 -38
- package/dist/prerender/store.d.ts.map +0 -1
- package/dist/prerender/store.js +0 -61
- package/dist/prerender/store.js.map +0 -1
- package/dist/prerender.d.ts +0 -66
- package/dist/prerender.d.ts.map +0 -1
- package/dist/prerender.js +0 -57
- package/dist/prerender.js.map +0 -1
- package/dist/reverse.d.ts +0 -196
- package/dist/reverse.d.ts.map +0 -1
- package/dist/reverse.js +0 -78
- package/dist/reverse.js.map +0 -1
- package/dist/root-error-boundary.d.ts +0 -33
- package/dist/root-error-boundary.d.ts.map +0 -1
- package/dist/root-error-boundary.js +0 -165
- package/dist/root-error-boundary.js.map +0 -1
- package/dist/route-content-wrapper.d.ts +0 -46
- package/dist/route-content-wrapper.d.ts.map +0 -1
- package/dist/route-content-wrapper.js +0 -77
- package/dist/route-content-wrapper.js.map +0 -1
- package/dist/route-definition.d.ts +0 -421
- package/dist/route-definition.d.ts.map +0 -1
- package/dist/route-definition.js +0 -868
- package/dist/route-definition.js.map +0 -1
- package/dist/route-map-builder.d.ts +0 -155
- package/dist/route-map-builder.d.ts.map +0 -1
- package/dist/route-map-builder.js +0 -237
- package/dist/route-map-builder.js.map +0 -1
- package/dist/route-types.d.ts +0 -165
- package/dist/route-types.d.ts.map +0 -1
- package/dist/route-types.js +0 -7
- package/dist/route-types.js.map +0 -1
- package/dist/router/__tests__/handler-context.test.d.ts +0 -2
- package/dist/router/__tests__/handler-context.test.d.ts.map +0 -1
- package/dist/router/__tests__/handler-context.test.js +0 -65
- package/dist/router/__tests__/handler-context.test.js.map +0 -1
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts +0 -2
- package/dist/router/__tests__/loader-cycle-detection.test.d.ts.map +0 -1
- package/dist/router/__tests__/loader-cycle-detection.test.js +0 -221
- package/dist/router/__tests__/loader-cycle-detection.test.js.map +0 -1
- package/dist/router/__tests__/match-context.test.d.ts +0 -2
- package/dist/router/__tests__/match-context.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-context.test.js +0 -92
- package/dist/router/__tests__/match-context.test.js.map +0 -1
- package/dist/router/__tests__/match-pipelines.test.d.ts +0 -2
- package/dist/router/__tests__/match-pipelines.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-pipelines.test.js +0 -417
- package/dist/router/__tests__/match-pipelines.test.js.map +0 -1
- package/dist/router/__tests__/match-result.test.d.ts +0 -2
- package/dist/router/__tests__/match-result.test.d.ts.map +0 -1
- package/dist/router/__tests__/match-result.test.js +0 -457
- package/dist/router/__tests__/match-result.test.js.map +0 -1
- package/dist/router/__tests__/on-error.test.d.ts +0 -2
- package/dist/router/__tests__/on-error.test.d.ts.map +0 -1
- package/dist/router/__tests__/on-error.test.js +0 -678
- package/dist/router/__tests__/on-error.test.js.map +0 -1
- package/dist/router/__tests__/pattern-matching.test.d.ts +0 -2
- package/dist/router/__tests__/pattern-matching.test.d.ts.map +0 -1
- package/dist/router/__tests__/pattern-matching.test.js +0 -629
- package/dist/router/__tests__/pattern-matching.test.js.map +0 -1
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts +0 -2
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.d.ts.map +0 -1
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js +0 -155
- package/dist/router/__tests__/segment-resolution-parallel-loading.test.js.map +0 -1
- package/dist/router/error-handling.d.ts +0 -77
- package/dist/router/error-handling.d.ts.map +0 -1
- package/dist/router/error-handling.js +0 -202
- package/dist/router/error-handling.js.map +0 -1
- package/dist/router/handler-context.d.ts +0 -20
- package/dist/router/handler-context.d.ts.map +0 -1
- package/dist/router/handler-context.js +0 -198
- package/dist/router/handler-context.js.map +0 -1
- package/dist/router/intercept-resolution.d.ts +0 -66
- package/dist/router/intercept-resolution.d.ts.map +0 -1
- package/dist/router/intercept-resolution.js +0 -246
- package/dist/router/intercept-resolution.js.map +0 -1
- package/dist/router/loader-resolution.d.ts +0 -64
- package/dist/router/loader-resolution.d.ts.map +0 -1
- package/dist/router/loader-resolution.js +0 -284
- package/dist/router/loader-resolution.js.map +0 -1
- package/dist/router/logging.d.ts +0 -15
- package/dist/router/logging.d.ts.map +0 -1
- package/dist/router/logging.js +0 -99
- package/dist/router/logging.js.map +0 -1
- package/dist/router/manifest.d.ts +0 -22
- package/dist/router/manifest.d.ts.map +0 -1
- package/dist/router/manifest.js +0 -181
- package/dist/router/manifest.js.map +0 -1
- package/dist/router/match-api.d.ts +0 -35
- package/dist/router/match-api.d.ts.map +0 -1
- package/dist/router/match-api.js +0 -406
- package/dist/router/match-api.js.map +0 -1
- package/dist/router/match-context.d.ts +0 -206
- package/dist/router/match-context.d.ts.map +0 -1
- package/dist/router/match-context.js +0 -17
- package/dist/router/match-context.js.map +0 -1
- package/dist/router/match-middleware/background-revalidation.d.ts +0 -127
- package/dist/router/match-middleware/background-revalidation.d.ts.map +0 -1
- package/dist/router/match-middleware/background-revalidation.js +0 -75
- package/dist/router/match-middleware/background-revalidation.js.map +0 -1
- package/dist/router/match-middleware/cache-lookup.d.ts +0 -112
- package/dist/router/match-middleware/cache-lookup.d.ts.map +0 -1
- package/dist/router/match-middleware/cache-lookup.js +0 -257
- package/dist/router/match-middleware/cache-lookup.js.map +0 -1
- package/dist/router/match-middleware/cache-store.d.ts +0 -113
- package/dist/router/match-middleware/cache-store.d.ts.map +0 -1
- package/dist/router/match-middleware/cache-store.js +0 -108
- package/dist/router/match-middleware/cache-store.js.map +0 -1
- package/dist/router/match-middleware/index.d.ts +0 -81
- package/dist/router/match-middleware/index.d.ts.map +0 -1
- package/dist/router/match-middleware/index.js +0 -80
- package/dist/router/match-middleware/index.js.map +0 -1
- package/dist/router/match-middleware/intercept-resolution.d.ts +0 -117
- package/dist/router/match-middleware/intercept-resolution.d.ts.map +0 -1
- package/dist/router/match-middleware/intercept-resolution.js +0 -134
- package/dist/router/match-middleware/intercept-resolution.js.map +0 -1
- package/dist/router/match-middleware/segment-resolution.d.ts +0 -99
- package/dist/router/match-middleware/segment-resolution.d.ts.map +0 -1
- package/dist/router/match-middleware/segment-resolution.js +0 -53
- package/dist/router/match-middleware/segment-resolution.js.map +0 -1
- package/dist/router/match-pipelines.d.ts +0 -147
- package/dist/router/match-pipelines.d.ts.map +0 -1
- package/dist/router/match-pipelines.js +0 -82
- package/dist/router/match-pipelines.js.map +0 -1
- package/dist/router/match-result.d.ts +0 -126
- package/dist/router/match-result.d.ts.map +0 -1
- package/dist/router/match-result.js +0 -93
- package/dist/router/match-result.js.map +0 -1
- package/dist/router/metrics.d.ts +0 -20
- package/dist/router/metrics.d.ts.map +0 -1
- package/dist/router/metrics.js +0 -47
- package/dist/router/metrics.js.map +0 -1
- package/dist/router/middleware.d.ts +0 -249
- package/dist/router/middleware.d.ts.map +0 -1
- package/dist/router/middleware.js +0 -434
- package/dist/router/middleware.js.map +0 -1
- package/dist/router/middleware.test.d.ts +0 -2
- package/dist/router/middleware.test.d.ts.map +0 -1
- package/dist/router/middleware.test.js +0 -816
- package/dist/router/middleware.test.js.map +0 -1
- package/dist/router/pattern-matching.d.ts +0 -149
- package/dist/router/pattern-matching.d.ts.map +0 -1
- package/dist/router/pattern-matching.js +0 -349
- package/dist/router/pattern-matching.js.map +0 -1
- package/dist/router/revalidation.d.ts +0 -44
- package/dist/router/revalidation.d.ts.map +0 -1
- package/dist/router/revalidation.js +0 -147
- package/dist/router/revalidation.js.map +0 -1
- package/dist/router/router-context.d.ts +0 -135
- package/dist/router/router-context.d.ts.map +0 -1
- package/dist/router/router-context.js +0 -36
- package/dist/router/router-context.js.map +0 -1
- package/dist/router/segment-resolution.d.ts +0 -127
- package/dist/router/segment-resolution.d.ts.map +0 -1
- package/dist/router/segment-resolution.js +0 -919
- package/dist/router/segment-resolution.js.map +0 -1
- package/dist/router/trie-matching.d.ts +0 -40
- package/dist/router/trie-matching.d.ts.map +0 -1
- package/dist/router/trie-matching.js +0 -127
- package/dist/router/trie-matching.js.map +0 -1
- package/dist/router/types.d.ts +0 -136
- package/dist/router/types.d.ts.map +0 -1
- package/dist/router/types.js +0 -7
- package/dist/router/types.js.map +0 -1
- package/dist/router.d.ts +0 -753
- package/dist/router.d.ts.map +0 -1
- package/dist/router.gen.d.ts +0 -6
- package/dist/router.gen.d.ts.map +0 -1
- package/dist/router.gen.js +0 -6
- package/dist/router.gen.js.map +0 -1
- package/dist/router.js +0 -1304
- package/dist/router.js.map +0 -1
- package/dist/rsc/__tests__/helpers.test.d.ts +0 -2
- package/dist/rsc/__tests__/helpers.test.d.ts.map +0 -1
- package/dist/rsc/__tests__/helpers.test.js +0 -140
- package/dist/rsc/__tests__/helpers.test.js.map +0 -1
- package/dist/rsc/handler.d.ts +0 -45
- package/dist/rsc/handler.d.ts.map +0 -1
- package/dist/rsc/handler.js +0 -1172
- package/dist/rsc/handler.js.map +0 -1
- package/dist/rsc/helpers.d.ts +0 -16
- package/dist/rsc/helpers.d.ts.map +0 -1
- package/dist/rsc/helpers.js +0 -55
- package/dist/rsc/helpers.js.map +0 -1
- package/dist/rsc/index.d.ts +0 -22
- package/dist/rsc/index.d.ts.map +0 -1
- package/dist/rsc/index.js +0 -23
- package/dist/rsc/index.js.map +0 -1
- package/dist/rsc/nonce.d.ts +0 -9
- package/dist/rsc/nonce.d.ts.map +0 -1
- package/dist/rsc/nonce.js +0 -18
- package/dist/rsc/nonce.js.map +0 -1
- package/dist/rsc/types.d.ts +0 -206
- package/dist/rsc/types.d.ts.map +0 -1
- package/dist/rsc/types.js +0 -8
- package/dist/rsc/types.js.map +0 -1
- package/dist/search-params.d.ts +0 -103
- package/dist/search-params.d.ts.map +0 -1
- package/dist/search-params.js +0 -74
- package/dist/search-params.js.map +0 -1
- package/dist/segment-system.d.ts +0 -75
- package/dist/segment-system.d.ts.map +0 -1
- package/dist/segment-system.js +0 -336
- package/dist/segment-system.js.map +0 -1
- package/dist/server/context.d.ts +0 -245
- package/dist/server/context.d.ts.map +0 -1
- package/dist/server/context.js +0 -197
- package/dist/server/context.js.map +0 -1
- package/dist/server/fetchable-loader-store.d.ts +0 -18
- package/dist/server/fetchable-loader-store.d.ts.map +0 -1
- package/dist/server/fetchable-loader-store.js +0 -18
- package/dist/server/fetchable-loader-store.js.map +0 -1
- package/dist/server/handle-store.d.ts +0 -85
- package/dist/server/handle-store.d.ts.map +0 -1
- package/dist/server/handle-store.js +0 -142
- package/dist/server/handle-store.js.map +0 -1
- package/dist/server/loader-registry.d.ts +0 -55
- package/dist/server/loader-registry.d.ts.map +0 -1
- package/dist/server/loader-registry.js +0 -132
- package/dist/server/loader-registry.js.map +0 -1
- package/dist/server/request-context.d.ts +0 -226
- package/dist/server/request-context.d.ts.map +0 -1
- package/dist/server/request-context.js +0 -290
- package/dist/server/request-context.js.map +0 -1
- package/dist/server/root-layout.d.ts +0 -4
- package/dist/server/root-layout.d.ts.map +0 -1
- package/dist/server/root-layout.js +0 -5
- package/dist/server/root-layout.js.map +0 -1
- package/dist/server.d.ts +0 -15
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -20
- package/dist/server.js.map +0 -1
- package/dist/ssr/__tests__/ssr-handler.test.d.ts +0 -2
- package/dist/ssr/__tests__/ssr-handler.test.d.ts.map +0 -1
- package/dist/ssr/__tests__/ssr-handler.test.js +0 -132
- package/dist/ssr/__tests__/ssr-handler.test.js.map +0 -1
- package/dist/ssr/index.d.ts +0 -98
- package/dist/ssr/index.d.ts.map +0 -1
- package/dist/ssr/index.js +0 -158
- package/dist/ssr/index.js.map +0 -1
- package/dist/static-handler.d.ts +0 -50
- package/dist/static-handler.d.ts.map +0 -1
- package/dist/static-handler.gen.d.ts +0 -5
- package/dist/static-handler.gen.d.ts.map +0 -1
- package/dist/static-handler.gen.js +0 -5
- package/dist/static-handler.gen.js.map +0 -1
- package/dist/static-handler.js +0 -29
- package/dist/static-handler.js.map +0 -1
- package/dist/theme/ThemeProvider.d.ts +0 -20
- package/dist/theme/ThemeProvider.d.ts.map +0 -1
- package/dist/theme/ThemeProvider.js +0 -240
- package/dist/theme/ThemeProvider.js.map +0 -1
- package/dist/theme/ThemeScript.d.ts +0 -48
- package/dist/theme/ThemeScript.d.ts.map +0 -1
- package/dist/theme/ThemeScript.js +0 -13
- package/dist/theme/ThemeScript.js.map +0 -1
- package/dist/theme/__tests__/theme.test.d.ts +0 -2
- package/dist/theme/__tests__/theme.test.d.ts.map +0 -1
- package/dist/theme/__tests__/theme.test.js +0 -103
- package/dist/theme/__tests__/theme.test.js.map +0 -1
- package/dist/theme/constants.d.ts +0 -29
- package/dist/theme/constants.d.ts.map +0 -1
- package/dist/theme/constants.js +0 -48
- package/dist/theme/constants.js.map +0 -1
- package/dist/theme/index.d.ts +0 -31
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/index.js +0 -36
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/theme-context.d.ts +0 -40
- package/dist/theme/theme-context.d.ts.map +0 -1
- package/dist/theme/theme-context.js +0 -60
- package/dist/theme/theme-context.js.map +0 -1
- package/dist/theme/theme-script.d.ts +0 -27
- package/dist/theme/theme-script.d.ts.map +0 -1
- package/dist/theme/theme-script.js +0 -147
- package/dist/theme/theme-script.js.map +0 -1
- package/dist/theme/types.d.ts +0 -163
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js +0 -11
- package/dist/theme/types.js.map +0 -1
- package/dist/theme/use-theme.d.ts +0 -12
- package/dist/theme/use-theme.d.ts.map +0 -1
- package/dist/theme/use-theme.js +0 -40
- package/dist/theme/use-theme.js.map +0 -1
- package/dist/types.d.ts +0 -1479
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -10
- package/dist/types.js.map +0 -1
- package/dist/urls.d.ts +0 -441
- package/dist/urls.d.ts.map +0 -1
- package/dist/urls.gen.d.ts +0 -8
- package/dist/urls.gen.d.ts.map +0 -1
- package/dist/urls.gen.js +0 -8
- package/dist/urls.gen.js.map +0 -1
- package/dist/urls.js +0 -443
- package/dist/urls.js.map +0 -1
- package/dist/use-loader.d.ts +0 -127
- package/dist/use-loader.d.ts.map +0 -1
- package/dist/use-loader.js +0 -237
- package/dist/use-loader.js.map +0 -1
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts +0 -2
- package/dist/vite/__tests__/ast-handler-extract.test.d.ts.map +0 -1
- package/dist/vite/__tests__/ast-handler-extract.test.js +0 -294
- package/dist/vite/__tests__/ast-handler-extract.test.js.map +0 -1
- package/dist/vite/__tests__/expose-id-utils.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-id-utils.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-id-utils.test.js +0 -224
- package/dist/vite/__tests__/expose-id-utils.test.js.map +0 -1
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-internal-ids.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-internal-ids.test.js +0 -647
- package/dist/vite/__tests__/expose-internal-ids.test.js.map +0 -1
- package/dist/vite/__tests__/expose-router-id.test.d.ts +0 -2
- package/dist/vite/__tests__/expose-router-id.test.d.ts.map +0 -1
- package/dist/vite/__tests__/expose-router-id.test.js +0 -39
- package/dist/vite/__tests__/expose-router-id.test.js.map +0 -1
- package/dist/vite/ast-handler-extract.d.ts +0 -49
- package/dist/vite/ast-handler-extract.d.ts.map +0 -1
- package/dist/vite/ast-handler-extract.js +0 -249
- package/dist/vite/ast-handler-extract.js.map +0 -1
- package/dist/vite/expose-action-id.d.ts +0 -19
- package/dist/vite/expose-action-id.d.ts.map +0 -1
- package/dist/vite/expose-action-id.js +0 -250
- package/dist/vite/expose-action-id.js.map +0 -1
- package/dist/vite/expose-id-utils.d.ts +0 -69
- package/dist/vite/expose-id-utils.d.ts.map +0 -1
- package/dist/vite/expose-id-utils.js +0 -289
- package/dist/vite/expose-id-utils.js.map +0 -1
- package/dist/vite/expose-internal-ids.d.ts +0 -22
- package/dist/vite/expose-internal-ids.d.ts.map +0 -1
- package/dist/vite/expose-internal-ids.js +0 -886
- package/dist/vite/expose-internal-ids.js.map +0 -1
- package/dist/vite/index.d.ts +0 -149
- package/dist/vite/index.d.ts.map +0 -1
- package/dist/vite/index.js.bak +0 -5448
- package/dist/vite/index.js.map +0 -1
- package/dist/vite/index.named-routes.gen.ts +0 -103
- package/dist/vite/package-resolution.d.ts +0 -43
- package/dist/vite/package-resolution.d.ts.map +0 -1
- package/dist/vite/package-resolution.js +0 -112
- package/dist/vite/package-resolution.js.map +0 -1
- package/dist/vite/virtual-entries.d.ts +0 -25
- package/dist/vite/virtual-entries.d.ts.map +0 -1
- package/dist/vite/virtual-entries.js +0 -110
- package/dist/vite/virtual-entries.js.map +0 -1
- package/src/browser/shallow.ts +0 -40
package/src/use-loader.tsx
CHANGED
|
@@ -15,14 +15,6 @@ import { OutletContext, type OutletContextValue } from "./outlet-context.js";
|
|
|
15
15
|
import { loaderStore, type LoaderEntry } from "./loader-store.js";
|
|
16
16
|
import type { LoaderDefinition, LoadOptions } from "./types.js";
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* A shareable GET — a `load()` call that reads data (GET or defaulted method)
|
|
20
|
-
* with no request body. Params are allowed. This is the gate for keyed sharing:
|
|
21
|
-
* when a hook is given an explicit `key`, every shareable GET writes to the
|
|
22
|
-
* keyed bucket so co-keyed readers (including parameterized views) refresh
|
|
23
|
-
* together. Non-GET methods and body-bearing calls are mutations and stay local
|
|
24
|
-
* to the call site.
|
|
25
|
-
*/
|
|
26
18
|
function isShareableGet(options: LoadOptions | undefined): boolean {
|
|
27
19
|
if (!options) return true;
|
|
28
20
|
if (options.method && options.method !== "GET") return false;
|
|
@@ -32,44 +24,14 @@ function isShareableGet(options: LoadOptions | undefined): boolean {
|
|
|
32
24
|
return true;
|
|
33
25
|
}
|
|
34
26
|
|
|
35
|
-
/**
|
|
36
|
-
* Plain route-context refetch — a `load()` call with no options or a
|
|
37
|
-
* trivially-defaulted GET (no params, no body). Results from these are
|
|
38
|
-
* broadcast to every component reading the same loader id via the shared
|
|
39
|
-
* store, so a layout's refetch button updates page + parallel-slot reads
|
|
40
|
-
* automatically.
|
|
41
|
-
*
|
|
42
|
-
* Calls with explicit `params`, an explicit non-GET method, or a `body`
|
|
43
|
-
* stay local to the call site — that preserves the today-semantics of
|
|
44
|
-
* `useFetchLoader(SearchLoader).load({ params: { q } })` style code where
|
|
45
|
-
* each component owns its own fetched view. (An explicit `key` opts a
|
|
46
|
-
* parameterized GET back into sharing; see `isShareableGet`.)
|
|
47
|
-
*/
|
|
48
27
|
function isPlainRefetch(options: LoadOptions | undefined): boolean {
|
|
49
28
|
if (!isShareableGet(options)) return false;
|
|
50
29
|
if (options?.params && Object.keys(options.params).length > 0) return false;
|
|
51
30
|
return true;
|
|
52
31
|
}
|
|
53
32
|
|
|
54
|
-
// Per-hook unique suffix for grouped reads that have no explicit `key`. Such a
|
|
55
|
-
// read must NOT share the bare `loader.$$id` bucket, or a cross-loader group
|
|
56
|
-
// refresh would leak into unrelated unkeyed readers of the same loader (which
|
|
57
|
-
// the contract keeps local). Sharing within a group is opt-in via an explicit
|
|
58
|
-
// `key`; without one, each grouped read gets its own private bucket. The value
|
|
59
|
-
// is only ever used as a client-side store bucket key (never rendered), so the
|
|
60
|
-
// counter has no SSR/hydration consistency requirement.
|
|
61
33
|
let privateGroupBucketSeq = 0;
|
|
62
34
|
|
|
63
|
-
/**
|
|
64
|
-
* Extract a specific loader's data from a content ReactNode.
|
|
65
|
-
*
|
|
66
|
-
* When a route registers loaders via loader(), the resolved data lives in
|
|
67
|
-
* the route's OutletProvider (rendered as <Outlet /> content). Parallel
|
|
68
|
-
* slots are siblings of <Outlet />, so they can't find it by walking
|
|
69
|
-
* the parent context chain. This helper traverses wrapper elements
|
|
70
|
-
* (MountContextProvider, ViewTransition, etc.) to reach the OutletProvider
|
|
71
|
-
* and extract the loader data directly.
|
|
72
|
-
*/
|
|
73
35
|
const NOT_FOUND = Symbol("not-found");
|
|
74
36
|
|
|
75
37
|
function extractContentLoaderData(
|
|
@@ -85,10 +47,6 @@ function extractContentLoaderData(
|
|
|
85
47
|
return props.loaderData[loaderId];
|
|
86
48
|
}
|
|
87
49
|
|
|
88
|
-
// LoaderBoundary: loaderIds + loaderDataPromise (already resolved array).
|
|
89
|
-
// When the segment has loading(), loaderData is resolved inside
|
|
90
|
-
// LoaderBoundary via use(). If the promise was pre-awaited (forceAwait
|
|
91
|
-
// or isAction), the prop is a raw array we can index into.
|
|
92
50
|
if (
|
|
93
51
|
props.loaderIds &&
|
|
94
52
|
Array.isArray(props.loaderIds) &&
|
|
@@ -98,7 +56,6 @@ function extractContentLoaderData(
|
|
|
98
56
|
const idx = (props.loaderIds as string[]).indexOf(loaderId);
|
|
99
57
|
if (idx !== -1) {
|
|
100
58
|
const data = (props.loaderDataPromise as any[])[idx];
|
|
101
|
-
// loaderDataPromise entries may be { ok, data } result objects
|
|
102
59
|
if (data && typeof data === "object" && "ok" in data) {
|
|
103
60
|
return data.ok ? data.data : NOT_FOUND;
|
|
104
61
|
}
|
|
@@ -106,118 +63,45 @@ function extractContentLoaderData(
|
|
|
106
63
|
}
|
|
107
64
|
}
|
|
108
65
|
|
|
109
|
-
// Traverse into wrapper elements (MountContextProvider, ViewTransition,
|
|
110
|
-
// Suspense wrappers, etc.)
|
|
111
66
|
if (props.children) return extractContentLoaderData(props.children, loaderId);
|
|
112
67
|
return NOT_FOUND;
|
|
113
68
|
}
|
|
114
69
|
|
|
115
|
-
/**
|
|
116
|
-
* Payload returned by loader RSC requests
|
|
117
|
-
*/
|
|
118
70
|
interface LoaderRscPayload<T = unknown> {
|
|
119
71
|
loaderResult: T;
|
|
120
72
|
loaderError?: { message: string; name: string };
|
|
121
73
|
}
|
|
122
74
|
|
|
123
|
-
/**
|
|
124
|
-
* Load function type for fetching loader data from the client
|
|
125
|
-
*/
|
|
126
75
|
export type LoadFunction<T> = (options?: LoadOptions) => Promise<T>;
|
|
127
76
|
|
|
128
|
-
/**
|
|
129
|
-
* Result type for useLoader hook (strict - data is required)
|
|
130
|
-
*/
|
|
131
77
|
export interface UseLoaderResult<T> {
|
|
132
|
-
/** The loaded data - guaranteed to exist when loader is registered on route */
|
|
133
78
|
data: T;
|
|
134
|
-
/** True while a load() is in progress */
|
|
135
79
|
isLoading: boolean;
|
|
136
|
-
/** Error from the most recent load attempt, null if successful */
|
|
137
80
|
error: Error | null;
|
|
138
|
-
/** Function to trigger a fetch (only works if loader is fetchable) */
|
|
139
81
|
load: LoadFunction<T>;
|
|
140
|
-
/** Alias for load */
|
|
141
82
|
refetch: LoadFunction<T>;
|
|
142
83
|
}
|
|
143
84
|
|
|
144
|
-
/**
|
|
145
|
-
* Result type for useFetchLoader hook (flexible - data is optional)
|
|
146
|
-
*/
|
|
147
85
|
export interface UseFetchLoaderResult<T> {
|
|
148
|
-
/** The loaded data - may be undefined if not yet fetched or not in context */
|
|
149
86
|
data: T | undefined;
|
|
150
|
-
/** True while a load() is in progress */
|
|
151
87
|
isLoading: boolean;
|
|
152
|
-
/** Error from the most recent load attempt, null if successful */
|
|
153
88
|
error: Error | null;
|
|
154
|
-
/** Function to trigger a fetch (only works if loader is fetchable) */
|
|
155
89
|
load: LoadFunction<T>;
|
|
156
|
-
/** Alias for load */
|
|
157
90
|
refetch: LoadFunction<T>;
|
|
158
91
|
}
|
|
159
92
|
|
|
160
|
-
/**
|
|
161
|
-
* Options for useLoader hook
|
|
162
|
-
*/
|
|
163
93
|
export interface UseLoaderOptions {
|
|
164
|
-
/**
|
|
165
|
-
* If true (default), errors from load() will be thrown to the nearest error boundary.
|
|
166
|
-
* If false, errors are only captured in the `error` state.
|
|
167
|
-
* @default true
|
|
168
|
-
*/
|
|
169
94
|
throwOnError?: boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Client refresh key. Partitions the shared refresh store so that only hooks
|
|
172
|
-
* using the same `key` refresh together when one of them calls `load()`.
|
|
173
|
-
*
|
|
174
|
-
* Without a `key` (default), a plain `load()` on a route-registered loader
|
|
175
|
-
* broadcasts to every reader of that loader, and any parameterized / unregistered
|
|
176
|
-
* load stays local to the calling hook. With a `key`:
|
|
177
|
-
* - readers of the same loader that share a `key` form one refresh group —
|
|
178
|
-
* a `load()` from any of them updates the whole group, including
|
|
179
|
-
* parameterized GETs;
|
|
180
|
-
* - readers with different keys are independent;
|
|
181
|
-
* - it works even when the loader is NOT registered on the route (keyed
|
|
182
|
-
* `useFetchLoader`), letting unrelated components opt into sharing.
|
|
183
|
-
*
|
|
184
|
-
* This is a client-side refresh identity only. It is unrelated to the server
|
|
185
|
-
* `cache({ key })` option and to `revalidate()`; it never changes the request
|
|
186
|
-
* sent to the server.
|
|
187
|
-
*/
|
|
188
95
|
key?: string;
|
|
189
|
-
/**
|
|
190
|
-
* Cross-loader refresh group tag(s). Tag reads of DIFFERENT loaders with a
|
|
191
|
-
* shared name, then call `useRefreshLoaders()(name)` to refresh the whole group
|
|
192
|
-
* at once. Pass an array to tag one read into several groups — it is refreshed
|
|
193
|
-
* when ANY of its groups is refreshed, so a coarse tag can cover the whole set
|
|
194
|
-
* while a finer tag targets a subset. Each member is refreshed with a plain GET
|
|
195
|
-
* against the current route URL — no params, no body, no mutation methods —
|
|
196
|
-
* because a group spans heterogeneous loaders with different param/return
|
|
197
|
-
* shapes.
|
|
198
|
-
*
|
|
199
|
-
* For parameterized sharing of a SINGLE loader, use `key` instead; group
|
|
200
|
-
* members should be registered or non-parameterized-keyed reads (a plain-GET
|
|
201
|
-
* group refresh would drop any per-call params).
|
|
202
|
-
*/
|
|
203
96
|
refreshGroup?: string | string[];
|
|
204
97
|
}
|
|
205
98
|
|
|
206
|
-
/**
|
|
207
|
-
* Internal hook implementation shared by useLoader and useFetchLoader
|
|
208
|
-
*/
|
|
209
99
|
function useLoaderInternal<T>(
|
|
210
100
|
loader: LoaderDefinition<T>,
|
|
211
101
|
options?: UseLoaderOptions,
|
|
212
102
|
): UseFetchLoaderResult<T> {
|
|
213
103
|
const context = useContext(OutletContext);
|
|
214
104
|
|
|
215
|
-
// Get data from context (SSR/navigation). `hasContextData` distinguishes
|
|
216
|
-
// "loader registered on the route, value happens to be undefined" from
|
|
217
|
-
// "loader is not in any parent's context at all". The shared store is
|
|
218
|
-
// only consulted when the loader really is in route context — that
|
|
219
|
-
// preserves per-component isolation for ad-hoc useFetchLoader callers
|
|
220
|
-
// who use the same fetchable loader without registering it.
|
|
221
105
|
const { contextData, hasContextData } = useMemo((): {
|
|
222
106
|
contextData: T | undefined;
|
|
223
107
|
hasContextData: boolean;
|
|
@@ -230,9 +114,6 @@ function useLoaderInternal<T>(
|
|
|
230
114
|
hasContextData: true,
|
|
231
115
|
};
|
|
232
116
|
}
|
|
233
|
-
// Check content element — the route's OutletProvider is rendered as
|
|
234
|
-
// <Outlet /> content (a child), so its loaderData isn't in the parent
|
|
235
|
-
// chain. Parallel slots need to reach into it to find route-level loaders.
|
|
236
117
|
const contentData = extractContentLoaderData(
|
|
237
118
|
current.content,
|
|
238
119
|
loader.$$id,
|
|
@@ -245,23 +126,8 @@ function useLoaderInternal<T>(
|
|
|
245
126
|
return { contextData: undefined, hasContextData: false };
|
|
246
127
|
}, [context, loader.$$id]);
|
|
247
128
|
|
|
248
|
-
// Shared subscription: every component reading the same loader id sees
|
|
249
|
-
// the same snapshot, so a plain refetch from one component propagates to
|
|
250
|
-
// the others. Mirrors the convention used by useParams / useLinkStatus —
|
|
251
|
-
// useState seeded from the store, useEffect subscribes for updates and
|
|
252
|
-
// calls setState inside startTransition so subscriber re-renders don't
|
|
253
|
-
// trip Suspense fallbacks during a refetch (matches the per-hook
|
|
254
|
-
// startTransition the old code wrapped setFetchedData in).
|
|
255
129
|
const loaderId = loader.$$id;
|
|
256
|
-
// Client refresh key. The shared store is partitioned by bucket key so that
|
|
257
|
-
// only hooks with the same `key` refresh together. Default (no key) keeps the
|
|
258
|
-
// historical behavior: one bucket per loader id.
|
|
259
130
|
const key = options?.key;
|
|
260
|
-
// Normalize the refresh-group tag(s) to a stable, deduped, sorted list. The
|
|
261
|
-
// joined `groupKey` string is the subscribe effect's dependency, so passing an
|
|
262
|
-
// inline array literal (`refreshGroup={["a", "b"]}`) does not force a
|
|
263
|
-
// resubscribe on every render. An empty list means "no groups" — identical to
|
|
264
|
-
// omitting the option (`hasGroups` stays false, no private bucket is created).
|
|
265
131
|
const refreshGroupOption = options?.refreshGroup;
|
|
266
132
|
const groupKey =
|
|
267
133
|
refreshGroupOption === undefined
|
|
@@ -276,10 +142,6 @@ function useLoaderInternal<T>(
|
|
|
276
142
|
[groupKey],
|
|
277
143
|
);
|
|
278
144
|
const hasGroups = groupList.length > 0;
|
|
279
|
-
// A grouped reader with no explicit key gets a private per-hook bucket so a
|
|
280
|
-
// cross-loader group refresh cannot leak into the bare `loader.$$id` bucket
|
|
281
|
-
// shared by unrelated unkeyed readers. Sharing within a group is opt-in via
|
|
282
|
-
// an explicit `key`.
|
|
283
145
|
const privateBucketIdRef = useRef<string | null>(null);
|
|
284
146
|
if (hasGroups && key === undefined && privateBucketIdRef.current === null) {
|
|
285
147
|
privateBucketIdRef.current = `__rg${privateGroupBucketSeq++}`;
|
|
@@ -289,12 +151,6 @@ function useLoaderInternal<T>(
|
|
|
289
151
|
const bucketKey =
|
|
290
152
|
effectiveKey === undefined ? loaderId : `${loaderId}::${effectiveKey}`;
|
|
291
153
|
|
|
292
|
-
// Plain-GET refresh thunk registered with the store for cross-loader group
|
|
293
|
-
// refresh (useRefreshLoaders). Always shares into this hook's bucket, never
|
|
294
|
-
// touches lastSharedRequestIdRef (so a group refresh never render-throws —
|
|
295
|
-
// errors surface via `error` and reject the refreshGroups() promise instead),
|
|
296
|
-
// and sends no params/body. Stable across navigations (depends only on
|
|
297
|
-
// loaderId + bucketKey), so the store keeps one current thunk per bucket.
|
|
298
154
|
const groupRefetch = useCallback(async (): Promise<void> => {
|
|
299
155
|
if (!loaderId) return;
|
|
300
156
|
const requestId = loaderStore.reserveRequestId(bucketKey);
|
|
@@ -333,9 +189,6 @@ function useLoaderInternal<T>(
|
|
|
333
189
|
? sharedState.snapshot
|
|
334
190
|
: loaderStore.getSnapshot(bucketKey);
|
|
335
191
|
useEffect(() => {
|
|
336
|
-
// Sync any value the store committed between this hook's lazy
|
|
337
|
-
// initializer and effect-time (e.g. a sibling that mounted earlier
|
|
338
|
-
// already triggered a load()).
|
|
339
192
|
const initial = loaderStore.getSnapshot(bucketKey);
|
|
340
193
|
if (initial !== sharedSnapshot) {
|
|
341
194
|
startTransition(() => {
|
|
@@ -430,10 +283,6 @@ function useLoaderInternal<T>(
|
|
|
430
283
|
|
|
431
284
|
const throwOnError = options?.throwOnError ?? true;
|
|
432
285
|
|
|
433
|
-
// Refs for values used inside load() that should NOT cause callback identity
|
|
434
|
-
// churn. loader.$$id can change if a reusable component receives a different
|
|
435
|
-
// loader without remounting; data changes on every navigation. Refs keep the
|
|
436
|
-
// callback stable while always reading the latest values.
|
|
437
286
|
const loaderIdRef = useRef(loaderId);
|
|
438
287
|
loaderIdRef.current = loaderId;
|
|
439
288
|
const bucketKeyRef = useRef(bucketKey);
|
|
@@ -443,8 +292,6 @@ function useLoaderInternal<T>(
|
|
|
443
292
|
const hasContextDataRef = useRef(hasContextData);
|
|
444
293
|
hasContextDataRef.current = hasContextData;
|
|
445
294
|
|
|
446
|
-
// Load function for fetching data via the ?_rsc_loader endpoint.
|
|
447
|
-
// Supports GET (data fetching) and POST/PUT/PATCH/DELETE (mutations).
|
|
448
295
|
const load = useCallback(
|
|
449
296
|
async (loadOptions?: LoadOptions): Promise<T> => {
|
|
450
297
|
const id = loaderIdRef.current;
|
|
@@ -455,20 +302,8 @@ function useLoaderInternal<T>(
|
|
|
455
302
|
}
|
|
456
303
|
|
|
457
304
|
const bucket = bucketKeyRef.current;
|
|
458
|
-
// A dedicated bucket means this read owns a bucket distinct from the bare
|
|
459
|
-
// loader id — either an explicit `key` (`$$id::key`) or a refreshGroup's
|
|
460
|
-
// private bucket (`$$id::<private>`).
|
|
461
305
|
const hasDedicatedBucket = bucket !== id;
|
|
462
306
|
|
|
463
|
-
// Deciding shared vs local:
|
|
464
|
-
// - With a dedicated bucket, every shareable GET (params allowed) writes
|
|
465
|
-
// to that bucket — the key/group is an explicit opt-in to sharing, and
|
|
466
|
-
// a direct load() must land in the same bucket a group refresh uses.
|
|
467
|
-
// - On the bare loader-id bucket, sharing is only correct when the
|
|
468
|
-
// loader is registered on the route and the call is a plain refetch —
|
|
469
|
-
// otherwise two unrelated components calling load() on the same
|
|
470
|
-
// fetchable loader would overwrite each other's local view.
|
|
471
|
-
// Mutations (non-GET / body) stay local in both cases.
|
|
472
307
|
const shared = hasDedicatedBucket
|
|
473
308
|
? isShareableGet(loadOptions)
|
|
474
309
|
: isPlainRefetch(loadOptions) && hasContextDataRef.current;
|
|
@@ -477,9 +312,6 @@ function useLoaderInternal<T>(
|
|
|
477
312
|
if (shared) {
|
|
478
313
|
sharedRequestId = loaderStore.reserveRequestId(bucket);
|
|
479
314
|
lastSharedRequestIdRef.current = sharedRequestId;
|
|
480
|
-
// beginRequest flips loading on AND clears any prior error so a
|
|
481
|
-
// throwOnError: false consumer doesn't keep showing the stale
|
|
482
|
-
// error during the retry. Gated on requestId === latest.
|
|
483
315
|
loaderStore.beginRequest(bucket, sharedRequestId);
|
|
484
316
|
} else {
|
|
485
317
|
localRequestId = ++localRequestIdRef.current;
|
|
@@ -505,8 +337,6 @@ function useLoaderInternal<T>(
|
|
|
505
337
|
loadOptions?.params && Object.keys(loadOptions.params).length > 0;
|
|
506
338
|
|
|
507
339
|
if (bodyValue instanceof FormData) {
|
|
508
|
-
// FormData body — send as multipart/form-data (preserves File objects).
|
|
509
|
-
// Params are appended as a JSON string in a special field.
|
|
510
340
|
if (hasParams) {
|
|
511
341
|
bodyValue.set(
|
|
512
342
|
"_rsc_loader_params",
|
|
@@ -519,7 +349,6 @@ function useLoaderInternal<T>(
|
|
|
519
349
|
body: bodyValue,
|
|
520
350
|
};
|
|
521
351
|
} else {
|
|
522
|
-
// JSON body — send params and body as JSON
|
|
523
352
|
const bodyPayload: {
|
|
524
353
|
params?: Record<string, string>;
|
|
525
354
|
body?: unknown;
|
|
@@ -541,7 +370,6 @@ function useLoaderInternal<T>(
|
|
|
541
370
|
};
|
|
542
371
|
}
|
|
543
372
|
} else {
|
|
544
|
-
// GET - send params in query string
|
|
545
373
|
if (
|
|
546
374
|
loadOptions?.params &&
|
|
547
375
|
Object.keys(loadOptions.params).length > 0
|
|
@@ -571,12 +399,8 @@ function useLoaderInternal<T>(
|
|
|
571
399
|
|
|
572
400
|
const result = payload.loaderResult;
|
|
573
401
|
if (shared) {
|
|
574
|
-
// finishData is gated on requestId; a stale response is dropped.
|
|
575
402
|
loaderStore.finishData(bucket, sharedRequestId, result);
|
|
576
403
|
} else if (localRequestId === localRequestIdRef.current) {
|
|
577
|
-
// Local-branch gate, mirrors the shared-branch requestId check:
|
|
578
|
-
// if a newer load() was issued from this hook before this one
|
|
579
|
-
// resolved, drop the stale result.
|
|
580
404
|
startTransition(() => {
|
|
581
405
|
setLocalFetchedData({ has: true, value: result });
|
|
582
406
|
setLocalIsLoading(false);
|
|
@@ -594,12 +418,9 @@ function useLoaderInternal<T>(
|
|
|
594
418
|
if (throwOnError) {
|
|
595
419
|
throw err;
|
|
596
420
|
}
|
|
597
|
-
// When throwOnError is false, return the latest data snapshot (previous
|
|
598
|
-
// successful value or undefined). Caller should check error state.
|
|
599
421
|
return dataRef.current as T;
|
|
600
422
|
} finally {
|
|
601
423
|
if (shared) {
|
|
602
|
-
// setLoading is gated; only the latest request flips the flag off.
|
|
603
424
|
loaderStore.setLoading(bucket, sharedRequestId, false);
|
|
604
425
|
}
|
|
605
426
|
}
|
|
@@ -607,13 +428,6 @@ function useLoaderInternal<T>(
|
|
|
607
428
|
[throwOnError],
|
|
608
429
|
);
|
|
609
430
|
|
|
610
|
-
// Throw during render if there's an error and throwOnError is true.
|
|
611
|
-
// - Local errors always belong to this hook, so always throw on opt-in.
|
|
612
|
-
// - Shared errors throw only when this hook initiated the failing
|
|
613
|
-
// request (entry.requestId matches lastSharedRequestIdRef). Sibling
|
|
614
|
-
// readers expose the error via `error` but do not throw, so a
|
|
615
|
-
// throwOnError: true reader never explodes because of someone else's
|
|
616
|
-
// throwOnError: false load() failure.
|
|
617
431
|
if (throwOnError) {
|
|
618
432
|
if (localError) throw localError;
|
|
619
433
|
if (
|
|
@@ -9,6 +9,7 @@ import { resolve } from "node:path";
|
|
|
9
9
|
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
10
10
|
import { evictHandlerCode } from "../utils/bundle-analysis.js";
|
|
11
11
|
import { copyStagedBuildAssets } from "../utils/prerender-utils.js";
|
|
12
|
+
import { jsonParseExpression } from "../utils/manifest-utils.js";
|
|
12
13
|
import type { DiscoveryState } from "./state.js";
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -104,7 +105,7 @@ export function postprocessBundle(state: DiscoveryState): void {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
const manifestCode = [
|
|
107
|
-
`const m
|
|
108
|
+
`const m=${jsonParseExpression(manifestMap)};`,
|
|
108
109
|
`export function loadPrerenderAsset(s){return import(s)}`,
|
|
109
110
|
`export default m;`,
|
|
110
111
|
"",
|
|
@@ -243,20 +243,19 @@ export async function discoverRouters(
|
|
|
243
243
|
// Flatten prefix tree leaf nodes into precomputed entries.
|
|
244
244
|
// Leaf nodes (no children) can have their routes used directly by
|
|
245
245
|
// evaluateLazyEntry() without running the handler at runtime.
|
|
246
|
+
// Walk once into a per-router array, then fold it into the merged array;
|
|
247
|
+
// the merged and per-router entries are identical, so a second walk is
|
|
248
|
+
// redundant. Append order is preserved within and across routers.
|
|
249
|
+
const routerPrecomputed: PrecomputedEntry[] = [];
|
|
246
250
|
flattenLeafEntries(
|
|
247
251
|
manifest.prefixTree,
|
|
248
252
|
manifest.routeManifest,
|
|
249
|
-
|
|
253
|
+
routerPrecomputed,
|
|
250
254
|
);
|
|
255
|
+
newMergedPrecomputedEntries.push(...routerPrecomputed);
|
|
251
256
|
|
|
252
257
|
// Store per-router manifest and precomputed entries for isolated virtual modules.
|
|
253
258
|
newPerRouterManifestDataMap.set(id, manifest.routeManifest);
|
|
254
|
-
const routerPrecomputed: PrecomputedEntry[] = [];
|
|
255
|
-
flattenLeafEntries(
|
|
256
|
-
manifest.prefixTree,
|
|
257
|
-
manifest.routeManifest,
|
|
258
|
-
routerPrecomputed,
|
|
259
|
-
);
|
|
260
259
|
newPerRouterPrecomputedMap.set(id, routerPrecomputed);
|
|
261
260
|
|
|
262
261
|
console.log(
|
|
@@ -49,7 +49,6 @@ export function generateRoutesManifestModule(state: DiscoveryState): string {
|
|
|
49
49
|
);
|
|
50
50
|
genFileVars.push(varName);
|
|
51
51
|
} else {
|
|
52
|
-
// Routers without sourceFile: inline their manifest data directly
|
|
53
52
|
routersWithoutGenFile.push({
|
|
54
53
|
id: entry.id,
|
|
55
54
|
manifest: entry.routeManifest,
|
|
@@ -68,14 +67,12 @@ export function generateRoutesManifestModule(state: DiscoveryState): string {
|
|
|
68
67
|
`clearAllRouterData();`,
|
|
69
68
|
];
|
|
70
69
|
|
|
71
|
-
// Flatten NamedRoutes entries: search schema objects -> plain string paths
|
|
72
70
|
if (genFileVars.length > 0) {
|
|
73
71
|
lines.push(
|
|
74
72
|
`function __flat(r) { const o = {}; for (const [k, v] of Object.entries(r)) o[k] = typeof v === "string" ? v : v.path; return o; }`,
|
|
75
73
|
);
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
// Build the merged manifest from gen file imports + inlined data
|
|
79
76
|
if (genFileVars.length === 1 && routersWithoutGenFile.length === 0) {
|
|
80
77
|
lines.push(`setCachedManifest(__flat(${genFileVars[0]}));`);
|
|
81
78
|
} else {
|
|
@@ -86,7 +83,6 @@ export function generateRoutesManifestModule(state: DiscoveryState): string {
|
|
|
86
83
|
lines.push(`setCachedManifest({ ${parts.join(", ")} });`);
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
// Set per-router manifests
|
|
90
86
|
let genVarIdx = 0;
|
|
91
87
|
for (const entry of state.perRouterManifests) {
|
|
92
88
|
if (entry.sourceFile) {
|
|
@@ -114,8 +110,6 @@ export function generateRoutesManifestModule(state: DiscoveryState): string {
|
|
|
114
110
|
// against live router.urlpatterns, which is always correct after a
|
|
115
111
|
// program reload.
|
|
116
112
|
|
|
117
|
-
// Register lazy loaders for per-router manifest modules.
|
|
118
|
-
// Each import() uses a static string literal so Rollup creates separate chunks.
|
|
119
113
|
for (const routerId of state.perRouterManifestDataMap.keys()) {
|
|
120
114
|
lines.push(
|
|
121
115
|
`registerRouterManifestLoader(${JSON.stringify(routerId)}, () => import(${JSON.stringify(VIRTUAL_ROUTES_MANIFEST_ID + "/" + routerId)}));`,
|
|
@@ -129,9 +123,6 @@ export function generateRoutesManifestModule(state: DiscoveryState): string {
|
|
|
129
123
|
return lines.join("\n");
|
|
130
124
|
}
|
|
131
125
|
|
|
132
|
-
// No manifest: either discovery hasn't completed or no runner (Cloudflare dev).
|
|
133
|
-
// Still inject __PRERENDER_DEV_URL so the prerender store can fetch on-demand.
|
|
134
|
-
// Re-resolve origin now since the server is listening by module load time.
|
|
135
126
|
if (!state.isBuildMode) {
|
|
136
127
|
const origin =
|
|
137
128
|
state.devServerOrigin ||
|
|
@@ -160,7 +151,6 @@ export function generatePerRouterModule(
|
|
|
160
151
|
const lines: string[] = [];
|
|
161
152
|
|
|
162
153
|
if (routerEntry?.sourceFile) {
|
|
163
|
-
// Import manifest from the gen file so HMR auto-propagates
|
|
164
154
|
const routerDir = dirname(routerEntry.sourceFile);
|
|
165
155
|
const routerBasename = basename(routerEntry.sourceFile).replace(
|
|
166
156
|
/\.(tsx?|jsx?)$/,
|
|
@@ -189,5 +179,5 @@ export function generatePerRouterModule(
|
|
|
189
179
|
`export const precomputedEntries = ${jsonParseExpression(entries)};`,
|
|
190
180
|
);
|
|
191
181
|
}
|
|
192
|
-
return lines.join("\n") || "
|
|
182
|
+
return lines.join("\n") || "";
|
|
193
183
|
}
|
package/src/vite/plugin-types.ts
CHANGED
|
@@ -156,7 +156,9 @@ export interface RangoCloudflareOptions extends RangoBaseOptions {
|
|
|
156
156
|
/**
|
|
157
157
|
* Deployment preset for Cloudflare Workers.
|
|
158
158
|
* When using cloudflare preset:
|
|
159
|
-
* - @vitejs/plugin-rsc
|
|
159
|
+
* - @vitejs/plugin-rsc IS still added by rango(), but with `serverHandler: false`
|
|
160
|
+
* (the cloudflare plugin owns the RSC worker/server entry); only `client` and
|
|
161
|
+
* `ssr` virtual entries are configured, no rsc entry
|
|
160
162
|
* - Your worker entry (e.g., worker.rsc.tsx) imports the router directly
|
|
161
163
|
* - Browser and SSR use virtual entries
|
|
162
164
|
* - Build-time manifest generation is auto-detected from the resolved RSC environment config
|
|
@@ -14,7 +14,6 @@ export function createCjsToEsmPlugin(): Plugin {
|
|
|
14
14
|
transform(code, id) {
|
|
15
15
|
const cleanId = id.split("?")[0].replaceAll("\\", "/");
|
|
16
16
|
|
|
17
|
-
// Transform the client.browser.js entry point to re-export from CJS
|
|
18
17
|
if (cleanId.includes("vendor/react-server-dom/client.browser.js")) {
|
|
19
18
|
const isProd = process.env.NODE_ENV === "production";
|
|
20
19
|
const cjsFile = isProd
|
|
@@ -28,57 +27,47 @@ export function createCjsToEsmPlugin(): Plugin {
|
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
// Transform the actual CJS files to ESM
|
|
32
30
|
if (
|
|
33
31
|
cleanId.includes("vendor/react-server-dom/cjs/") &&
|
|
34
32
|
cleanId.includes("client.browser")
|
|
35
33
|
) {
|
|
36
34
|
let transformed = code;
|
|
37
35
|
|
|
38
|
-
// Extract the license comment to preserve it
|
|
39
36
|
const licenseMatch = transformed.match(/^\/\*\*[\s\S]*?\*\//);
|
|
40
37
|
const license = licenseMatch ? licenseMatch[0] : "";
|
|
41
38
|
if (license) {
|
|
42
39
|
transformed = transformed.slice(license.length);
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
// Remove "use strict" (both dev and prod have this)
|
|
46
42
|
transformed = transformed.replace(/^\s*["']use strict["'];\s*/, "");
|
|
47
43
|
|
|
48
|
-
// Remove the conditional IIFE wrapper (development only)
|
|
49
44
|
transformed = transformed.replace(
|
|
50
45
|
/^\s*["']production["']\s*!==\s*process\.env\.NODE_ENV\s*&&\s*\(function\s*\(\)\s*\{/,
|
|
51
46
|
"",
|
|
52
47
|
);
|
|
53
48
|
|
|
54
|
-
// Remove the closing of the conditional IIFE at the end (development only)
|
|
55
49
|
transformed = transformed.replace(/\}\)\(\);?\s*$/, "");
|
|
56
50
|
|
|
57
|
-
// Replace require('react') and require('react-dom') with imports (development)
|
|
58
51
|
transformed = transformed.replace(
|
|
59
52
|
/var\s+React\s*=\s*require\s*\(\s*["']react["']\s*\)\s*,[\s\n]+ReactDOM\s*=\s*require\s*\(\s*["']react-dom["']\s*\)\s*,/g,
|
|
60
53
|
'import React from "react";\nimport ReactDOM from "react-dom";\nvar ',
|
|
61
54
|
);
|
|
62
55
|
|
|
63
|
-
// Replace require('react-dom') only (production - doesn't import React)
|
|
64
56
|
transformed = transformed.replace(
|
|
65
57
|
/var\s+ReactDOM\s*=\s*require\s*\(\s*["']react-dom["']\s*\)\s*,/g,
|
|
66
58
|
'import ReactDOM from "react-dom";\nvar ',
|
|
67
59
|
);
|
|
68
60
|
|
|
69
|
-
// Transform exports.xyz = function() to export function xyz()
|
|
70
61
|
transformed = transformed.replace(
|
|
71
62
|
/exports\.(\w+)\s*=\s*function\s*\(/g,
|
|
72
63
|
"export function $1(",
|
|
73
64
|
);
|
|
74
65
|
|
|
75
|
-
// Transform exports.xyz = value to export const xyz = value
|
|
76
66
|
transformed = transformed.replace(
|
|
77
67
|
/exports\.(\w+)\s*=/g,
|
|
78
68
|
"export const $1 =",
|
|
79
69
|
);
|
|
80
70
|
|
|
81
|
-
// Reconstruct with license at the top
|
|
82
71
|
transformed = license + "\n" + transformed;
|
|
83
72
|
|
|
84
73
|
debug?.("cjs-to-esm body rewrite %s", id);
|
|
@@ -73,8 +73,6 @@ export function clientRefDedup(): Plugin {
|
|
|
73
73
|
apply: "serve",
|
|
74
74
|
|
|
75
75
|
configResolved(config: ResolvedConfig) {
|
|
76
|
-
// Respect user's optimizeDeps.exclude — if a package is explicitly
|
|
77
|
-
// excluded from pre-bundling, we shouldn't redirect it there.
|
|
78
76
|
const clientEnv = config.environments?.["client"];
|
|
79
77
|
clientExclude =
|
|
80
78
|
clientEnv?.optimizeDeps?.exclude ?? config.optimizeDeps?.exclude ?? [];
|
|
@@ -91,27 +89,19 @@ export function clientRefDedup(): Plugin {
|
|
|
91
89
|
},
|
|
92
90
|
|
|
93
91
|
resolveId(source, importer, options) {
|
|
94
|
-
// Only intercept in the client environment
|
|
95
92
|
if (this.environment?.name !== "client") return;
|
|
96
93
|
|
|
97
|
-
// Only handle imports from client-in-server-package-proxy virtual modules
|
|
98
94
|
if (!importer?.includes(CLIENT_IN_SERVER_PROXY_PREFIX)) return;
|
|
99
95
|
|
|
100
|
-
// Only handle absolute node_modules paths
|
|
101
96
|
if (!source.includes("/node_modules/")) return;
|
|
102
97
|
|
|
103
|
-
// Must have an importer
|
|
104
|
-
if (!importer) return;
|
|
105
|
-
|
|
106
98
|
const packageName = extractPackageName(source);
|
|
107
99
|
if (!packageName) return;
|
|
108
100
|
|
|
109
|
-
// Don't redirect packages that are excluded from optimization
|
|
110
101
|
if (clientExclude.includes(packageName)) return;
|
|
111
102
|
|
|
112
103
|
if (debug) dedupedPackages.add(packageName);
|
|
113
104
|
|
|
114
|
-
// Return a virtual module that re-exports via bare specifier
|
|
115
105
|
return `\0rango:dedup/${packageName}`;
|
|
116
106
|
},
|
|
117
107
|
|
|
@@ -120,7 +110,6 @@ export function clientRefDedup(): Plugin {
|
|
|
120
110
|
|
|
121
111
|
const packageName = id.slice("\0rango:dedup/".length);
|
|
122
112
|
|
|
123
|
-
// Re-export via bare specifier so Vite routes through pre-bundling
|
|
124
113
|
return [
|
|
125
114
|
`export * from ${JSON.stringify(packageName)};`,
|
|
126
115
|
`import * as __all__ from ${JSON.stringify(packageName)};`,
|
|
@@ -5,7 +5,6 @@ import { createRangoDebugger, createCounter, NS } from "../debug.js";
|
|
|
5
5
|
|
|
6
6
|
const debug = createRangoDebugger(NS.transform);
|
|
7
7
|
|
|
8
|
-
// Dev-mode client-reference key prefixes emitted by @vitejs/plugin-rsc
|
|
9
8
|
const CLIENT_PKG_PROXY_PREFIX =
|
|
10
9
|
"/@id/__x00__virtual:vite-rsc/client-package-proxy/";
|
|
11
10
|
const CLIENT_IN_SERVER_PKG_PROXY_PREFIX =
|
|
@@ -40,32 +39,24 @@ export function computeProductionHash(
|
|
|
40
39
|
let toHash: string;
|
|
41
40
|
|
|
42
41
|
if (refKey.startsWith(CLIENT_PKG_PROXY_PREFIX)) {
|
|
43
|
-
// /@id/__x00__virtual:vite-rsc/client-package-proxy/<pkg> -> hash("<pkg>")
|
|
44
42
|
toHash = refKey.slice(CLIENT_PKG_PROXY_PREFIX.length);
|
|
45
43
|
} else if (refKey.startsWith(CLIENT_IN_SERVER_PKG_PROXY_PREFIX)) {
|
|
46
|
-
// /@id/__x00__virtual:vite-rsc/client-in-server-package-proxy/<encodedAbsPath>
|
|
47
44
|
const absPath = decodeURIComponent(
|
|
48
45
|
refKey.slice(CLIENT_IN_SERVER_PKG_PROXY_PREFIX.length),
|
|
49
46
|
);
|
|
50
47
|
toHash = relative(projectRoot, absPath).replaceAll("\\", "/");
|
|
51
48
|
} else if (refKey.startsWith(FS_PREFIX)) {
|
|
52
|
-
// /@fs/abs/path.tsx -> hash(relative(root, "/abs/path.tsx"))
|
|
53
49
|
const absPath = refKey.slice(FS_PREFIX.length - 1); // keep leading /
|
|
54
50
|
toHash = relative(projectRoot, absPath).replaceAll("\\", "/");
|
|
55
51
|
} else if (refKey.startsWith("/")) {
|
|
56
|
-
// /src/Button.tsx -> hash("src/Button.tsx")
|
|
57
52
|
toHash = refKey.slice(1);
|
|
58
53
|
} else {
|
|
59
|
-
// Already hashed or unknown format — return unchanged
|
|
60
54
|
return refKey;
|
|
61
55
|
}
|
|
62
56
|
|
|
63
57
|
return hashRefKey(toHash);
|
|
64
58
|
}
|
|
65
59
|
|
|
66
|
-
// Regex to match registerClientReference() calls as emitted by @vitejs/plugin-rsc.
|
|
67
|
-
// Captures the reference key (second argument) from the call.
|
|
68
|
-
// Handles two proxy forms: parenthesized expression `(expr)` and arrow-throw `() => { ... }`.
|
|
69
60
|
const REGISTER_CLIENT_REF_RE =
|
|
70
61
|
/registerClientReference\(\s*(?:(?:\([^)]*\))|(?:\(\)[\s\S]*?\}))\s*,\s*"([^"]+)"\s*,\s*"[^"]+"\s*\)/g;
|
|
71
62
|
|
|
@@ -106,7 +97,6 @@ export function hashClientRefs(projectRoot: string): Plugin {
|
|
|
106
97
|
const counter = createCounter(debug, "hash-client-refs");
|
|
107
98
|
return {
|
|
108
99
|
name: "@rangojs/router:hash-client-refs",
|
|
109
|
-
// Run after the RSC plugin's transform (default enforce is normal)
|
|
110
100
|
enforce: "post",
|
|
111
101
|
applyToEnvironment(env) {
|
|
112
102
|
return env.name === "rsc";
|