react-router 0.0.0-experimental-a65d6f5 → 0.0.0-experimental-c19b79d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/{chunk-ZLVXSGFL.js → chunk-2G2U5HGB.js} +161 -164
- package/dist/development/{chunk-CWSJ6RYI.mjs → chunk-AGOH44BE.mjs} +51 -67
- package/dist/development/{chunk-47MIYFLC.mjs → chunk-IMKEG5CI.mjs} +29 -309
- package/dist/development/{chunk-QOFB7XZ5.js → chunk-LUB73E44.js} +70 -347
- package/dist/development/{router-DQIRhYoj.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/development/dom-export.d.mts +4 -59
- package/dist/development/dom-export.d.ts +3 -59
- package/dist/development/dom-export.js +5 -8
- package/dist/development/dom-export.mjs +5 -8
- package/dist/{production/index-react-server-client-lf74v6ET.d.mts → development/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/development/{index-react-server-client-lf74v6ET.d.mts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +1 -106
- package/dist/development/index-react-server.d.ts +1 -106
- package/dist/development/index-react-server.js +8 -181
- package/dist/development/index-react-server.mjs +8 -181
- package/dist/development/index.d.mts +20 -13
- package/dist/development/index.d.ts +18 -13
- package/dist/development/index.js +147 -161
- package/dist/development/index.mjs +5 -3
- package/dist/development/lib/types/internal.d.mts +3 -3
- package/dist/development/lib/types/internal.d.ts +2 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-DiOIlEq5.d.mts → register-BrVEYTED.d.mts} +7 -1
- package/dist/{production/register-DiOIlEq5.d.mts → development/register-D8NQoPsO.d.ts} +7 -1
- package/dist/development/{routeModules--SgCTStn.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{production/routeModules-rxNxBmdR.d.ts → development/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/dist/production/{chunk-ZOHTOBOT.js → chunk-2L5AG5Y5.js} +70 -347
- package/dist/production/{chunk-UAAA7FTX.mjs → chunk-AODJW4D3.mjs} +51 -67
- package/dist/production/{chunk-4SPSFXAZ.js → chunk-FGRCWJDI.js} +161 -164
- package/dist/production/{chunk-MMAHTIVZ.mjs → chunk-UOQCOPF6.mjs} +29 -309
- package/dist/production/{router-DQIRhYoj.d.mts → context-BqL5Eckq.d.mts} +1288 -1441
- package/dist/production/dom-export.d.mts +4 -59
- package/dist/production/dom-export.d.ts +3 -59
- package/dist/production/dom-export.js +5 -8
- package/dist/production/dom-export.mjs +5 -8
- package/dist/{development/index-react-server-client-Iw2PMej2.d.ts → production/index-react-server-client-2EDmGlsZ.d.mts} +77 -140
- package/dist/production/{index-react-server-client-Iw2PMej2.d.ts → index-react-server-client-DKvU8YRr.d.ts} +134 -198
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +1 -106
- package/dist/production/index-react-server.d.ts +1 -106
- package/dist/production/index-react-server.js +8 -181
- package/dist/production/index-react-server.mjs +8 -181
- package/dist/production/index.d.mts +20 -13
- package/dist/production/index.d.ts +18 -13
- package/dist/production/index.js +147 -161
- package/dist/production/index.mjs +5 -3
- package/dist/production/lib/types/internal.d.mts +3 -3
- package/dist/production/lib/types/internal.d.ts +2 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-DiOIlEq5.d.ts → production/register-BrVEYTED.d.mts} +7 -1
- package/dist/production/{register-DiOIlEq5.d.ts → register-D8NQoPsO.d.ts} +7 -1
- package/dist/production/{routeModules--SgCTStn.d.mts → route-data-CDwqkzPE.d.mts} +147 -157
- package/dist/{development/routeModules-rxNxBmdR.d.ts → production/routeModules-BmVo7q9e.d.ts} +1046 -73
- package/package.json +1 -1
- package/dist/development/instrumentation-BWRz1MRU.d.ts +0 -1138
- package/dist/production/instrumentation-BWRz1MRU.d.ts +0 -1138
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1, a as RouterInit, u as
|
|
2
|
+
import { R as RouterProviderProps$1, a as RouterInit, u as unstable_ClientOnErrorFunction } from './context-BqL5Eckq.mjs';
|
|
3
3
|
import './browser-z32v5KVN.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
@@ -12,67 +12,12 @@ declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">):
|
|
|
12
12
|
*/
|
|
13
13
|
interface HydratedRouterProps {
|
|
14
14
|
/**
|
|
15
|
-
* Context
|
|
16
|
-
*
|
|
17
|
-
* navigation/fetch and made available to
|
|
15
|
+
* Context object to be passed through to {@link createBrowserRouter} and made
|
|
16
|
+
* available to
|
|
18
17
|
* [`clientAction`](../../start/framework/route-module#clientAction)/[`clientLoader`](../../start/framework/route-module#clientLoader)
|
|
19
|
-
* functions
|
|
18
|
+
* functions
|
|
20
19
|
*/
|
|
21
20
|
getContext?: RouterInit["getContext"];
|
|
22
|
-
/**
|
|
23
|
-
* Array of instrumentation objects allowing you to instrument the router and
|
|
24
|
-
* individual routes prior to router initialization (and on any subsequently
|
|
25
|
-
* added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
|
|
26
|
-
* mostly useful for observability such as wrapping navigations, fetches,
|
|
27
|
-
* as well as route loaders/actions/middlewares with logging and/or performance
|
|
28
|
-
* tracing.
|
|
29
|
-
*
|
|
30
|
-
* ```tsx
|
|
31
|
-
* startTransition(() => {
|
|
32
|
-
* hydrateRoot(
|
|
33
|
-
* document,
|
|
34
|
-
* <HydratedRouter unstable_instrumentations={[logging]} />
|
|
35
|
-
* );
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* const logging = {
|
|
39
|
-
* router({ instrument }) {
|
|
40
|
-
* instrument({
|
|
41
|
-
* navigate: (impl, { to }) => logExecution(`navigate ${to}`, impl),
|
|
42
|
-
* fetch: (impl, { to }) => logExecution(`fetch ${to}`, impl)
|
|
43
|
-
* });
|
|
44
|
-
* },
|
|
45
|
-
* route({ instrument, id }) {
|
|
46
|
-
* instrument({
|
|
47
|
-
* middleware: (impl, { request }) => logExecution(
|
|
48
|
-
* `middleware ${request.url} (route ${id})`,
|
|
49
|
-
* impl
|
|
50
|
-
* ),
|
|
51
|
-
* loader: (impl, { request }) => logExecution(
|
|
52
|
-
* `loader ${request.url} (route ${id})`,
|
|
53
|
-
* impl
|
|
54
|
-
* ),
|
|
55
|
-
* action: (impl, { request }) => logExecution(
|
|
56
|
-
* `action ${request.url} (route ${id})`,
|
|
57
|
-
* impl
|
|
58
|
-
* ),
|
|
59
|
-
* })
|
|
60
|
-
* }
|
|
61
|
-
* };
|
|
62
|
-
*
|
|
63
|
-
* async function logExecution(label: string, impl: () => Promise<void>) {
|
|
64
|
-
* let start = performance.now();
|
|
65
|
-
* console.log(`start ${label}`);
|
|
66
|
-
* try {
|
|
67
|
-
* await impl();
|
|
68
|
-
* } finally {
|
|
69
|
-
* let end = performance.now();
|
|
70
|
-
* console.log(`end ${label} (${Math.round(end - start)}ms)`);
|
|
71
|
-
* }
|
|
72
|
-
* }
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
76
21
|
/**
|
|
77
22
|
* An error handler function that will be called for any loader/action/render
|
|
78
23
|
* errors that are encountered in your application. This is useful for
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RouterProviderProps as RouterProviderProps$1, RouterInit, unstable_ClientOnErrorFunction } from 'react-router';
|
|
3
|
-
import { u as unstable_ClientInstrumentation } from './instrumentation-BWRz1MRU.js';
|
|
4
3
|
|
|
5
4
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
5
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -12,67 +11,12 @@ declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">):
|
|
|
12
11
|
*/
|
|
13
12
|
interface HydratedRouterProps {
|
|
14
13
|
/**
|
|
15
|
-
* Context
|
|
16
|
-
*
|
|
17
|
-
* navigation/fetch and made available to
|
|
14
|
+
* Context object to be passed through to {@link createBrowserRouter} and made
|
|
15
|
+
* available to
|
|
18
16
|
* [`clientAction`](../../start/framework/route-module#clientAction)/[`clientLoader`](../../start/framework/route-module#clientLoader)
|
|
19
|
-
* functions
|
|
17
|
+
* functions
|
|
20
18
|
*/
|
|
21
19
|
getContext?: RouterInit["getContext"];
|
|
22
|
-
/**
|
|
23
|
-
* Array of instrumentation objects allowing you to instrument the router and
|
|
24
|
-
* individual routes prior to router initialization (and on any subsequently
|
|
25
|
-
* added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
|
|
26
|
-
* mostly useful for observability such as wrapping navigations, fetches,
|
|
27
|
-
* as well as route loaders/actions/middlewares with logging and/or performance
|
|
28
|
-
* tracing.
|
|
29
|
-
*
|
|
30
|
-
* ```tsx
|
|
31
|
-
* startTransition(() => {
|
|
32
|
-
* hydrateRoot(
|
|
33
|
-
* document,
|
|
34
|
-
* <HydratedRouter unstable_instrumentations={[logging]} />
|
|
35
|
-
* );
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* const logging = {
|
|
39
|
-
* router({ instrument }) {
|
|
40
|
-
* instrument({
|
|
41
|
-
* navigate: (impl, { to }) => logExecution(`navigate ${to}`, impl),
|
|
42
|
-
* fetch: (impl, { to }) => logExecution(`fetch ${to}`, impl)
|
|
43
|
-
* });
|
|
44
|
-
* },
|
|
45
|
-
* route({ instrument, id }) {
|
|
46
|
-
* instrument({
|
|
47
|
-
* middleware: (impl, { request }) => logExecution(
|
|
48
|
-
* `middleware ${request.url} (route ${id})`,
|
|
49
|
-
* impl
|
|
50
|
-
* ),
|
|
51
|
-
* loader: (impl, { request }) => logExecution(
|
|
52
|
-
* `loader ${request.url} (route ${id})`,
|
|
53
|
-
* impl
|
|
54
|
-
* ),
|
|
55
|
-
* action: (impl, { request }) => logExecution(
|
|
56
|
-
* `action ${request.url} (route ${id})`,
|
|
57
|
-
* impl
|
|
58
|
-
* ),
|
|
59
|
-
* })
|
|
60
|
-
* }
|
|
61
|
-
* };
|
|
62
|
-
*
|
|
63
|
-
* async function logExecution(label: string, impl: () => Promise<void>) {
|
|
64
|
-
* let start = performance.now();
|
|
65
|
-
* console.log(`start ${label}`);
|
|
66
|
-
* try {
|
|
67
|
-
* await impl();
|
|
68
|
-
* } finally {
|
|
69
|
-
* let end = performance.now();
|
|
70
|
-
* console.log(`end ${label} (${Math.round(end - start)}ms)`);
|
|
71
|
-
* }
|
|
72
|
-
* }
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
76
20
|
/**
|
|
77
21
|
* An error handler function that will be called for any loader/action/render
|
|
78
22
|
* errors that are encountered in your application. This is useful for
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-c19b79d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"use client";
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkLUB73E44js = require('./chunk-LUB73E44.js');
|
|
15
15
|
|
|
16
16
|
// lib/dom-export/dom-router-provider.tsx
|
|
17
17
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
|
|
@@ -67,8 +67,7 @@ function initSsrInfo() {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function createHydratedRouter({
|
|
70
|
-
getContext
|
|
71
|
-
unstable_instrumentations
|
|
70
|
+
getContext
|
|
72
71
|
}) {
|
|
73
72
|
initSsrInfo();
|
|
74
73
|
if (!ssrInfo) {
|
|
@@ -135,7 +134,6 @@ function createHydratedRouter({
|
|
|
135
134
|
getContext,
|
|
136
135
|
hydrationData,
|
|
137
136
|
hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
|
|
138
|
-
unstable_instrumentations,
|
|
139
137
|
mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
|
|
140
138
|
future: {
|
|
141
139
|
middleware: ssrInfo.context.future.v8_middleware
|
|
@@ -169,8 +167,7 @@ function createHydratedRouter({
|
|
|
169
167
|
function HydratedRouter(props) {
|
|
170
168
|
if (!router) {
|
|
171
169
|
router = createHydratedRouter({
|
|
172
|
-
getContext: props.getContext
|
|
173
|
-
unstable_instrumentations: props.unstable_instrumentations
|
|
170
|
+
getContext: props.getContext
|
|
174
171
|
});
|
|
175
172
|
}
|
|
176
173
|
let [criticalCss, setCriticalCss] = React2.useState(
|
|
@@ -183,7 +180,7 @@ function HydratedRouter(props) {
|
|
|
183
180
|
}, []);
|
|
184
181
|
React2.useEffect(() => {
|
|
185
182
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
186
|
-
document.querySelectorAll(`[${
|
|
183
|
+
document.querySelectorAll(`[${_chunkLUB73E44js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
187
184
|
}
|
|
188
185
|
}, [criticalCss]);
|
|
189
186
|
let [location, setLocation] = React2.useState(router.state.location);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-c19b79d
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import {
|
|
13
13
|
deserializeErrors,
|
|
14
14
|
getHydrationData
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AGOH44BE.mjs";
|
|
16
16
|
import {
|
|
17
17
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
18
18
|
FrameworkContext,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
invariant,
|
|
30
30
|
mapRouteProperties,
|
|
31
31
|
useFogOFWarDiscovery
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-IMKEG5CI.mjs";
|
|
33
33
|
|
|
34
34
|
// lib/dom-export/dom-router-provider.tsx
|
|
35
35
|
import * as React from "react";
|
|
@@ -67,8 +67,7 @@ function initSsrInfo() {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function createHydratedRouter({
|
|
70
|
-
getContext
|
|
71
|
-
unstable_instrumentations
|
|
70
|
+
getContext
|
|
72
71
|
}) {
|
|
73
72
|
initSsrInfo();
|
|
74
73
|
if (!ssrInfo) {
|
|
@@ -135,7 +134,6 @@ function createHydratedRouter({
|
|
|
135
134
|
getContext,
|
|
136
135
|
hydrationData,
|
|
137
136
|
hydrationRouteProperties,
|
|
138
|
-
unstable_instrumentations,
|
|
139
137
|
mapRouteProperties,
|
|
140
138
|
future: {
|
|
141
139
|
middleware: ssrInfo.context.future.v8_middleware
|
|
@@ -169,8 +167,7 @@ function createHydratedRouter({
|
|
|
169
167
|
function HydratedRouter(props) {
|
|
170
168
|
if (!router) {
|
|
171
169
|
router = createHydratedRouter({
|
|
172
|
-
getContext: props.getContext
|
|
173
|
-
unstable_instrumentations: props.unstable_instrumentations
|
|
170
|
+
getContext: props.getContext
|
|
174
171
|
});
|
|
175
172
|
}
|
|
176
173
|
let [criticalCss, setCriticalCss] = React2.useState(
|
|
@@ -1,33 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b7 as RouteManifest, i as MiddlewareEnabled, g as RouterContextProvider, b as LoaderFunctionArgs, A as ActionFunctionArgs, O as StaticHandlerContext, H as HydrationState, F as DataRouteObject, a3 as HTMLFormMethod, a1 as FormEncType, m as RelativeRoutingType, T as To, b8 as History, K as GetScrollRestorationKeyFunction, a as RouterInit, b9 as FutureConfig$1, k as DataStrategyFunction, C as PatchRoutesOnNavigationFunction, N as NavigateOptions, Q as Fetcher, t as RouteObject, j as Router, B as BlockerFunction, L as Location, ba as CreateStaticHandlerOptions$1, G as StaticHandler } from './context-BqL5Eckq.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-CDwqkzPE.mjs';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
parentId?: string;
|
|
10
|
-
path?: string;
|
|
5
|
+
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
6
|
+
interface ServerRoute extends Route {
|
|
7
|
+
children: ServerRoute[];
|
|
8
|
+
module: ServerRouteModule;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
|
|
11
|
+
type OptionalCriticalCss = CriticalCss | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The output of the compiler for the server build.
|
|
14
|
+
*/
|
|
15
|
+
interface ServerBuild {
|
|
16
|
+
entry: {
|
|
17
|
+
module: ServerEntryModule;
|
|
18
|
+
};
|
|
19
|
+
routes: ServerRouteManifest;
|
|
20
|
+
assets: AssetsManifest;
|
|
21
|
+
basename?: string;
|
|
22
|
+
publicPath: string;
|
|
23
|
+
assetsBuildDirectory: string;
|
|
24
|
+
future: FutureConfig;
|
|
25
|
+
ssr: boolean;
|
|
26
|
+
unstable_getCriticalCss?: (args: {
|
|
27
|
+
pathname: string;
|
|
28
|
+
}) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated This is now done via a custom header during prerendering
|
|
31
|
+
*/
|
|
32
|
+
isSpaMode: boolean;
|
|
33
|
+
prerender: string[];
|
|
34
|
+
routeDiscovery: {
|
|
35
|
+
mode: "lazy" | "initial";
|
|
36
|
+
manifestPath: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface HandleDocumentRequestFunction {
|
|
40
|
+
(request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
|
|
41
|
+
}
|
|
42
|
+
interface HandleDataRequestFunction {
|
|
43
|
+
(response: Response, args: LoaderFunctionArgs | ActionFunctionArgs): Promise<Response> | Response;
|
|
44
|
+
}
|
|
45
|
+
interface HandleErrorFunction {
|
|
46
|
+
(error: unknown, args: LoaderFunctionArgs | ActionFunctionArgs): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A module that serves as the entry point for a Remix app during server
|
|
50
|
+
* rendering.
|
|
51
|
+
*/
|
|
52
|
+
interface ServerEntryModule {
|
|
53
|
+
default: HandleDocumentRequestFunction;
|
|
54
|
+
handleDataRequest?: HandleDataRequestFunction;
|
|
55
|
+
handleError?: HandleErrorFunction;
|
|
56
|
+
streamTimeout?: number;
|
|
27
57
|
}
|
|
28
|
-
declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
|
|
29
|
-
declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
|
|
30
|
-
declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
|
|
31
58
|
|
|
32
59
|
type SerializedError = {
|
|
33
60
|
message: string;
|
|
@@ -81,68 +108,32 @@ interface AssetsManifest {
|
|
|
81
108
|
sri?: Record<string, string> | true;
|
|
82
109
|
}
|
|
83
110
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
type OptionalCriticalCss = CriticalCss | undefined;
|
|
91
|
-
/**
|
|
92
|
-
* The output of the compiler for the server build.
|
|
93
|
-
*/
|
|
94
|
-
interface ServerBuild {
|
|
95
|
-
entry: {
|
|
96
|
-
module: ServerEntryModule;
|
|
97
|
-
};
|
|
98
|
-
routes: ServerRouteManifest;
|
|
99
|
-
assets: AssetsManifest;
|
|
100
|
-
basename?: string;
|
|
101
|
-
publicPath: string;
|
|
102
|
-
assetsBuildDirectory: string;
|
|
103
|
-
future: FutureConfig;
|
|
104
|
-
ssr: boolean;
|
|
105
|
-
unstable_getCriticalCss?: (args: {
|
|
106
|
-
pathname: string;
|
|
107
|
-
}) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
|
|
108
|
-
/**
|
|
109
|
-
* @deprecated This is now done via a custom header during prerendering
|
|
110
|
-
*/
|
|
111
|
-
isSpaMode: boolean;
|
|
112
|
-
prerender: string[];
|
|
113
|
-
routeDiscovery: {
|
|
114
|
-
mode: "lazy" | "initial";
|
|
115
|
-
manifestPath: string;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
interface HandleDocumentRequestFunction {
|
|
119
|
-
(request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? RouterContextProvider : AppLoadContext): Promise<Response> | Response;
|
|
120
|
-
}
|
|
121
|
-
interface HandleDataRequestFunction {
|
|
122
|
-
(response: Response, args: {
|
|
123
|
-
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
124
|
-
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
125
|
-
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
126
|
-
}): Promise<Response> | Response;
|
|
127
|
-
}
|
|
128
|
-
interface HandleErrorFunction {
|
|
129
|
-
(error: unknown, args: {
|
|
130
|
-
request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
|
131
|
-
context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
|
132
|
-
params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
|
133
|
-
}): void;
|
|
111
|
+
interface Route {
|
|
112
|
+
index?: boolean;
|
|
113
|
+
caseSensitive?: boolean;
|
|
114
|
+
id: string;
|
|
115
|
+
parentId?: string;
|
|
116
|
+
path?: string;
|
|
134
117
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
118
|
+
interface EntryRoute extends Route {
|
|
119
|
+
hasAction: boolean;
|
|
120
|
+
hasLoader: boolean;
|
|
121
|
+
hasClientAction: boolean;
|
|
122
|
+
hasClientLoader: boolean;
|
|
123
|
+
hasClientMiddleware: boolean;
|
|
124
|
+
hasErrorBoundary: boolean;
|
|
125
|
+
imports?: string[];
|
|
126
|
+
css?: string[];
|
|
127
|
+
module: string;
|
|
128
|
+
clientActionModule: string | undefined;
|
|
129
|
+
clientLoaderModule: string | undefined;
|
|
130
|
+
clientMiddlewareModule: string | undefined;
|
|
131
|
+
hydrateFallbackModule: string | undefined;
|
|
132
|
+
parentId?: string;
|
|
145
133
|
}
|
|
134
|
+
declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
|
|
135
|
+
declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
|
|
136
|
+
declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
|
|
146
137
|
|
|
147
138
|
type ParamKeyValuePair = [string, string];
|
|
148
139
|
type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
|
|
@@ -531,58 +522,6 @@ interface DOMRouterOpts {
|
|
|
531
522
|
* ```
|
|
532
523
|
*/
|
|
533
524
|
hydrationData?: HydrationState;
|
|
534
|
-
/**
|
|
535
|
-
* Array of instrumentation objects allowing you to instrument the router and
|
|
536
|
-
* individual routes prior to router initialization (and on any subsequently
|
|
537
|
-
* added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
|
|
538
|
-
* mostly useful for observability such as wrapping navigations, fetches,
|
|
539
|
-
* as well as route loaders/actions/middlewares with logging and/or performance
|
|
540
|
-
* tracing.
|
|
541
|
-
*
|
|
542
|
-
* ```tsx
|
|
543
|
-
* let router = createBrowserRouter(routes, {
|
|
544
|
-
* unstable_instrumentations: [logging]
|
|
545
|
-
* });
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
* let logging = {
|
|
549
|
-
* router({ instrument }) {
|
|
550
|
-
* instrument({
|
|
551
|
-
* navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl),
|
|
552
|
-
* fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl)
|
|
553
|
-
* });
|
|
554
|
-
* },
|
|
555
|
-
* route({ instrument, id }) {
|
|
556
|
-
* instrument({
|
|
557
|
-
* middleware: (impl, info) => logExecution(
|
|
558
|
-
* `middleware ${info.request.url} (route ${id})`,
|
|
559
|
-
* impl
|
|
560
|
-
* ),
|
|
561
|
-
* loader: (impl, info) => logExecution(
|
|
562
|
-
* `loader ${info.request.url} (route ${id})`,
|
|
563
|
-
* impl
|
|
564
|
-
* ),
|
|
565
|
-
* action: (impl, info) => logExecution(
|
|
566
|
-
* `action ${info.request.url} (route ${id})`,
|
|
567
|
-
* impl
|
|
568
|
-
* ),
|
|
569
|
-
* })
|
|
570
|
-
* }
|
|
571
|
-
* };
|
|
572
|
-
*
|
|
573
|
-
* async function logExecution(label: string, impl: () => Promise<void>) {
|
|
574
|
-
* let start = performance.now();
|
|
575
|
-
* console.log(`start ${label}`);
|
|
576
|
-
* try {
|
|
577
|
-
* await impl();
|
|
578
|
-
* } finally {
|
|
579
|
-
* let end = performance.now();
|
|
580
|
-
* console.log(`end ${label} (${Math.round(end - start)}ms)`);
|
|
581
|
-
* }
|
|
582
|
-
* }
|
|
583
|
-
* ```
|
|
584
|
-
*/
|
|
585
|
-
unstable_instrumentations?: unstable_ClientInstrumentation[];
|
|
586
525
|
/**
|
|
587
526
|
* Override the default data strategy of running loaders in parallel.
|
|
588
527
|
* See {@link DataStrategyFunction}.
|
|
@@ -1088,7 +1027,6 @@ interface DOMRouterOpts {
|
|
|
1088
1027
|
* @param {DOMRouterOpts.future} opts.future n/a
|
|
1089
1028
|
* @param {DOMRouterOpts.getContext} opts.getContext n/a
|
|
1090
1029
|
* @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
|
|
1091
|
-
* @param {DOMRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
|
|
1092
1030
|
* @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
|
|
1093
1031
|
* @param {DOMRouterOpts.window} opts.window n/a
|
|
1094
1032
|
* @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}
|
|
@@ -1107,7 +1045,6 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
|
|
|
1107
1045
|
* @param {DOMRouterOpts.future} opts.future n/a
|
|
1108
1046
|
* @param {DOMRouterOpts.getContext} opts.getContext n/a
|
|
1109
1047
|
* @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a
|
|
1110
|
-
* @param {DOMRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
|
|
1111
1048
|
* @param {DOMRouterOpts.dataStrategy} opts.dataStrategy n/a
|
|
1112
1049
|
* @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
|
|
1113
1050
|
* @param {DOMRouterOpts.window} opts.window n/a
|