react-router 7.15.1 → 8.0.0-pre.0
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/CHANGELOG.md +18 -2
- package/dist/development/dom-export.d.ts +6 -172
- package/dist/development/dom-export.js +12 -1007
- package/dist/development/index-react-server-client.d.ts +7 -4
- package/dist/development/index-react-server-client.js +8 -52
- package/dist/development/index-react-server.d.ts +1645 -1635
- package/dist/development/index-react-server.js +2880 -3642
- package/dist/development/index.d.ts +43 -1469
- package/dist/development/index.js +37 -2621
- package/dist/development/lib/actions.js +62 -0
- package/dist/development/lib/components.d.ts +1022 -0
- package/dist/development/lib/components.js +835 -0
- package/dist/development/lib/context.d.ts +83 -0
- package/dist/development/lib/context.js +41 -0
- package/dist/development/lib/dom/dom.d.ts +119 -0
- package/dist/development/lib/dom/dom.js +143 -0
- package/dist/development/lib/dom/lib.d.ts +2042 -0
- package/dist/development/lib/dom/lib.js +1259 -0
- package/dist/development/lib/dom/server.d.ts +138 -0
- package/dist/development/lib/dom/server.js +301 -0
- package/dist/development/lib/dom/ssr/components.d.ts +196 -0
- package/dist/development/lib/dom/ssr/components.js +579 -0
- package/dist/development/lib/dom/ssr/data.js +29 -0
- package/dist/development/lib/dom/ssr/entry.d.ts +59 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.js +83 -0
- package/dist/development/lib/dom/ssr/errors.d.ts +7 -0
- package/dist/development/lib/dom/ssr/errors.js +36 -0
- package/dist/development/lib/dom/ssr/fallback.js +28 -0
- package/dist/development/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/development/lib/dom/ssr/fog-of-war.js +170 -0
- package/dist/development/lib/dom/ssr/hydration.d.ts +32 -0
- package/dist/development/lib/dom/ssr/hydration.js +29 -0
- package/dist/development/lib/dom/ssr/invariant.js +16 -0
- package/dist/development/lib/dom/ssr/links.js +170 -0
- package/dist/development/lib/dom/ssr/markup.js +24 -0
- package/dist/development/lib/dom/ssr/routeModules.d.ts +206 -0
- package/dist/development/lib/dom/ssr/routeModules.js +31 -0
- package/dist/development/lib/dom/ssr/routes-test-stub.d.ts +62 -0
- package/dist/development/lib/dom/ssr/routes-test-stub.js +108 -0
- package/dist/development/lib/dom/ssr/routes.d.ts +33 -0
- package/dist/development/lib/dom/ssr/routes.js +303 -0
- package/dist/development/lib/dom/ssr/server.d.ts +45 -0
- package/dist/development/lib/dom/ssr/server.js +68 -0
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/development/lib/dom/ssr/single-fetch.js +346 -0
- package/dist/development/lib/dom-export/dom-router-provider.d.ts +9 -0
- package/dist/development/lib/dom-export/dom-router-provider.js +22 -0
- package/dist/development/lib/dom-export/hydrated-router.d.ts +125 -0
- package/dist/development/lib/dom-export/hydrated-router.js +153 -0
- package/dist/development/lib/errors.js +29 -0
- package/dist/development/lib/hooks.d.ts +947 -0
- package/dist/development/lib/hooks.js +1386 -0
- package/dist/development/lib/href.d.ts +20 -0
- package/dist/development/lib/href.js +50 -0
- package/dist/development/lib/router/history.d.ts +258 -0
- package/dist/development/lib/router/history.js +371 -0
- package/dist/development/lib/router/instrumentation.d.ts +86 -0
- package/dist/development/lib/router/instrumentation.js +213 -0
- package/dist/development/lib/router/links.d.ts +113 -0
- package/dist/development/lib/router/router.d.ts +663 -0
- package/dist/development/lib/router/router.js +2981 -0
- package/dist/development/lib/router/utils.d.ts +942 -0
- package/dist/development/lib/router/utils.js +791 -0
- package/dist/development/lib/rsc/browser.d.ts +137 -0
- package/dist/development/lib/rsc/browser.js +599 -0
- package/dist/development/lib/rsc/errorBoundaries.d.ts +11 -0
- package/dist/development/lib/rsc/errorBoundaries.js +90 -0
- package/dist/development/lib/rsc/html-stream/browser.d.ts +48 -0
- package/dist/development/lib/rsc/html-stream/browser.js +74 -0
- package/dist/development/lib/rsc/html-stream/server.js +78 -0
- package/dist/development/lib/rsc/route-modules.js +27 -0
- package/dist/development/lib/rsc/server.rsc.d.ts +219 -0
- package/dist/development/lib/rsc/server.ssr.d.ts +129 -0
- package/dist/development/lib/rsc/server.ssr.js +388 -0
- package/dist/development/lib/server-runtime/build.d.ts +66 -0
- package/dist/development/lib/server-runtime/cookies.d.ts +66 -0
- package/dist/development/lib/server-runtime/cookies.js +139 -0
- package/dist/development/lib/server-runtime/crypto.js +43 -0
- package/dist/development/lib/server-runtime/data.d.ts +13 -0
- package/dist/development/lib/server-runtime/data.js +25 -0
- package/dist/development/lib/server-runtime/dev.d.ts +9 -0
- package/dist/development/lib/server-runtime/dev.js +26 -0
- package/dist/development/lib/server-runtime/entry.js +20 -0
- package/dist/development/lib/server-runtime/errors.js +95 -0
- package/dist/development/lib/server-runtime/headers.js +73 -0
- package/dist/development/lib/server-runtime/invariant.js +19 -0
- package/dist/development/lib/server-runtime/mode.d.ts +12 -0
- package/dist/development/lib/server-runtime/mode.js +25 -0
- package/dist/development/lib/server-runtime/routeMatching.js +28 -0
- package/dist/development/lib/server-runtime/routes.d.ts +13 -0
- package/dist/development/lib/server-runtime/routes.js +74 -0
- package/dist/development/lib/server-runtime/server.d.ts +10 -0
- package/dist/development/lib/server-runtime/server.js +351 -0
- package/dist/development/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +45 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +52 -0
- package/dist/development/lib/server-runtime/sessions.d.ts +145 -0
- package/dist/development/lib/server-runtime/sessions.js +98 -0
- package/dist/development/lib/server-runtime/single-fetch.d.ts +7 -0
- package/dist/development/lib/server-runtime/single-fetch.js +215 -0
- package/dist/development/lib/server-runtime/urls.js +31 -0
- package/dist/development/lib/server-runtime/warnings.js +20 -0
- package/dist/development/lib/types/future.d.ts +9 -0
- package/dist/development/lib/types/internal.d.ts +26 -177
- package/dist/development/lib/types/internal.js +3 -2
- package/dist/{production/register-Bsscfj79.d.ts → development/lib/types/register.d.ts} +9 -15
- package/dist/development/lib/types/route-data.d.ts +113 -0
- package/dist/development/lib/types/route-module-annotations.d.ts +149 -0
- package/dist/development/lib/types/route-module.d.ts +19 -0
- package/dist/development/lib/types/serializes-to.d.ts +13 -0
- package/dist/development/lib/types/utils.d.ts +11 -0
- package/dist/development/vendor/turbo-stream-v2/flatten.js +159 -0
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +178 -0
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +198 -0
- package/dist/development/vendor/turbo-stream-v2/utils.js +47 -0
- package/dist/production/dom-export.d.ts +6 -172
- package/dist/production/dom-export.js +12 -1007
- package/dist/production/index-react-server-client.d.ts +7 -4
- package/dist/production/index-react-server-client.js +8 -52
- package/dist/production/index-react-server.d.ts +1645 -1635
- package/dist/production/index-react-server.js +2871 -3642
- package/dist/production/index.d.ts +43 -1469
- package/dist/production/index.js +37 -2621
- package/dist/production/lib/actions.js +62 -0
- package/dist/production/lib/components.d.ts +1022 -0
- package/dist/production/lib/components.js +835 -0
- package/dist/production/lib/context.d.ts +83 -0
- package/dist/production/lib/context.js +41 -0
- package/dist/production/lib/dom/dom.d.ts +119 -0
- package/dist/production/lib/dom/dom.js +143 -0
- package/dist/production/lib/dom/lib.d.ts +2042 -0
- package/dist/production/lib/dom/lib.js +1259 -0
- package/dist/production/lib/dom/server.d.ts +138 -0
- package/dist/production/lib/dom/server.js +301 -0
- package/dist/production/lib/dom/ssr/components.d.ts +196 -0
- package/dist/production/lib/dom/ssr/components.js +579 -0
- package/dist/production/lib/dom/ssr/data.js +29 -0
- package/dist/production/lib/dom/ssr/entry.d.ts +59 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.js +83 -0
- package/dist/production/lib/dom/ssr/errors.d.ts +7 -0
- package/dist/production/lib/dom/ssr/errors.js +36 -0
- package/dist/production/lib/dom/ssr/fallback.js +21 -0
- package/dist/production/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/production/lib/dom/ssr/fog-of-war.js +170 -0
- package/dist/production/lib/dom/ssr/hydration.d.ts +32 -0
- package/dist/production/lib/dom/ssr/hydration.js +29 -0
- package/dist/production/lib/dom/ssr/invariant.js +16 -0
- package/dist/production/lib/dom/ssr/links.js +170 -0
- package/dist/production/lib/dom/ssr/markup.js +24 -0
- package/dist/production/lib/dom/ssr/routeModules.d.ts +206 -0
- package/dist/production/lib/dom/ssr/routeModules.js +31 -0
- package/dist/production/lib/dom/ssr/routes-test-stub.d.ts +62 -0
- package/dist/production/lib/dom/ssr/routes-test-stub.js +108 -0
- package/dist/production/lib/dom/ssr/routes.d.ts +33 -0
- package/dist/production/lib/dom/ssr/routes.js +303 -0
- package/dist/production/lib/dom/ssr/server.d.ts +45 -0
- package/dist/production/lib/dom/ssr/server.js +68 -0
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/production/lib/dom/ssr/single-fetch.js +346 -0
- package/dist/production/lib/dom-export/dom-router-provider.d.ts +9 -0
- package/dist/production/lib/dom-export/dom-router-provider.js +22 -0
- package/dist/production/lib/dom-export/hydrated-router.d.ts +125 -0
- package/dist/production/lib/dom-export/hydrated-router.js +153 -0
- package/dist/production/lib/errors.js +29 -0
- package/dist/production/lib/hooks.d.ts +947 -0
- package/dist/production/lib/hooks.js +1371 -0
- package/dist/production/lib/href.d.ts +20 -0
- package/dist/production/lib/href.js +50 -0
- package/dist/production/lib/router/history.d.ts +258 -0
- package/dist/production/lib/router/history.js +371 -0
- package/dist/production/lib/router/instrumentation.d.ts +86 -0
- package/dist/production/lib/router/instrumentation.js +213 -0
- package/dist/production/lib/router/links.d.ts +113 -0
- package/dist/production/lib/router/router.d.ts +663 -0
- package/dist/production/lib/router/router.js +2981 -0
- package/dist/production/lib/router/utils.d.ts +942 -0
- package/dist/production/lib/router/utils.js +782 -0
- package/dist/production/lib/rsc/browser.d.ts +137 -0
- package/dist/production/lib/rsc/browser.js +599 -0
- package/dist/production/lib/rsc/errorBoundaries.d.ts +11 -0
- package/dist/production/lib/rsc/errorBoundaries.js +90 -0
- package/dist/production/lib/rsc/html-stream/browser.d.ts +48 -0
- package/dist/production/lib/rsc/html-stream/browser.js +74 -0
- package/dist/production/lib/rsc/html-stream/server.js +78 -0
- package/dist/production/lib/rsc/route-modules.js +27 -0
- package/dist/production/lib/rsc/server.rsc.d.ts +219 -0
- package/dist/production/lib/rsc/server.ssr.d.ts +129 -0
- package/dist/production/lib/rsc/server.ssr.js +388 -0
- package/dist/production/lib/server-runtime/build.d.ts +66 -0
- package/dist/production/lib/server-runtime/cookies.d.ts +66 -0
- package/dist/production/lib/server-runtime/cookies.js +139 -0
- package/dist/production/lib/server-runtime/crypto.js +43 -0
- package/dist/production/lib/server-runtime/data.d.ts +13 -0
- package/dist/production/lib/server-runtime/data.js +25 -0
- package/dist/production/lib/server-runtime/dev.d.ts +9 -0
- package/dist/production/lib/server-runtime/dev.js +26 -0
- package/dist/production/lib/server-runtime/entry.js +20 -0
- package/dist/production/lib/server-runtime/errors.js +95 -0
- package/dist/production/lib/server-runtime/headers.js +73 -0
- package/dist/production/lib/server-runtime/invariant.js +19 -0
- package/dist/production/lib/server-runtime/mode.d.ts +12 -0
- package/dist/production/lib/server-runtime/mode.js +25 -0
- package/dist/production/lib/server-runtime/routeMatching.js +28 -0
- package/dist/production/lib/server-runtime/routes.d.ts +13 -0
- package/dist/production/lib/server-runtime/routes.js +74 -0
- package/dist/production/lib/server-runtime/server.d.ts +10 -0
- package/dist/production/lib/server-runtime/server.js +351 -0
- package/dist/production/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +45 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +52 -0
- package/dist/production/lib/server-runtime/sessions.d.ts +145 -0
- package/dist/production/lib/server-runtime/sessions.js +98 -0
- package/dist/production/lib/server-runtime/single-fetch.d.ts +7 -0
- package/dist/production/lib/server-runtime/single-fetch.js +215 -0
- package/dist/production/lib/server-runtime/urls.js +31 -0
- package/dist/production/lib/server-runtime/warnings.js +20 -0
- package/dist/production/lib/types/future.d.ts +9 -0
- package/dist/production/lib/types/internal.d.ts +26 -177
- package/dist/production/lib/types/internal.js +3 -2
- package/dist/{development/register-Bsscfj79.d.ts → production/lib/types/register.d.ts} +9 -15
- package/dist/production/lib/types/route-data.d.ts +113 -0
- package/dist/production/lib/types/route-module-annotations.d.ts +149 -0
- package/dist/production/lib/types/route-module.d.ts +19 -0
- package/dist/production/lib/types/serializes-to.d.ts +13 -0
- package/dist/production/lib/types/utils.d.ts +11 -0
- package/dist/production/vendor/turbo-stream-v2/flatten.js +159 -0
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +178 -0
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +198 -0
- package/dist/production/vendor/turbo-stream-v2/utils.js +47 -0
- package/docs/explanation/backend-for-frontend.md +50 -0
- package/docs/explanation/code-splitting.md +77 -0
- package/docs/explanation/concurrency.md +135 -0
- package/docs/explanation/form-vs-fetcher.md +292 -0
- package/docs/explanation/hot-module-replacement.md +137 -0
- package/docs/explanation/hydration.md +14 -0
- package/docs/explanation/index-query-param.md +86 -0
- package/docs/explanation/index.md +4 -0
- package/docs/explanation/lazy-route-discovery.md +78 -0
- package/docs/explanation/location.md +6 -0
- package/docs/explanation/progressive-enhancement.md +150 -0
- package/docs/explanation/race-conditions.md +88 -0
- package/docs/explanation/react-transitions.md +160 -0
- package/docs/explanation/route-matching.md +7 -0
- package/docs/explanation/server-client-execution.md +4 -0
- package/docs/explanation/sessions-and-cookies.md +465 -0
- package/docs/explanation/special-files.md +16 -0
- package/docs/explanation/state-management.md +524 -0
- package/docs/explanation/styling.md +87 -0
- package/docs/explanation/type-safety.md +82 -0
- package/docs/how-to/accessibility.md +44 -0
- package/docs/how-to/client-data.md +199 -0
- package/docs/how-to/data-strategy.md +317 -0
- package/docs/how-to/error-boundary.md +231 -0
- package/docs/how-to/error-reporting.md +134 -0
- package/docs/how-to/fetchers.md +307 -0
- package/docs/how-to/file-route-conventions.md +410 -0
- package/docs/how-to/file-uploads.md +217 -0
- package/docs/how-to/form-validation.md +120 -0
- package/docs/how-to/headers.md +164 -0
- package/docs/how-to/index.md +4 -0
- package/docs/how-to/instrumentation.md +556 -0
- package/docs/how-to/meta.md +40 -0
- package/docs/how-to/middleware.md +728 -0
- package/docs/how-to/navigation-blocking.md +233 -0
- package/docs/how-to/optimize-revalidation.md +12 -0
- package/docs/how-to/pre-rendering.md +225 -0
- package/docs/how-to/presets.md +103 -0
- package/docs/how-to/react-server-components.md +899 -0
- package/docs/how-to/resource-routes.md +126 -0
- package/docs/how-to/route-module-type-safety.md +100 -0
- package/docs/how-to/search-params.md +4 -0
- package/docs/how-to/security.md +30 -0
- package/docs/how-to/server-bundles.md +66 -0
- package/docs/how-to/spa.md +120 -0
- package/docs/how-to/status.md +63 -0
- package/docs/how-to/suspense.md +132 -0
- package/docs/how-to/using-handle.md +117 -0
- package/docs/how-to/view-transitions.md +237 -0
- package/docs/how-to/webhook.md +50 -0
- package/docs/index.md +39 -0
- package/docs/start/data/actions.md +138 -0
- package/docs/start/data/custom.md +198 -0
- package/docs/start/data/data-loading.md +44 -0
- package/docs/start/data/index.md +4 -0
- package/docs/start/data/installation.md +52 -0
- package/docs/start/data/navigating.md +12 -0
- package/docs/start/data/pending-ui.md +12 -0
- package/docs/start/data/route-object.md +248 -0
- package/docs/start/data/routing.md +281 -0
- package/docs/start/data/testing.md +8 -0
- package/docs/start/declarative/index.md +4 -0
- package/docs/start/declarative/installation.md +43 -0
- package/docs/start/declarative/navigating.md +133 -0
- package/docs/start/declarative/routing.md +237 -0
- package/docs/start/declarative/url-values.md +65 -0
- package/docs/start/framework/actions.md +175 -0
- package/docs/start/framework/data-loading.md +201 -0
- package/docs/start/framework/deploying.md +96 -0
- package/docs/start/framework/index.md +4 -0
- package/docs/start/framework/installation.md +42 -0
- package/docs/start/framework/navigating.md +182 -0
- package/docs/start/framework/pending-ui.md +142 -0
- package/docs/start/framework/rendering.md +59 -0
- package/docs/start/framework/route-module.md +527 -0
- package/docs/start/framework/routing.md +362 -0
- package/docs/start/framework/testing.md +133 -0
- package/docs/start/index.md +4 -0
- package/docs/start/modes.md +201 -0
- package/docs/upgrading/component-routes.md +363 -0
- package/docs/upgrading/future.md +31 -0
- package/docs/upgrading/index.md +4 -0
- package/docs/upgrading/remix.md +403 -0
- package/docs/upgrading/router-provider.md +442 -0
- package/docs/upgrading/v6.md +379 -0
- package/package.json +44 -87
- package/dist/development/browser-3AnU12UI.d.mts +0 -318
- package/dist/development/browser-BOdXz9dK.d.ts +0 -318
- package/dist/development/chunk-4N6VE7H7.mjs +0 -11528
- package/dist/development/chunk-4YRVXM2U.js +0 -188
- package/dist/development/chunk-66UKHEGQ.js +0 -1362
- package/dist/development/chunk-D6LUOGOQ.js +0 -10229
- package/dist/development/chunk-RJYABSBD.mjs +0 -2585
- package/dist/development/context-ByvtofY2.d.mts +0 -1771
- package/dist/development/data-BVUf681J.d.mts +0 -1732
- package/dist/development/data-BqZ2x964.d.ts +0 -1732
- package/dist/development/dom-export.d.mts +0 -172
- package/dist/development/dom-export.mjs +0 -1008
- package/dist/development/index-react-server-client-BS5F89FR.d.ts +0 -3655
- package/dist/development/index-react-server-client-DY04-103.d.mts +0 -2600
- package/dist/development/index-react-server-client.d.mts +0 -4
- package/dist/development/index-react-server-client.mjs +0 -59
- package/dist/development/index-react-server.d.mts +0 -2703
- package/dist/development/index-react-server.mjs +0 -3780
- package/dist/development/index.d.mts +0 -1472
- package/dist/development/index.mjs +0 -277
- package/dist/development/instrumentation-cRWWLfsU.d.ts +0 -715
- package/dist/development/lib/types/internal.d.mts +0 -184
- package/dist/development/lib/types/internal.mjs +0 -10
- package/dist/development/register-Df8okEea.d.mts +0 -30
- package/dist/production/browser-3AnU12UI.d.mts +0 -318
- package/dist/production/browser-BOdXz9dK.d.ts +0 -318
- package/dist/production/chunk-6S4627ZB.mjs +0 -2585
- package/dist/production/chunk-HUBUW7R3.js +0 -10229
- package/dist/production/chunk-JAKZPQZC.mjs +0 -11528
- package/dist/production/chunk-PNZCCTKT.js +0 -1362
- package/dist/production/chunk-Y6IFXO7V.js +0 -188
- package/dist/production/context-ByvtofY2.d.mts +0 -1771
- package/dist/production/data-BVUf681J.d.mts +0 -1732
- package/dist/production/data-BqZ2x964.d.ts +0 -1732
- package/dist/production/dom-export.d.mts +0 -172
- package/dist/production/dom-export.mjs +0 -1008
- package/dist/production/index-react-server-client-BS5F89FR.d.ts +0 -3655
- package/dist/production/index-react-server-client-DY04-103.d.mts +0 -2600
- package/dist/production/index-react-server-client.d.mts +0 -4
- package/dist/production/index-react-server-client.mjs +0 -59
- package/dist/production/index-react-server.d.mts +0 -2703
- package/dist/production/index-react-server.mjs +0 -3780
- package/dist/production/index.d.mts +0 -1472
- package/dist/production/index.mjs +0 -277
- package/dist/production/instrumentation-cRWWLfsU.d.ts +0 -715
- package/dist/production/lib/types/internal.d.mts +0 -184
- package/dist/production/lib/types/internal.mjs +0 -10
- package/dist/production/register-Df8okEea.d.mts +0 -30
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v8.0.0-pre.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { warnOnce } from "./warnings.js";
|
|
12
|
+
import { createCookie, isCookie } from "./cookies.js";
|
|
13
|
+
//#region lib/server-runtime/sessions.ts
|
|
14
|
+
function flash(name) {
|
|
15
|
+
return `__flash_${name}__`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new Session object.
|
|
19
|
+
*
|
|
20
|
+
* Note: This function is typically not invoked directly by application code.
|
|
21
|
+
* Instead, use a `SessionStorage` object's `getSession` method.
|
|
22
|
+
*/
|
|
23
|
+
const createSession = (initialData = {}, id = "") => {
|
|
24
|
+
let map = new Map(Object.entries(initialData));
|
|
25
|
+
return {
|
|
26
|
+
get id() {
|
|
27
|
+
return id;
|
|
28
|
+
},
|
|
29
|
+
get data() {
|
|
30
|
+
return Object.fromEntries(map);
|
|
31
|
+
},
|
|
32
|
+
has(name) {
|
|
33
|
+
return map.has(name) || map.has(flash(name));
|
|
34
|
+
},
|
|
35
|
+
get(name) {
|
|
36
|
+
if (map.has(name)) return map.get(name);
|
|
37
|
+
let flashName = flash(name);
|
|
38
|
+
if (map.has(flashName)) {
|
|
39
|
+
let value = map.get(flashName);
|
|
40
|
+
map.delete(flashName);
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
set(name, value) {
|
|
45
|
+
map.set(name, value);
|
|
46
|
+
},
|
|
47
|
+
flash(name, value) {
|
|
48
|
+
map.set(flash(name), value);
|
|
49
|
+
},
|
|
50
|
+
unset(name) {
|
|
51
|
+
map.delete(name);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Returns true if an object is a React Router session.
|
|
57
|
+
*
|
|
58
|
+
* @see https://reactrouter.com/api/utils/isSession
|
|
59
|
+
*/
|
|
60
|
+
const isSession = (object) => {
|
|
61
|
+
return object != null && typeof object.id === "string" && typeof object.data !== "undefined" && typeof object.has === "function" && typeof object.get === "function" && typeof object.set === "function" && typeof object.flash === "function" && typeof object.unset === "function";
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Creates a SessionStorage object using a SessionIdStorageStrategy.
|
|
65
|
+
*
|
|
66
|
+
* Note: This is a low-level API that should only be used if none of the
|
|
67
|
+
* existing session storage options meet your requirements.
|
|
68
|
+
*/
|
|
69
|
+
function createSessionStorage({ cookie: cookieArg, createData, readData, updateData, deleteData }) {
|
|
70
|
+
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg?.name || "__session", cookieArg);
|
|
71
|
+
warnOnceAboutSigningSessionCookie(cookie);
|
|
72
|
+
return {
|
|
73
|
+
async getSession(cookieHeader, options) {
|
|
74
|
+
let id = cookieHeader && await cookie.parse(cookieHeader, options);
|
|
75
|
+
return createSession(id && await readData(id) || {}, id || "");
|
|
76
|
+
},
|
|
77
|
+
async commitSession(session, options) {
|
|
78
|
+
let { id, data } = session;
|
|
79
|
+
let expires = options?.maxAge != null ? new Date(Date.now() + options.maxAge * 1e3) : options?.expires != null ? options.expires : cookie.expires;
|
|
80
|
+
if (id) await updateData(id, data, expires);
|
|
81
|
+
else id = await createData(data, expires);
|
|
82
|
+
return cookie.serialize(id, options);
|
|
83
|
+
},
|
|
84
|
+
async destroySession(session, options) {
|
|
85
|
+
await deleteData(session.id);
|
|
86
|
+
return cookie.serialize("", {
|
|
87
|
+
...options,
|
|
88
|
+
maxAge: void 0,
|
|
89
|
+
expires: /* @__PURE__ */ new Date(0)
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function warnOnceAboutSigningSessionCookie(cookie) {
|
|
95
|
+
warnOnce(cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be signed to prevent tampering on the client before they are sent back to the server. See https://reactrouter.com/explanation/sessions-and-cookies#signing-cookies for more information.`);
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { createSession, createSessionStorage, isSession, warnOnceAboutSigningSessionCookie };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
//#region lib/server-runtime/single-fetch.d.ts
|
|
3
|
+
type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
|
|
4
|
+
[key: PropertyKey]: Serializable;
|
|
5
|
+
} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Serializable };
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v8.0.0-pre.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { ErrorResponseImpl, isRouteErrorResponse, stripBasename } from "../router/utils.js";
|
|
12
|
+
import { isRedirectStatusCode, isResponse } from "../router/router.js";
|
|
13
|
+
import { encode } from "../../vendor/turbo-stream-v2/turbo-stream.js";
|
|
14
|
+
import { NO_BODY_STATUS_CODES, SingleFetchRedirectSymbol } from "../dom/ssr/single-fetch.js";
|
|
15
|
+
import "./mode.js";
|
|
16
|
+
import { sanitizeError, sanitizeErrors } from "./errors.js";
|
|
17
|
+
import { getDocumentHeaders } from "./headers.js";
|
|
18
|
+
import { throwIfPotentialCSRFAttack } from "../actions.js";
|
|
19
|
+
import { getNormalizedPath } from "./urls.js";
|
|
20
|
+
//#region lib/server-runtime/single-fetch.ts
|
|
21
|
+
const SERVER_NO_BODY_STATUS_CODES = new Set([...NO_BODY_STATUS_CODES, 304]);
|
|
22
|
+
async function singleFetchAction(build, serverMode, staticHandler, request, loadContext, handleError) {
|
|
23
|
+
try {
|
|
24
|
+
try {
|
|
25
|
+
throwIfPotentialCSRFAttack(request.headers, Array.isArray(build.allowedActionOrigins) ? build.allowedActionOrigins : []);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return handleQueryError(/* @__PURE__ */ new Error("Bad Request"), 400);
|
|
28
|
+
}
|
|
29
|
+
return handleQueryResult(await staticHandler.query(request, {
|
|
30
|
+
requestContext: loadContext,
|
|
31
|
+
skipLoaderErrorBubbling: true,
|
|
32
|
+
skipRevalidation: true,
|
|
33
|
+
generateMiddlewareResponse: async (query) => {
|
|
34
|
+
try {
|
|
35
|
+
return handleQueryResult(await query(request));
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return handleQueryError(error);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename)
|
|
41
|
+
}));
|
|
42
|
+
} catch (error) {
|
|
43
|
+
return handleQueryError(error);
|
|
44
|
+
}
|
|
45
|
+
function handleQueryResult(result) {
|
|
46
|
+
return isResponse(result) ? result : staticContextToResponse(result);
|
|
47
|
+
}
|
|
48
|
+
function handleQueryError(error, status = 500) {
|
|
49
|
+
handleError(error);
|
|
50
|
+
return generateSingleFetchResponse(request, build, serverMode, {
|
|
51
|
+
result: { error },
|
|
52
|
+
headers: new Headers(),
|
|
53
|
+
status
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function staticContextToResponse(context) {
|
|
57
|
+
let headers = getDocumentHeaders(context, build);
|
|
58
|
+
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) return new Response(null, {
|
|
59
|
+
status: context.statusCode,
|
|
60
|
+
headers
|
|
61
|
+
});
|
|
62
|
+
if (context.errors) {
|
|
63
|
+
Object.values(context.errors).forEach((err) => {
|
|
64
|
+
if (!isRouteErrorResponse(err) || err.error) handleError(err);
|
|
65
|
+
});
|
|
66
|
+
context.errors = sanitizeErrors(context.errors, serverMode);
|
|
67
|
+
}
|
|
68
|
+
let singleFetchResult;
|
|
69
|
+
if (context.errors) singleFetchResult = { error: Object.values(context.errors)[0] };
|
|
70
|
+
else singleFetchResult = { data: Object.values(context.actionData || {})[0] };
|
|
71
|
+
return generateSingleFetchResponse(request, build, serverMode, {
|
|
72
|
+
result: singleFetchResult,
|
|
73
|
+
headers,
|
|
74
|
+
status: context.statusCode
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function singleFetchLoaders(build, serverMode, staticHandler, request, loadContext, handleError) {
|
|
79
|
+
let routesParam = new URL(request.url).searchParams.get("_routes");
|
|
80
|
+
let loadRouteIds = routesParam ? new Set(routesParam.split(",")) : null;
|
|
81
|
+
try {
|
|
82
|
+
return handleQueryResult(await staticHandler.query(request, {
|
|
83
|
+
requestContext: loadContext,
|
|
84
|
+
filterMatchesToLoad: (m) => !loadRouteIds || loadRouteIds.has(m.route.id),
|
|
85
|
+
skipLoaderErrorBubbling: true,
|
|
86
|
+
generateMiddlewareResponse: async (query) => {
|
|
87
|
+
try {
|
|
88
|
+
return handleQueryResult(await query(request));
|
|
89
|
+
} catch (error) {
|
|
90
|
+
return handleQueryError(error);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
normalizePath: (r) => getNormalizedPath(r, build.basename)
|
|
94
|
+
}));
|
|
95
|
+
} catch (error) {
|
|
96
|
+
return handleQueryError(error);
|
|
97
|
+
}
|
|
98
|
+
function handleQueryResult(result) {
|
|
99
|
+
return isResponse(result) ? result : staticContextToResponse(result);
|
|
100
|
+
}
|
|
101
|
+
function handleQueryError(error) {
|
|
102
|
+
handleError(error);
|
|
103
|
+
return generateSingleFetchResponse(request, build, serverMode, {
|
|
104
|
+
result: { error },
|
|
105
|
+
headers: new Headers(),
|
|
106
|
+
status: 500
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function staticContextToResponse(context) {
|
|
110
|
+
let headers = getDocumentHeaders(context, build);
|
|
111
|
+
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) return new Response(null, {
|
|
112
|
+
status: context.statusCode,
|
|
113
|
+
headers
|
|
114
|
+
});
|
|
115
|
+
if (context.errors) {
|
|
116
|
+
Object.values(context.errors).forEach((err) => {
|
|
117
|
+
if (!isRouteErrorResponse(err) || err.error) handleError(err);
|
|
118
|
+
});
|
|
119
|
+
context.errors = sanitizeErrors(context.errors, serverMode);
|
|
120
|
+
}
|
|
121
|
+
let results = {};
|
|
122
|
+
let loadedMatches = new Set(context.matches.filter((m) => loadRouteIds ? loadRouteIds.has(m.route.id) : m.route.loader != null).map((m) => m.route.id));
|
|
123
|
+
if (context.errors) for (let [id, error] of Object.entries(context.errors)) results[id] = { error };
|
|
124
|
+
for (let [id, data] of Object.entries(context.loaderData)) if (!(id in results) && loadedMatches.has(id)) results[id] = { data };
|
|
125
|
+
return generateSingleFetchResponse(request, build, serverMode, {
|
|
126
|
+
result: results,
|
|
127
|
+
headers,
|
|
128
|
+
status: context.statusCode
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function generateSingleFetchResponse(request, build, serverMode, { result, headers, status }) {
|
|
133
|
+
let resultHeaders = new Headers(headers);
|
|
134
|
+
resultHeaders.set("X-Remix-Response", "yes");
|
|
135
|
+
if (SERVER_NO_BODY_STATUS_CODES.has(status)) return new Response(null, {
|
|
136
|
+
status,
|
|
137
|
+
headers: resultHeaders
|
|
138
|
+
});
|
|
139
|
+
resultHeaders.set("Content-Type", "text/x-script");
|
|
140
|
+
resultHeaders.delete("Content-Length");
|
|
141
|
+
return new Response(encodeViaTurboStream(result, request.signal, build.entry.module.streamTimeout, serverMode), {
|
|
142
|
+
status: status || 200,
|
|
143
|
+
headers: resultHeaders
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function generateSingleFetchRedirectResponse(redirectResponse, request, build, serverMode) {
|
|
147
|
+
let redirect = getSingleFetchRedirect(redirectResponse.status, redirectResponse.headers, build.basename);
|
|
148
|
+
let headers = new Headers(redirectResponse.headers);
|
|
149
|
+
headers.delete("Location");
|
|
150
|
+
headers.set("Content-Type", "text/x-script");
|
|
151
|
+
return generateSingleFetchResponse(request, build, serverMode, {
|
|
152
|
+
result: request.method === "GET" ? { [SingleFetchRedirectSymbol]: redirect } : redirect,
|
|
153
|
+
headers,
|
|
154
|
+
status: 202
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function getSingleFetchRedirect(status, headers, basename) {
|
|
158
|
+
let redirect = headers.get("Location");
|
|
159
|
+
if (basename) redirect = stripBasename(redirect, basename) || redirect;
|
|
160
|
+
return {
|
|
161
|
+
redirect,
|
|
162
|
+
status,
|
|
163
|
+
revalidate: headers.has("X-Remix-Revalidate") || headers.has("Set-Cookie"),
|
|
164
|
+
reload: headers.has("X-Remix-Reload-Document"),
|
|
165
|
+
replace: headers.has("X-Remix-Replace")
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function encodeViaTurboStream(data, requestSignal, streamTimeout, serverMode) {
|
|
169
|
+
let controller = new AbortController();
|
|
170
|
+
let timeoutId = setTimeout(() => {
|
|
171
|
+
controller.abort(/* @__PURE__ */ new Error("Server Timeout"));
|
|
172
|
+
cleanupCallbacks();
|
|
173
|
+
}, typeof streamTimeout === "number" ? streamTimeout : 4950);
|
|
174
|
+
let abortControllerOnRequestAbort = () => {
|
|
175
|
+
controller.abort(requestSignal.reason);
|
|
176
|
+
cleanupCallbacks();
|
|
177
|
+
};
|
|
178
|
+
requestSignal.addEventListener("abort", abortControllerOnRequestAbort);
|
|
179
|
+
let cleanupCallbacks = () => {
|
|
180
|
+
clearTimeout(timeoutId);
|
|
181
|
+
requestSignal.removeEventListener("abort", abortControllerOnRequestAbort);
|
|
182
|
+
};
|
|
183
|
+
return encode(data, {
|
|
184
|
+
signal: controller.signal,
|
|
185
|
+
onComplete: cleanupCallbacks,
|
|
186
|
+
plugins: [(value) => {
|
|
187
|
+
if (value instanceof Error) {
|
|
188
|
+
let { name, message, stack } = serverMode === "production" ? sanitizeError(value, serverMode) : value;
|
|
189
|
+
return [
|
|
190
|
+
"SanitizedError",
|
|
191
|
+
name,
|
|
192
|
+
message,
|
|
193
|
+
stack
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
if (value instanceof ErrorResponseImpl) {
|
|
197
|
+
let { data, status, statusText } = value;
|
|
198
|
+
return [
|
|
199
|
+
"ErrorResponse",
|
|
200
|
+
data,
|
|
201
|
+
status,
|
|
202
|
+
statusText
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
if (value && typeof value === "object" && SingleFetchRedirectSymbol in value) return ["SingleFetchRedirect", value[SingleFetchRedirectSymbol]];
|
|
206
|
+
}],
|
|
207
|
+
postPlugins: [(value) => {
|
|
208
|
+
if (!value) return;
|
|
209
|
+
if (typeof value !== "object") return;
|
|
210
|
+
return ["SingleFetchClassInstance", Object.fromEntries(Object.entries(value))];
|
|
211
|
+
}, () => ["SingleFetchFallback"]]
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
export { SERVER_NO_BODY_STATUS_CODES, encodeViaTurboStream, generateSingleFetchRedirectResponse, singleFetchAction, singleFetchLoaders };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v8.0.0-pre.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { stripBasename } from "../router/utils.js";
|
|
12
|
+
//#region lib/server-runtime/urls.ts
|
|
13
|
+
function getNormalizedPath(request, basename) {
|
|
14
|
+
basename = basename || "/";
|
|
15
|
+
let url = new URL(request.url);
|
|
16
|
+
let pathname = url.pathname;
|
|
17
|
+
if (pathname.endsWith("/_.data")) pathname = pathname.replace(/_\.data$/, "");
|
|
18
|
+
else pathname = pathname.replace(/\.data$/, "");
|
|
19
|
+
if (stripBasename(pathname, basename) !== "/" && pathname.endsWith("/")) pathname = pathname.slice(0, -1);
|
|
20
|
+
let searchParams = new URLSearchParams(url.search);
|
|
21
|
+
searchParams.delete("_routes");
|
|
22
|
+
let search = searchParams.toString();
|
|
23
|
+
if (search) search = `?${search}`;
|
|
24
|
+
return {
|
|
25
|
+
pathname,
|
|
26
|
+
search,
|
|
27
|
+
hash: ""
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { getNormalizedPath };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v8.0.0-pre.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
//#region lib/server-runtime/warnings.ts
|
|
12
|
+
const alreadyWarned = {};
|
|
13
|
+
function warnOnce(condition, message) {
|
|
14
|
+
if (!condition && !alreadyWarned[message]) {
|
|
15
|
+
alreadyWarned[message] = true;
|
|
16
|
+
console.warn(message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { warnOnce };
|
|
@@ -1,184 +1,33 @@
|
|
|
1
|
-
import { R as RouteModule, v as LinkDescriptor, L as Location, w as Func, x as Pretty, y as MetaDescriptor, G as GetLoaderData, z as ServerDataFunctionArgs, B as MiddlewareNextFunction, E as ClientDataFunctionArgs, I as DataStrategyResult, J as ServerDataFrom, N as Normalize, K as GetActionData } from '../../data-BqZ2x964.js';
|
|
2
|
-
import { R as RouteFiles, P as Pages } from '../../register-Bsscfj79.js';
|
|
3
|
-
import 'react';
|
|
4
1
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type MatchInfo = {
|
|
16
|
-
id: string;
|
|
17
|
-
module: RouteModule;
|
|
18
|
-
};
|
|
19
|
-
type MetaMatch<T extends MatchInfo> = Pretty<{
|
|
20
|
-
id: T["id"];
|
|
21
|
-
params: Record<string, string | undefined>;
|
|
22
|
-
pathname: string;
|
|
23
|
-
meta: MetaDescriptor[];
|
|
24
|
-
/** @deprecated Use `MetaMatch.loaderData` instead */
|
|
25
|
-
data: GetLoaderData<T["module"]>;
|
|
26
|
-
loaderData: GetLoaderData<T["module"]>;
|
|
27
|
-
handle?: unknown;
|
|
28
|
-
error?: unknown;
|
|
2
|
+
import { Normalize } from "./utils.js";
|
|
3
|
+
import { RouteModule } from "./route-module.js";
|
|
4
|
+
import { GetActionData, GetLoaderData } from "./route-data.js";
|
|
5
|
+
import { GetAnnotations } from "./route-module-annotations.js";
|
|
6
|
+
import { Register } from "react-router";
|
|
7
|
+
|
|
8
|
+
//#region lib/types/internal.d.ts
|
|
9
|
+
type AnyParams = Record<string, string | undefined>;
|
|
10
|
+
type AnyPages = Record<string, {
|
|
11
|
+
params: AnyParams;
|
|
29
12
|
}>;
|
|
30
|
-
type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
location: Location;
|
|
37
|
-
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
|
|
38
|
-
params: T["params"];
|
|
39
|
-
/**
|
|
40
|
-
* The return value for this route's server loader function
|
|
41
|
-
*
|
|
42
|
-
* @deprecated Use `Route.MetaArgs.loaderData` instead
|
|
43
|
-
*/
|
|
44
|
-
data: T["loaderData"] | (HasErrorBoundary<T> extends true ? undefined : never);
|
|
45
|
-
/** The return value for this route's server loader function */
|
|
46
|
-
loaderData: T["loaderData"] | (HasErrorBoundary<T> extends true ? undefined : never);
|
|
47
|
-
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
|
|
48
|
-
error?: unknown;
|
|
49
|
-
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react-router.UIMatch.html route matches}, including parent route matches. */
|
|
50
|
-
matches: MetaMatches<T["matches"]>;
|
|
51
|
-
};
|
|
52
|
-
type MetaDescriptors = MetaDescriptor[];
|
|
53
|
-
type HeadersArgs = {
|
|
54
|
-
loaderHeaders: Headers;
|
|
55
|
-
parentHeaders: Headers;
|
|
56
|
-
actionHeaders: Headers;
|
|
57
|
-
errorHeaders: Headers | undefined;
|
|
58
|
-
};
|
|
59
|
-
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
|
|
60
|
-
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Record<string, DataStrategyResult>>) => MaybePromise<Record<string, DataStrategyResult> | void>;
|
|
61
|
-
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
|
|
62
|
-
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
|
|
63
|
-
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
|
64
|
-
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
|
65
|
-
};
|
|
66
|
-
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
|
|
67
|
-
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
|
|
68
|
-
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
|
|
69
|
-
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
|
70
|
-
};
|
|
71
|
-
type CreateHydrateFallbackProps<T extends RouteInfo, RSCEnabled extends boolean> = {
|
|
72
|
-
params: T["params"];
|
|
73
|
-
} & (RSCEnabled extends true ? {
|
|
74
|
-
/** The data returned from the `loader` */
|
|
75
|
-
loaderData?: ServerDataFrom<T["module"]["loader"]>;
|
|
76
|
-
/** The data returned from the `action` following an action submission. */
|
|
77
|
-
actionData?: ServerDataFrom<T["module"]["action"]>;
|
|
78
|
-
} : {
|
|
79
|
-
/** The data returned from the `loader` or `clientLoader` */
|
|
80
|
-
loaderData?: T["loaderData"];
|
|
81
|
-
/** The data returned from the `action` or `clientAction` following an action submission. */
|
|
82
|
-
actionData?: T["actionData"];
|
|
83
|
-
});
|
|
84
|
-
type Match<T extends MatchInfo> = Pretty<{
|
|
85
|
-
id: T["id"];
|
|
86
|
-
params: Record<string, string | undefined>;
|
|
87
|
-
pathname: string;
|
|
88
|
-
/** @deprecated Use `Match.loaderData` instead */
|
|
89
|
-
data: GetLoaderData<T["module"]>;
|
|
90
|
-
loaderData: GetLoaderData<T["module"]>;
|
|
91
|
-
handle: unknown;
|
|
13
|
+
type Pages = Register extends {
|
|
14
|
+
pages: infer Registered extends AnyPages;
|
|
15
|
+
} ? Registered : AnyPages;
|
|
16
|
+
type AnyRouteFiles = Record<string, {
|
|
17
|
+
id: string;
|
|
18
|
+
page: string;
|
|
92
19
|
}>;
|
|
93
|
-
type
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
97
|
-
* @example
|
|
98
|
-
* // app/routes.ts
|
|
99
|
-
* route("teams/:teamId", "./team.tsx"),
|
|
100
|
-
*
|
|
101
|
-
* // app/team.tsx
|
|
102
|
-
* export default function Component({
|
|
103
|
-
* params,
|
|
104
|
-
* }: Route.ComponentProps) {
|
|
105
|
-
* params.teamId;
|
|
106
|
-
* // ^ string
|
|
107
|
-
* }
|
|
108
|
-
**/
|
|
109
|
-
params: T["params"];
|
|
110
|
-
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react-router.UIMatch.html route matches}, including parent route matches. */
|
|
111
|
-
matches: Matches<T["matches"]>;
|
|
112
|
-
} & (RSCEnabled extends true ? {
|
|
113
|
-
/** The data returned from the `loader` */
|
|
114
|
-
loaderData: ServerDataFrom<T["module"]["loader"]>;
|
|
115
|
-
/** The data returned from the `action` following an action submission. */
|
|
116
|
-
actionData?: ServerDataFrom<T["module"]["action"]>;
|
|
117
|
-
} : {
|
|
118
|
-
/** The data returned from the `loader` or `clientLoader` */
|
|
119
|
-
loaderData: T["loaderData"];
|
|
120
|
-
/** The data returned from the `action` or `clientAction` following an action submission. */
|
|
121
|
-
actionData?: T["actionData"];
|
|
122
|
-
});
|
|
123
|
-
type CreateErrorBoundaryProps<T extends RouteInfo, RSCEnabled extends boolean> = {
|
|
124
|
-
/**
|
|
125
|
-
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
126
|
-
* @example
|
|
127
|
-
* // app/routes.ts
|
|
128
|
-
* route("teams/:teamId", "./team.tsx"),
|
|
129
|
-
*
|
|
130
|
-
* // app/team.tsx
|
|
131
|
-
* export function ErrorBoundary({
|
|
132
|
-
* params,
|
|
133
|
-
* }: Route.ErrorBoundaryProps) {
|
|
134
|
-
* params.teamId;
|
|
135
|
-
* // ^ string
|
|
136
|
-
* }
|
|
137
|
-
**/
|
|
138
|
-
params: T["params"];
|
|
139
|
-
error: unknown;
|
|
140
|
-
} & (RSCEnabled extends true ? {
|
|
141
|
-
/** The data returned from the `loader` */
|
|
142
|
-
loaderData?: ServerDataFrom<T["module"]["loader"]>;
|
|
143
|
-
/** The data returned from the `action` following an action submission. */
|
|
144
|
-
actionData?: ServerDataFrom<T["module"]["action"]>;
|
|
145
|
-
} : {
|
|
146
|
-
/** The data returned from the `loader` or `clientLoader` */
|
|
147
|
-
loaderData?: T["loaderData"];
|
|
148
|
-
/** The data returned from the `action` or `clientAction` following an action submission. */
|
|
149
|
-
actionData?: T["actionData"];
|
|
150
|
-
});
|
|
151
|
-
type GetAnnotations<Info extends RouteInfo> = {
|
|
152
|
-
LinkDescriptors: LinkDescriptor[];
|
|
153
|
-
LinksFunction: () => LinkDescriptor[];
|
|
154
|
-
MetaArgs: CreateMetaArgs<Info>;
|
|
155
|
-
MetaDescriptors: MetaDescriptors;
|
|
156
|
-
MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
|
|
157
|
-
HeadersArgs: HeadersArgs;
|
|
158
|
-
HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
|
|
159
|
-
MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
|
|
160
|
-
ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
|
|
161
|
-
LoaderArgs: CreateServerLoaderArgs<Info>;
|
|
162
|
-
ClientLoaderArgs: CreateClientLoaderArgs<Info>;
|
|
163
|
-
ActionArgs: CreateServerActionArgs<Info>;
|
|
164
|
-
ClientActionArgs: CreateClientActionArgs<Info>;
|
|
165
|
-
HydrateFallbackProps: CreateHydrateFallbackProps<Info, false>;
|
|
166
|
-
ServerHydrateFallbackProps: CreateHydrateFallbackProps<Info, true>;
|
|
167
|
-
ComponentProps: CreateComponentProps<Info, false>;
|
|
168
|
-
ServerComponentProps: CreateComponentProps<Info, true>;
|
|
169
|
-
ErrorBoundaryProps: CreateErrorBoundaryProps<Info, false>;
|
|
170
|
-
ServerErrorBoundaryProps: CreateErrorBoundaryProps<Info, true>;
|
|
171
|
-
};
|
|
172
|
-
|
|
20
|
+
type RouteFiles = Register extends {
|
|
21
|
+
routeFiles: infer Registered extends AnyRouteFiles;
|
|
22
|
+
} ? Registered : AnyRouteFiles;
|
|
173
23
|
type Params<RouteFile extends keyof RouteFiles> = Normalize<Pages[RouteFiles[RouteFile]["page"]]["params"]>;
|
|
174
|
-
|
|
175
24
|
type GetInfo<T extends {
|
|
176
|
-
|
|
177
|
-
|
|
25
|
+
file: keyof RouteFiles;
|
|
26
|
+
module: RouteModule;
|
|
178
27
|
}> = {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
28
|
+
params: Params<T["file"]>;
|
|
29
|
+
loaderData: GetLoaderData<T["module"]>;
|
|
30
|
+
actionData: GetActionData<T["module"]>;
|
|
182
31
|
};
|
|
183
|
-
|
|
184
|
-
export type
|
|
32
|
+
//#endregion
|
|
33
|
+
export { type GetAnnotations, GetInfo };
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import { R as RouteModule } from './data-BqZ2x964.js';
|
|
2
1
|
|
|
2
|
+
import { RouteModule } from "./route-module.js";
|
|
3
|
+
|
|
4
|
+
//#region lib/types/register.d.ts
|
|
3
5
|
/**
|
|
4
6
|
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
|
5
7
|
* React Router should handle this for you via type generation.
|
|
6
8
|
*
|
|
7
9
|
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
|
8
10
|
*/
|
|
9
|
-
interface Register {
|
|
10
|
-
}
|
|
11
|
+
interface Register {}
|
|
11
12
|
type AnyParams = Record<string, string | undefined>;
|
|
12
13
|
type AnyPages = Record<string, {
|
|
13
|
-
|
|
14
|
+
params: AnyParams;
|
|
14
15
|
}>;
|
|
15
16
|
type Pages = Register extends {
|
|
16
|
-
|
|
17
|
+
pages: infer Registered extends AnyPages;
|
|
17
18
|
} ? Registered : AnyPages;
|
|
18
|
-
type AnyRouteFiles = Record<string, {
|
|
19
|
-
id: string;
|
|
20
|
-
page: string;
|
|
21
|
-
}>;
|
|
22
|
-
type RouteFiles = Register extends {
|
|
23
|
-
routeFiles: infer Registered extends AnyRouteFiles;
|
|
24
|
-
} ? Registered : AnyRouteFiles;
|
|
25
19
|
type AnyRouteModules = Record<string, RouteModule>;
|
|
26
20
|
type RouteModules = Register extends {
|
|
27
|
-
|
|
21
|
+
routeModules: infer Registered extends AnyRouteModules;
|
|
28
22
|
} ? Registered : AnyRouteModules;
|
|
29
|
-
|
|
30
|
-
export
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Pages, Register, RouteModules };
|