react-router 7.15.1 → 8.3.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 +181 -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 +1789 -1657
- package/dist/development/index-react-server.js +3074 -3674
- package/dist/development/index.d.ts +41 -1469
- package/dist/development/index.js +36 -2621
- package/dist/development/lib/actions.js +50 -0
- package/dist/development/lib/components.d.ts +1030 -0
- package/dist/development/lib/components.js +841 -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 +2054 -0
- package/dist/development/lib/dom/lib.js +1272 -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 +198 -0
- package/dist/development/lib/dom/ssr/components.js +589 -0
- package/dist/development/lib/dom/ssr/data.js +29 -0
- package/dist/development/lib/dom/ssr/entry.d.ts +60 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.js +87 -0
- package/dist/development/lib/dom/ssr/fallback.js +33 -0
- package/dist/development/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/development/lib/dom/ssr/fog-of-war.js +185 -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 +75 -0
- package/dist/development/lib/dom/ssr/routes-test-stub.js +121 -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 +48 -0
- package/dist/development/lib/dom/ssr/server.js +69 -0
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/development/lib/dom/ssr/single-fetch.js +345 -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 +150 -0
- package/dist/development/lib/errors.js +29 -0
- package/dist/development/lib/hooks.d.ts +974 -0
- package/dist/development/lib/hooks.js +1415 -0
- package/dist/development/lib/href.d.ts +36 -0
- package/dist/development/lib/href.js +70 -0
- package/dist/development/lib/router/history.d.ts +264 -0
- package/dist/development/lib/router/history.js +378 -0
- package/dist/development/lib/router/instrumentation.d.ts +111 -0
- package/dist/development/lib/router/instrumentation.js +290 -0
- package/dist/development/lib/router/links.d.ts +114 -0
- package/dist/development/lib/router/router.d.ts +663 -0
- package/dist/development/lib/router/router.js +2988 -0
- package/dist/development/lib/router/url.js +18 -0
- package/dist/development/lib/router/utils.d.ts +960 -0
- package/dist/development/lib/router/utils.js +881 -0
- package/dist/development/lib/rsc/browser.d.ts +137 -0
- package/dist/development/lib/rsc/browser.js +612 -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 +97 -0
- package/dist/development/lib/rsc/route-modules.js +27 -0
- package/dist/development/lib/rsc/server.rsc.d.ts +224 -0
- package/dist/development/lib/rsc/server.ssr.d.ts +152 -0
- package/dist/development/lib/rsc/server.ssr.js +419 -0
- package/dist/development/lib/server-runtime/build.d.ts +66 -0
- package/dist/development/lib/server-runtime/cookies.d.ts +92 -0
- package/dist/development/lib/server-runtime/cookies.js +153 -0
- package/dist/development/lib/server-runtime/crypto.js +43 -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 +75 -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 +22 -0
- package/dist/development/lib/server-runtime/server.js +364 -0
- package/dist/development/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.d.ts +33 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +53 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.d.ts +29 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +58 -0
- package/dist/development/lib/server-runtime/sessions.d.ts +174 -0
- package/dist/development/lib/server-runtime/sessions.js +115 -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 +28 -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 +179 -0
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +199 -0
- package/dist/development/vendor/turbo-stream-v2/utils.js +39 -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 +1789 -1657
- package/dist/production/index-react-server.js +3065 -3674
- package/dist/production/index.d.ts +41 -1469
- package/dist/production/index.js +36 -2621
- package/dist/production/lib/actions.js +50 -0
- package/dist/production/lib/components.d.ts +1030 -0
- package/dist/production/lib/components.js +841 -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 +2054 -0
- package/dist/production/lib/dom/lib.js +1272 -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 +198 -0
- package/dist/production/lib/dom/ssr/components.js +589 -0
- package/dist/production/lib/dom/ssr/data.js +29 -0
- package/dist/production/lib/dom/ssr/entry.d.ts +60 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.js +87 -0
- package/dist/production/lib/dom/ssr/fallback.js +23 -0
- package/dist/production/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/production/lib/dom/ssr/fog-of-war.js +185 -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 +75 -0
- package/dist/production/lib/dom/ssr/routes-test-stub.js +121 -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 +48 -0
- package/dist/production/lib/dom/ssr/server.js +69 -0
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/production/lib/dom/ssr/single-fetch.js +345 -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 +150 -0
- package/dist/production/lib/errors.js +29 -0
- package/dist/production/lib/hooks.d.ts +974 -0
- package/dist/production/lib/hooks.js +1400 -0
- package/dist/production/lib/href.d.ts +36 -0
- package/dist/production/lib/href.js +70 -0
- package/dist/production/lib/router/history.d.ts +264 -0
- package/dist/production/lib/router/history.js +378 -0
- package/dist/production/lib/router/instrumentation.d.ts +111 -0
- package/dist/production/lib/router/instrumentation.js +290 -0
- package/dist/production/lib/router/links.d.ts +114 -0
- package/dist/production/lib/router/router.d.ts +663 -0
- package/dist/production/lib/router/router.js +2988 -0
- package/dist/production/lib/router/url.js +18 -0
- package/dist/production/lib/router/utils.d.ts +960 -0
- package/dist/production/lib/router/utils.js +872 -0
- package/dist/production/lib/rsc/browser.d.ts +137 -0
- package/dist/production/lib/rsc/browser.js +612 -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 +97 -0
- package/dist/production/lib/rsc/route-modules.js +27 -0
- package/dist/production/lib/rsc/server.rsc.d.ts +224 -0
- package/dist/production/lib/rsc/server.ssr.d.ts +152 -0
- package/dist/production/lib/rsc/server.ssr.js +419 -0
- package/dist/production/lib/server-runtime/build.d.ts +66 -0
- package/dist/production/lib/server-runtime/cookies.d.ts +92 -0
- package/dist/production/lib/server-runtime/cookies.js +153 -0
- package/dist/production/lib/server-runtime/crypto.js +43 -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 +75 -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 +22 -0
- package/dist/production/lib/server-runtime/server.js +364 -0
- package/dist/production/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.d.ts +33 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +53 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.d.ts +29 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +58 -0
- package/dist/production/lib/server-runtime/sessions.d.ts +174 -0
- package/dist/production/lib/server-runtime/sessions.js +115 -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 +28 -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 +179 -0
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +199 -0
- package/dist/production/vendor/turbo-stream-v2/utils.js +39 -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 +142 -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 +165 -0
- package/docs/how-to/index.md +4 -0
- package/docs/how-to/instrumentation.md +661 -0
- package/docs/how-to/meta.md +40 -0
- package/docs/how-to/middleware.md +647 -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 +951 -0
- package/docs/how-to/resource-routes.md +126 -0
- package/docs/how-to/route-module-type-safety.md +85 -0
- package/docs/how-to/search-params.md +4 -0
- package/docs/how-to/security.md +39 -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 +36 -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 +56 -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 +268 -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 +174 -0
- package/docs/start/framework/data-loading.md +201 -0
- package/docs/start/framework/deploying.md +104 -0
- package/docs/start/framework/index.md +4 -0
- package/docs/start/framework/installation.md +41 -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 +200 -0
- package/docs/upgrading/component-routes.md +363 -0
- package/docs/upgrading/future.md +111 -0
- package/docs/upgrading/index.md +4 -0
- package/docs/upgrading/router-provider.md +445 -0
- package/docs/upgrading/v7.md +460 -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,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v8.3.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 { PROTOCOL_RELATIVE_URL_REGEX } from "./url.js";
|
|
12
|
+
//#region lib/router/history.ts
|
|
13
|
+
/**
|
|
14
|
+
* Actions represent the type of change to a location value.
|
|
15
|
+
*/
|
|
16
|
+
let Action = /* @__PURE__ */ function(Action) {
|
|
17
|
+
/**
|
|
18
|
+
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
19
|
+
* as a back or forward navigation. It does not describe the direction of the
|
|
20
|
+
* navigation, only that the current index changed.
|
|
21
|
+
*
|
|
22
|
+
* Note: This is the default action for newly created history objects.
|
|
23
|
+
*/
|
|
24
|
+
Action["Pop"] = "POP";
|
|
25
|
+
/**
|
|
26
|
+
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
27
|
+
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
28
|
+
* entries in the stack are lost.
|
|
29
|
+
*/
|
|
30
|
+
Action["Push"] = "PUSH";
|
|
31
|
+
/**
|
|
32
|
+
* A REPLACE indicates the entry at the current index in the history stack
|
|
33
|
+
* being replaced by a new one.
|
|
34
|
+
*/
|
|
35
|
+
Action["Replace"] = "REPLACE";
|
|
36
|
+
return Action;
|
|
37
|
+
}({});
|
|
38
|
+
const PopStateEventType = "popstate";
|
|
39
|
+
function isLocation(obj) {
|
|
40
|
+
return typeof obj === "object" && obj != null && "pathname" in obj && "search" in obj && "hash" in obj && "state" in obj && "key" in obj;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Memory history stores the current location in memory. It is designed for use
|
|
44
|
+
* in stateful non-browser environments like tests and React Native.
|
|
45
|
+
*/
|
|
46
|
+
function createMemoryHistory(options = {}) {
|
|
47
|
+
let { initialEntries = ["/"], initialIndex, v5Compat = false } = options;
|
|
48
|
+
let entries;
|
|
49
|
+
entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index === 0 ? "default" : void 0, typeof entry === "string" ? void 0 : entry.mask));
|
|
50
|
+
let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);
|
|
51
|
+
let action = "POP";
|
|
52
|
+
let listener = null;
|
|
53
|
+
function clampIndex(n) {
|
|
54
|
+
return Math.min(Math.max(n, 0), entries.length - 1);
|
|
55
|
+
}
|
|
56
|
+
function getCurrentLocation() {
|
|
57
|
+
return entries[index];
|
|
58
|
+
}
|
|
59
|
+
function createMemoryLocation(to, state = null, key, mask) {
|
|
60
|
+
let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key, mask);
|
|
61
|
+
warning(location.pathname.charAt(0) === "/", `relative pathnames are not supported in memory history: ${JSON.stringify(to)}`);
|
|
62
|
+
return location;
|
|
63
|
+
}
|
|
64
|
+
function createHref(to) {
|
|
65
|
+
return typeof to === "string" ? to : createPath(to);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
get index() {
|
|
69
|
+
return index;
|
|
70
|
+
},
|
|
71
|
+
get action() {
|
|
72
|
+
return action;
|
|
73
|
+
},
|
|
74
|
+
get location() {
|
|
75
|
+
return getCurrentLocation();
|
|
76
|
+
},
|
|
77
|
+
createHref,
|
|
78
|
+
createURL(to) {
|
|
79
|
+
return new URL(createHref(to), "http://localhost");
|
|
80
|
+
},
|
|
81
|
+
encodeLocation(to) {
|
|
82
|
+
let path = typeof to === "string" ? parsePath(to) : to;
|
|
83
|
+
return {
|
|
84
|
+
pathname: path.pathname || "",
|
|
85
|
+
search: path.search || "",
|
|
86
|
+
hash: path.hash || ""
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
push(to, state) {
|
|
90
|
+
action = "PUSH";
|
|
91
|
+
let nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);
|
|
92
|
+
index += 1;
|
|
93
|
+
entries.splice(index, entries.length, nextLocation);
|
|
94
|
+
if (v5Compat && listener) listener({
|
|
95
|
+
action,
|
|
96
|
+
location: nextLocation,
|
|
97
|
+
delta: 1
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
replace(to, state) {
|
|
101
|
+
action = "REPLACE";
|
|
102
|
+
let nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);
|
|
103
|
+
entries[index] = nextLocation;
|
|
104
|
+
if (v5Compat && listener) listener({
|
|
105
|
+
action,
|
|
106
|
+
location: nextLocation,
|
|
107
|
+
delta: 0
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
go(delta) {
|
|
111
|
+
action = "POP";
|
|
112
|
+
let nextIndex = clampIndex(index + delta);
|
|
113
|
+
let nextLocation = entries[nextIndex];
|
|
114
|
+
index = nextIndex;
|
|
115
|
+
if (listener) listener({
|
|
116
|
+
action,
|
|
117
|
+
location: nextLocation,
|
|
118
|
+
delta
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
listen(fn) {
|
|
122
|
+
listener = fn;
|
|
123
|
+
return () => {
|
|
124
|
+
listener = null;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Browser history stores the location in regular URLs. This is the standard for
|
|
131
|
+
* most web apps, but it requires some configuration on the server to ensure you
|
|
132
|
+
* serve the same app at multiple URLs.
|
|
133
|
+
*
|
|
134
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
|
|
135
|
+
*/
|
|
136
|
+
function createBrowserHistory(options = {}) {
|
|
137
|
+
function createBrowserLocation(window, globalHistory) {
|
|
138
|
+
let maskedLocation = globalHistory.state?.masked;
|
|
139
|
+
let { pathname, search, hash } = maskedLocation || window.location;
|
|
140
|
+
return createLocation("", {
|
|
141
|
+
pathname,
|
|
142
|
+
search,
|
|
143
|
+
hash
|
|
144
|
+
}, globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default", maskedLocation ? {
|
|
145
|
+
pathname: window.location.pathname,
|
|
146
|
+
search: window.location.search,
|
|
147
|
+
hash: window.location.hash
|
|
148
|
+
} : void 0);
|
|
149
|
+
}
|
|
150
|
+
function createBrowserHref(window, to) {
|
|
151
|
+
return typeof to === "string" ? to : createPath(to);
|
|
152
|
+
}
|
|
153
|
+
return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Hash history stores the location in window.location.hash. This makes it ideal
|
|
157
|
+
* for situations where you don't want to send the location to the server for
|
|
158
|
+
* some reason, either because you do cannot configure it or the URL space is
|
|
159
|
+
* reserved for something else.
|
|
160
|
+
*
|
|
161
|
+
* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory
|
|
162
|
+
*/
|
|
163
|
+
function createHashHistory(options = {}) {
|
|
164
|
+
function createHashLocation(window, globalHistory) {
|
|
165
|
+
let { pathname = "/", search = "", hash = "" } = parsePath(window.location.hash.substring(1));
|
|
166
|
+
if (!pathname.startsWith("/") && !pathname.startsWith(".")) pathname = "/" + pathname;
|
|
167
|
+
return createLocation("", {
|
|
168
|
+
pathname,
|
|
169
|
+
search,
|
|
170
|
+
hash
|
|
171
|
+
}, globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default");
|
|
172
|
+
}
|
|
173
|
+
function createHashHref(window, to) {
|
|
174
|
+
let base = window.document.querySelector("base");
|
|
175
|
+
let href = "";
|
|
176
|
+
if (base && base.getAttribute("href")) {
|
|
177
|
+
let url = window.location.href;
|
|
178
|
+
let hashIndex = url.indexOf("#");
|
|
179
|
+
href = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
180
|
+
}
|
|
181
|
+
return href + "#" + (typeof to === "string" ? to : createPath(to));
|
|
182
|
+
}
|
|
183
|
+
function validateHashLocation(location, to) {
|
|
184
|
+
warning(location.pathname.charAt(0) === "/", `relative pathnames are not supported in hash history.push(${JSON.stringify(to)})`);
|
|
185
|
+
}
|
|
186
|
+
return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);
|
|
187
|
+
}
|
|
188
|
+
function invariant(value, message) {
|
|
189
|
+
if (value === false || value === null || typeof value === "undefined") throw new Error(message);
|
|
190
|
+
}
|
|
191
|
+
function warning(cond, message) {
|
|
192
|
+
if (!cond) {
|
|
193
|
+
if (typeof console !== "undefined") console.warn(message);
|
|
194
|
+
try {
|
|
195
|
+
throw new Error(message);
|
|
196
|
+
} catch (e) {}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function createKey() {
|
|
200
|
+
return Math.random().toString(36).substring(2, 10);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* For browser-based histories, we combine the state and key into an object
|
|
204
|
+
*/
|
|
205
|
+
function getHistoryState(location, index) {
|
|
206
|
+
return {
|
|
207
|
+
usr: location.state,
|
|
208
|
+
key: location.key,
|
|
209
|
+
idx: index,
|
|
210
|
+
masked: location.mask ? {
|
|
211
|
+
pathname: location.pathname,
|
|
212
|
+
search: location.search,
|
|
213
|
+
hash: location.hash
|
|
214
|
+
} : void 0
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Creates a Location object with a unique key from the given Path
|
|
219
|
+
*/
|
|
220
|
+
function createLocation(current, to, state = null, key, mask) {
|
|
221
|
+
return {
|
|
222
|
+
pathname: typeof current === "string" ? current : current.pathname,
|
|
223
|
+
search: "",
|
|
224
|
+
hash: "",
|
|
225
|
+
...typeof to === "string" ? parsePath(to) : to,
|
|
226
|
+
state,
|
|
227
|
+
key: to && to.key || key || createKey(),
|
|
228
|
+
mask
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Creates a string URL path from the given pathname, search, and hash components.
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
* @category Utils
|
|
236
|
+
* @param path The pathname, search, and hash components to combine.
|
|
237
|
+
* @returns The combined URL path.
|
|
238
|
+
*/
|
|
239
|
+
function createPath({ pathname = "/", search = "", hash = "" }) {
|
|
240
|
+
if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
241
|
+
if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
242
|
+
return pathname;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Parses a string URL path into its separate pathname, search, and hash components.
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
* @category Utils
|
|
249
|
+
* @param path The URL path to parse.
|
|
250
|
+
* @returns The parsed pathname, search, and hash components.
|
|
251
|
+
*/
|
|
252
|
+
function parsePath(path) {
|
|
253
|
+
let parsedPath = {};
|
|
254
|
+
if (path) {
|
|
255
|
+
let hashIndex = path.indexOf("#");
|
|
256
|
+
if (hashIndex >= 0) {
|
|
257
|
+
parsedPath.hash = path.substring(hashIndex);
|
|
258
|
+
path = path.substring(0, hashIndex);
|
|
259
|
+
}
|
|
260
|
+
let searchIndex = path.indexOf("?");
|
|
261
|
+
if (searchIndex >= 0) {
|
|
262
|
+
parsedPath.search = path.substring(searchIndex);
|
|
263
|
+
path = path.substring(0, searchIndex);
|
|
264
|
+
}
|
|
265
|
+
if (path) parsedPath.pathname = path;
|
|
266
|
+
}
|
|
267
|
+
return parsedPath;
|
|
268
|
+
}
|
|
269
|
+
function getUrlBasedHistory(getLocation, createHref, validateLocation, options = {}) {
|
|
270
|
+
let { window = document.defaultView, v5Compat = false } = options;
|
|
271
|
+
let globalHistory = window.history;
|
|
272
|
+
let action = "POP";
|
|
273
|
+
let listener = null;
|
|
274
|
+
let index = getIndex();
|
|
275
|
+
if (index == null) {
|
|
276
|
+
index = 0;
|
|
277
|
+
globalHistory.replaceState({
|
|
278
|
+
...globalHistory.state,
|
|
279
|
+
idx: index
|
|
280
|
+
}, "");
|
|
281
|
+
}
|
|
282
|
+
function getIndex() {
|
|
283
|
+
return (globalHistory.state || { idx: null }).idx;
|
|
284
|
+
}
|
|
285
|
+
function handlePop() {
|
|
286
|
+
action = "POP";
|
|
287
|
+
let nextIndex = getIndex();
|
|
288
|
+
let delta = nextIndex == null ? null : nextIndex - index;
|
|
289
|
+
index = nextIndex;
|
|
290
|
+
if (listener) listener({
|
|
291
|
+
action,
|
|
292
|
+
location: history.location,
|
|
293
|
+
delta
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function push(to, state) {
|
|
297
|
+
action = "PUSH";
|
|
298
|
+
let location = isLocation(to) ? to : createLocation(history.location, to, state);
|
|
299
|
+
if (validateLocation) validateLocation(location, to);
|
|
300
|
+
index = getIndex() + 1;
|
|
301
|
+
let historyState = getHistoryState(location, index);
|
|
302
|
+
let url = history.createHref(location.mask || location);
|
|
303
|
+
try {
|
|
304
|
+
globalHistory.pushState(historyState, "", url);
|
|
305
|
+
} catch (error) {
|
|
306
|
+
if (error instanceof DOMException && error.name === "DataCloneError") throw error;
|
|
307
|
+
window.location.assign(url);
|
|
308
|
+
}
|
|
309
|
+
if (v5Compat && listener) listener({
|
|
310
|
+
action,
|
|
311
|
+
location: history.location,
|
|
312
|
+
delta: 1
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function replace(to, state) {
|
|
316
|
+
action = "REPLACE";
|
|
317
|
+
let location = isLocation(to) ? to : createLocation(history.location, to, state);
|
|
318
|
+
if (validateLocation) validateLocation(location, to);
|
|
319
|
+
index = getIndex();
|
|
320
|
+
let historyState = getHistoryState(location, index);
|
|
321
|
+
let url = history.createHref(location.mask || location);
|
|
322
|
+
globalHistory.replaceState(historyState, "", url);
|
|
323
|
+
if (v5Compat && listener) listener({
|
|
324
|
+
action,
|
|
325
|
+
location: history.location,
|
|
326
|
+
delta: 0
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function createURL(to) {
|
|
330
|
+
return createBrowserURLImpl(window, to);
|
|
331
|
+
}
|
|
332
|
+
let history = {
|
|
333
|
+
get action() {
|
|
334
|
+
return action;
|
|
335
|
+
},
|
|
336
|
+
get location() {
|
|
337
|
+
return getLocation(window, globalHistory);
|
|
338
|
+
},
|
|
339
|
+
listen(fn) {
|
|
340
|
+
if (listener) throw new Error("A history only accepts one active listener");
|
|
341
|
+
window.addEventListener(PopStateEventType, handlePop);
|
|
342
|
+
listener = fn;
|
|
343
|
+
return () => {
|
|
344
|
+
window.removeEventListener(PopStateEventType, handlePop);
|
|
345
|
+
listener = null;
|
|
346
|
+
};
|
|
347
|
+
},
|
|
348
|
+
createHref(to) {
|
|
349
|
+
return createHref(window, to);
|
|
350
|
+
},
|
|
351
|
+
createURL,
|
|
352
|
+
encodeLocation(to) {
|
|
353
|
+
let url = createURL(to);
|
|
354
|
+
return {
|
|
355
|
+
pathname: url.pathname,
|
|
356
|
+
search: url.search,
|
|
357
|
+
hash: url.hash
|
|
358
|
+
};
|
|
359
|
+
},
|
|
360
|
+
push,
|
|
361
|
+
replace,
|
|
362
|
+
go(n) {
|
|
363
|
+
return globalHistory.go(n);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
return history;
|
|
367
|
+
}
|
|
368
|
+
function createBrowserURLImpl(windowImpl, to, isAbsolute = false) {
|
|
369
|
+
let base = "http://localhost";
|
|
370
|
+
if (windowImpl) base = windowImpl.location.origin !== "null" ? windowImpl.location.origin : windowImpl.location.href;
|
|
371
|
+
invariant(base, "No window.location.(origin|href) available to create URL");
|
|
372
|
+
let href = typeof to === "string" ? to : createPath(to);
|
|
373
|
+
href = href.replace(/ $/, "%20");
|
|
374
|
+
if (!isAbsolute && PROTOCOL_RELATIVE_URL_REGEX.test(href)) href = base + href;
|
|
375
|
+
return new URL(href, base);
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
export { Action, createBrowserHistory, createBrowserURLImpl, createHashHistory, createLocation, createMemoryHistory, createPath, invariant, parsePath, warning };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
import { FormEncType, HTMLFormMethod, LoaderFunctionArgs, RouterContextProvider } from "./utils.js";
|
|
3
|
+
//#region lib/router/instrumentation.d.ts
|
|
4
|
+
type ServerInstrumentation = {
|
|
5
|
+
handler?: InstrumentRequestHandlerFunction;
|
|
6
|
+
route?: InstrumentRouteFunction;
|
|
7
|
+
};
|
|
8
|
+
type ClientInstrumentation = {
|
|
9
|
+
router?: InstrumentRouterFunction;
|
|
10
|
+
route?: InstrumentRouteFunction;
|
|
11
|
+
};
|
|
12
|
+
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
|
13
|
+
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
|
14
|
+
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Route metadata available after React Router has matched an instrumented
|
|
17
|
+
* request, navigation, or fetcher call.
|
|
18
|
+
*/
|
|
19
|
+
type InstrumentationResultMeta = {
|
|
20
|
+
url: LoaderFunctionArgs["url"];
|
|
21
|
+
pattern: string;
|
|
22
|
+
params: LoaderFunctionArgs["params"];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Result returned by route-level instrumented handler calls, such as
|
|
26
|
+
* instrumented loaders, actions, middleware, and lazy route functions.
|
|
27
|
+
*/
|
|
28
|
+
type InstrumentationHandlerResult = {
|
|
29
|
+
status: "success";
|
|
30
|
+
error: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
status: "error";
|
|
33
|
+
error: Error;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Result returned by client-side router instrumented navigation and fetcher
|
|
37
|
+
* calls.
|
|
38
|
+
*/
|
|
39
|
+
type InstrumentationClientRouterResult = InstrumentationHandlerResult & {
|
|
40
|
+
meta: InstrumentationResultMeta | undefined;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Result returned by server request handler instrumentation.
|
|
44
|
+
*/
|
|
45
|
+
type InstrumentationServerHandlerResult = InstrumentationHandlerResult & {
|
|
46
|
+
statusCode: number;
|
|
47
|
+
meta: InstrumentationResultMeta | undefined;
|
|
48
|
+
};
|
|
49
|
+
type InstrumentFunction<T, TInnerResult = InstrumentationHandlerResult> = (handler: () => Promise<TInnerResult>, info: T) => Promise<void>;
|
|
50
|
+
type ReadonlyRequest = {
|
|
51
|
+
method: string;
|
|
52
|
+
url: string;
|
|
53
|
+
headers: Pick<Headers, "get">;
|
|
54
|
+
};
|
|
55
|
+
type ReadonlyContext = Pick<RouterContextProvider, "get">;
|
|
56
|
+
type InstrumentableRoute = {
|
|
57
|
+
id: string;
|
|
58
|
+
index: boolean | undefined;
|
|
59
|
+
path: string | undefined;
|
|
60
|
+
instrument(instrumentations: RouteInstrumentations): void;
|
|
61
|
+
};
|
|
62
|
+
type RouteInstrumentations = {
|
|
63
|
+
lazy?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
64
|
+
"lazy.loader"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
65
|
+
"lazy.action"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
66
|
+
"lazy.middleware"?: InstrumentFunction<RouteLazyInstrumentationInfo>;
|
|
67
|
+
middleware?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
68
|
+
loader?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
69
|
+
action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
70
|
+
};
|
|
71
|
+
type RouteLazyInstrumentationInfo = undefined;
|
|
72
|
+
type RouteHandlerInstrumentationInfo = Readonly<Omit<LoaderFunctionArgs, "request" | "context"> & {
|
|
73
|
+
request: ReadonlyRequest;
|
|
74
|
+
context: ReadonlyContext;
|
|
75
|
+
}>;
|
|
76
|
+
type InstrumentableRouter = {
|
|
77
|
+
instrument(instrumentations: RouterInstrumentations): void;
|
|
78
|
+
};
|
|
79
|
+
type RouterInstrumentations = {
|
|
80
|
+
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo, InstrumentationClientRouterResult>;
|
|
81
|
+
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo, InstrumentationClientRouterResult>;
|
|
82
|
+
};
|
|
83
|
+
type RouterNavigationInstrumentationInfo = Readonly<{
|
|
84
|
+
to: string | number;
|
|
85
|
+
currentUrl: string;
|
|
86
|
+
formMethod?: HTMLFormMethod;
|
|
87
|
+
formEncType?: FormEncType;
|
|
88
|
+
formData?: FormData;
|
|
89
|
+
body?: any;
|
|
90
|
+
}>;
|
|
91
|
+
type RouterFetchInstrumentationInfo = Readonly<{
|
|
92
|
+
href: string;
|
|
93
|
+
currentUrl: string;
|
|
94
|
+
fetcherKey: string;
|
|
95
|
+
formMethod?: HTMLFormMethod;
|
|
96
|
+
formEncType?: FormEncType;
|
|
97
|
+
formData?: FormData;
|
|
98
|
+
body?: any;
|
|
99
|
+
}>;
|
|
100
|
+
type InstrumentableRequestHandler = {
|
|
101
|
+
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
|
102
|
+
};
|
|
103
|
+
type RequestHandlerInstrumentations = {
|
|
104
|
+
request?: InstrumentFunction<RequestHandlerInstrumentationInfo, InstrumentationServerHandlerResult>;
|
|
105
|
+
};
|
|
106
|
+
type RequestHandlerInstrumentationInfo = Readonly<{
|
|
107
|
+
request: ReadonlyRequest;
|
|
108
|
+
context: ReadonlyContext | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
//#endregion
|
|
111
|
+
export { ClientInstrumentation, InstrumentRequestHandlerFunction, InstrumentRouteFunction, InstrumentRouterFunction, InstrumentationClientRouterResult, InstrumentationHandlerResult, InstrumentationServerHandlerResult, ServerInstrumentation };
|