react-router 0.0.0-experimental-a6d1d1d4e → 0.0.0-experimental-1d760f6a6
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 +12 -0
- package/dist/development/{chunk-OEAMHMGQ.mjs → chunk-QBMD7MNB.mjs} +293 -1025
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +69 -103
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/{fog-of-war-DrUCUQQ-.d.ts → fog-of-war-BLArG-qZ.d.ts} +81 -168
- package/dist/{production/fog-of-war-C5L_Yd5M.d.mts → development/fog-of-war-D2zsXvum.d.mts} +81 -168
- package/dist/development/index.d.mts +8 -15
- package/dist/development/index.d.ts +8 -15
- package/dist/development/index.js +291 -1032
- package/dist/development/index.mjs +2 -19
- package/dist/development/lib/types/route-module.d.mts +1 -1
- package/dist/development/lib/types/route-module.d.ts +1 -1
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-BIYebJr3.d.ts → route-data-C12CLHiN.d.mts} +1 -11
- package/dist/{production/route-data-BIYebJr3.d.mts → development/route-data-C12CLHiN.d.ts} +1 -11
- package/dist/production/{chunk-I2N4LFMP.mjs → chunk-DSJGM2GU.mjs} +293 -1025
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +69 -103
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/{fog-of-war-DrUCUQQ-.d.ts → fog-of-war-BLArG-qZ.d.ts} +81 -168
- package/dist/{development/fog-of-war-C5L_Yd5M.d.mts → production/fog-of-war-D2zsXvum.d.mts} +81 -168
- package/dist/production/index.d.mts +8 -15
- package/dist/production/index.d.ts +8 -15
- package/dist/production/index.js +291 -1032
- package/dist/production/index.mjs +2 -19
- package/dist/production/lib/types/route-module.d.mts +1 -1
- package/dist/production/lib/types/route-module.d.ts +1 -1
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-BIYebJr3.d.ts → route-data-C12CLHiN.d.mts} +1 -11
- package/dist/{development/route-data-BIYebJr3.d.mts → production/route-data-C12CLHiN.d.ts} +1 -11
- package/package.json +2 -33
- package/dist/development/rsc-export.d.mts +0 -1553
- package/dist/development/rsc-export.d.ts +0 -1553
- package/dist/development/rsc-export.js +0 -2413
- package/dist/development/rsc-export.mjs +0 -2385
- package/dist/production/rsc-export.d.mts +0 -1553
- package/dist/production/rsc-export.d.ts +0 -1553
- package/dist/production/rsc-export.js +0 -2413
- package/dist/production/rsc-export.mjs +0 -2385
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import { R as RouterInit } from './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-D2zsXvum.mjs';
|
|
3
|
+
import { R as RouterInit } from './route-data-C12CLHiN.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import { R as RouterInit } from './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-BLArG-qZ.js';
|
|
3
|
+
import { R as RouterInit } from './route-data-C12CLHiN.js';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-1d760f6a6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -305,7 +305,7 @@ function isUnsupportedLazyRouteFunctionKey(key) {
|
|
|
305
305
|
function isIndexRoute(route) {
|
|
306
306
|
return route.index === true;
|
|
307
307
|
}
|
|
308
|
-
function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}
|
|
308
|
+
function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [], manifest = {}) {
|
|
309
309
|
return routes.map((route, index) => {
|
|
310
310
|
let treePath = [...parentPath, String(index)];
|
|
311
311
|
let id = typeof route.id === "string" ? route.id : treePath.join("-");
|
|
@@ -314,7 +314,7 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [],
|
|
|
314
314
|
`Cannot specify children on an index route`
|
|
315
315
|
);
|
|
316
316
|
invariant(
|
|
317
|
-
|
|
317
|
+
!manifest[id],
|
|
318
318
|
`Found a route id collision on id "${id}". Route id's must be globally unique within Data Router usages`
|
|
319
319
|
);
|
|
320
320
|
if (isIndexRoute(route)) {
|
|
@@ -338,8 +338,7 @@ function convertRoutesToDataRoutes(routes, mapRouteProperties2, parentPath = [],
|
|
|
338
338
|
route.children,
|
|
339
339
|
mapRouteProperties2,
|
|
340
340
|
treePath,
|
|
341
|
-
manifest
|
|
342
|
-
allowInPlaceMutations
|
|
341
|
+
manifest
|
|
343
342
|
);
|
|
344
343
|
}
|
|
345
344
|
return pathOrLayoutRoute;
|
|
@@ -990,19 +989,6 @@ function createRouter(init) {
|
|
|
990
989
|
return () => subscribers.delete(fn);
|
|
991
990
|
}
|
|
992
991
|
function updateState(newState, opts = {}) {
|
|
993
|
-
if (newState.matches) {
|
|
994
|
-
newState.matches = newState.matches.map((m) => {
|
|
995
|
-
let route = manifest[m.route.id];
|
|
996
|
-
let matchRoute = m.route;
|
|
997
|
-
if (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) {
|
|
998
|
-
return {
|
|
999
|
-
...m,
|
|
1000
|
-
route
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
return m;
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1006
992
|
state = {
|
|
1007
993
|
...state,
|
|
1008
994
|
...newState
|
|
@@ -2434,8 +2420,7 @@ function createRouter(init) {
|
|
|
2434
2420
|
children,
|
|
2435
2421
|
routesToUse,
|
|
2436
2422
|
localManifest,
|
|
2437
|
-
mapRouteProperties2
|
|
2438
|
-
false
|
|
2423
|
+
mapRouteProperties2
|
|
2439
2424
|
);
|
|
2440
2425
|
}
|
|
2441
2426
|
});
|
|
@@ -2476,7 +2461,7 @@ function createRouter(init) {
|
|
|
2476
2461
|
manifest
|
|
2477
2462
|
);
|
|
2478
2463
|
}
|
|
2479
|
-
function patchRoutes(routeId, children
|
|
2464
|
+
function patchRoutes(routeId, children) {
|
|
2480
2465
|
let isNonHMR = inFlightDataRoutes == null;
|
|
2481
2466
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
2482
2467
|
patchRoutesImpl(
|
|
@@ -2484,8 +2469,7 @@ function createRouter(init) {
|
|
|
2484
2469
|
children,
|
|
2485
2470
|
routesToUse,
|
|
2486
2471
|
manifest,
|
|
2487
|
-
mapRouteProperties2
|
|
2488
|
-
unstable_allowElementMutations
|
|
2472
|
+
mapRouteProperties2
|
|
2489
2473
|
);
|
|
2490
2474
|
if (isNonHMR) {
|
|
2491
2475
|
dataRoutes = [...dataRoutes];
|
|
@@ -2527,10 +2511,7 @@ function createRouter(init) {
|
|
|
2527
2511
|
_internalFetchControllers: fetchControllers,
|
|
2528
2512
|
// TODO: Remove setRoutes, it's temporary to avoid dealing with
|
|
2529
2513
|
// updating the tree while validating the update algorithm.
|
|
2530
|
-
_internalSetRoutes
|
|
2531
|
-
_internalSetStateDoNotUseOrYouWillBreakYourApp(newState) {
|
|
2532
|
-
updateState(newState);
|
|
2533
|
-
}
|
|
2514
|
+
_internalSetRoutes
|
|
2534
2515
|
};
|
|
2535
2516
|
return router2;
|
|
2536
2517
|
}
|
|
@@ -2890,7 +2871,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
|
|
|
2890
2871
|
}
|
|
2891
2872
|
return arg.defaultShouldRevalidate;
|
|
2892
2873
|
}
|
|
2893
|
-
function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2
|
|
2874
|
+
function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2) {
|
|
2894
2875
|
let childrenToPatch;
|
|
2895
2876
|
if (routeId) {
|
|
2896
2877
|
let route = manifest[routeId];
|
|
@@ -2905,47 +2886,18 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
|
|
|
2905
2886
|
} else {
|
|
2906
2887
|
childrenToPatch = routesToUse;
|
|
2907
2888
|
}
|
|
2908
|
-
let uniqueChildren =
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
if (uniqueChildren.length > 0) {
|
|
2921
|
-
let newRoutes = convertRoutesToDataRoutes(
|
|
2922
|
-
uniqueChildren,
|
|
2923
|
-
mapRouteProperties2,
|
|
2924
|
-
[routeId || "_", "patch", String(childrenToPatch?.length || "0")],
|
|
2925
|
-
manifest
|
|
2926
|
-
);
|
|
2927
|
-
childrenToPatch.push(...newRoutes);
|
|
2928
|
-
}
|
|
2929
|
-
if (allowElementMutations && existingChildren.length > 0) {
|
|
2930
|
-
for (let i = 0; i < existingChildren.length; i++) {
|
|
2931
|
-
let { existingRoute, newRoute } = existingChildren[i];
|
|
2932
|
-
let existingRouteTyped = existingRoute;
|
|
2933
|
-
let [newRouteTyped] = convertRoutesToDataRoutes(
|
|
2934
|
-
[newRoute],
|
|
2935
|
-
mapRouteProperties2,
|
|
2936
|
-
[],
|
|
2937
|
-
// Doesn't matter for mutated routes since they already have an id
|
|
2938
|
-
{},
|
|
2939
|
-
// Don't touch the manifest here since we're updating in place
|
|
2940
|
-
true
|
|
2941
|
-
);
|
|
2942
|
-
Object.assign(existingRouteTyped, {
|
|
2943
|
-
element: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element,
|
|
2944
|
-
errorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement,
|
|
2945
|
-
hydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement
|
|
2946
|
-
});
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2889
|
+
let uniqueChildren = children.filter(
|
|
2890
|
+
(newRoute) => !childrenToPatch.some(
|
|
2891
|
+
(existingRoute) => isSameRoute(newRoute, existingRoute)
|
|
2892
|
+
)
|
|
2893
|
+
);
|
|
2894
|
+
let newRoutes = convertRoutesToDataRoutes(
|
|
2895
|
+
uniqueChildren,
|
|
2896
|
+
mapRouteProperties2,
|
|
2897
|
+
[routeId || "_", "patch", String(childrenToPatch?.length || "0")],
|
|
2898
|
+
manifest
|
|
2899
|
+
);
|
|
2900
|
+
childrenToPatch.push(...newRoutes);
|
|
2949
2901
|
}
|
|
2950
2902
|
function isSameRoute(newRoute, existingRoute) {
|
|
2951
2903
|
if ("id" in newRoute && "id" in existingRoute && newRoute.id === existingRoute.id) {
|
|
@@ -3277,7 +3229,7 @@ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, laz
|
|
|
3277
3229
|
return shouldRevalidateLoader(match, unstable_shouldRevalidateArgs);
|
|
3278
3230
|
},
|
|
3279
3231
|
resolve(handlerOverride) {
|
|
3280
|
-
if (isUsingNewApi || shouldLoad || handlerOverride &&
|
|
3232
|
+
if (isUsingNewApi || shouldLoad || handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
|
|
3281
3233
|
return callLoaderOrAction({
|
|
3282
3234
|
request,
|
|
3283
3235
|
match,
|
|
@@ -4883,6 +4835,7 @@ async function createRequestInit(request) {
|
|
|
4883
4835
|
|
|
4884
4836
|
// lib/dom/ssr/single-fetch.tsx
|
|
4885
4837
|
var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
|
|
4838
|
+
var SINGLE_FETCH_REDIRECT_STATUS = 202;
|
|
4886
4839
|
var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
|
|
4887
4840
|
function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules, ssr, basename) {
|
|
4888
4841
|
let dataStrategy = getSingleFetchDataStrategyImpl(
|
|
@@ -5069,7 +5022,7 @@ function stripIndexParam(url) {
|
|
|
5069
5022
|
}
|
|
5070
5023
|
return url;
|
|
5071
5024
|
}
|
|
5072
|
-
function singleFetchUrl(reqUrl, basename
|
|
5025
|
+
function singleFetchUrl(reqUrl, basename) {
|
|
5073
5026
|
let url = typeof reqUrl === "string" ? new URL(
|
|
5074
5027
|
reqUrl,
|
|
5075
5028
|
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
@@ -5077,17 +5030,17 @@ function singleFetchUrl(reqUrl, basename, extension) {
|
|
|
5077
5030
|
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
5078
5031
|
) : reqUrl;
|
|
5079
5032
|
if (url.pathname === "/") {
|
|
5080
|
-
url.pathname =
|
|
5033
|
+
url.pathname = "_root.data";
|
|
5081
5034
|
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
5082
|
-
url.pathname = `${basename.replace(/\/$/, "")}/_root
|
|
5035
|
+
url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
|
|
5083
5036
|
} else {
|
|
5084
|
-
url.pathname = `${url.pathname.replace(/\/$/, "")}
|
|
5037
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
|
|
5085
5038
|
}
|
|
5086
5039
|
return url;
|
|
5087
5040
|
}
|
|
5088
5041
|
async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
5089
5042
|
let { request } = args;
|
|
5090
|
-
let url = singleFetchUrl(request.url, basename
|
|
5043
|
+
let url = singleFetchUrl(request.url, basename);
|
|
5091
5044
|
if (request.method === "GET") {
|
|
5092
5045
|
url = stripIndexParam(url);
|
|
5093
5046
|
if (targetRoutes) {
|
|
@@ -5098,6 +5051,20 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
|
|
|
5098
5051
|
if (res.status === 404 && !res.headers.has("X-Remix-Response")) {
|
|
5099
5052
|
throw new ErrorResponseImpl(404, "Not Found", true);
|
|
5100
5053
|
}
|
|
5054
|
+
if (res.status === 204 && res.headers.has("X-Remix-Redirect")) {
|
|
5055
|
+
return {
|
|
5056
|
+
status: SINGLE_FETCH_REDIRECT_STATUS,
|
|
5057
|
+
data: {
|
|
5058
|
+
redirect: {
|
|
5059
|
+
redirect: res.headers.get("X-Remix-Redirect"),
|
|
5060
|
+
status: Number(res.headers.get("X-Remix-Status") || "302"),
|
|
5061
|
+
revalidate: res.headers.get("X-Remix-Revalidate") === "true",
|
|
5062
|
+
reload: res.headers.get("X-Remix-Reload-Document") === "true",
|
|
5063
|
+
replace: res.headers.get("X-Remix-Replace") === "true"
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5066
|
+
};
|
|
5067
|
+
}
|
|
5101
5068
|
if (NO_BODY_STATUS_CODES.has(res.status)) {
|
|
5102
5069
|
let routes = {};
|
|
5103
5070
|
if (targetRoutes && request.method !== "GET") {
|
|
@@ -5187,13 +5154,12 @@ function unwrapSingleFetchResult(result, routeId) {
|
|
|
5187
5154
|
});
|
|
5188
5155
|
}
|
|
5189
5156
|
let routeResult = result.routes[routeId];
|
|
5190
|
-
invariant2(routeResult, `No response found for routeId "${routeId}"`);
|
|
5191
5157
|
if ("error" in routeResult) {
|
|
5192
5158
|
throw routeResult.error;
|
|
5193
5159
|
} else if ("data" in routeResult) {
|
|
5194
5160
|
return routeResult.data;
|
|
5195
5161
|
} else {
|
|
5196
|
-
throw new Error(`
|
|
5162
|
+
throw new Error(`No response found for routeId "${routeId}"`);
|
|
5197
5163
|
}
|
|
5198
5164
|
}
|
|
5199
5165
|
function createDeferred2() {
|
|
@@ -6084,32 +6050,6 @@ function dedupe(array) {
|
|
|
6084
6050
|
return [...new Set(array)];
|
|
6085
6051
|
}
|
|
6086
6052
|
|
|
6087
|
-
// lib/dom/ssr/hydration.tsx
|
|
6088
|
-
function getHydrationData(state, routes, getRouteInfo, location, basename, isSpaMode) {
|
|
6089
|
-
let hydrationData = {
|
|
6090
|
-
...state,
|
|
6091
|
-
loaderData: { ...state.loaderData }
|
|
6092
|
-
};
|
|
6093
|
-
let initialMatches = matchRoutes(routes, location, basename);
|
|
6094
|
-
if (initialMatches) {
|
|
6095
|
-
for (let match of initialMatches) {
|
|
6096
|
-
let routeId = match.route.id;
|
|
6097
|
-
let routeInfo = getRouteInfo(routeId);
|
|
6098
|
-
if (shouldHydrateRouteLoader(
|
|
6099
|
-
routeId,
|
|
6100
|
-
routeInfo.clientLoader,
|
|
6101
|
-
routeInfo.hasLoader,
|
|
6102
|
-
isSpaMode
|
|
6103
|
-
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
|
6104
|
-
delete hydrationData.loaderData[routeId];
|
|
6105
|
-
} else if (!routeInfo.hasLoader) {
|
|
6106
|
-
hydrationData.loaderData[routeId] = null;
|
|
6107
|
-
}
|
|
6108
|
-
}
|
|
6109
|
-
}
|
|
6110
|
-
return hydrationData;
|
|
6111
|
-
}
|
|
6112
|
-
|
|
6113
6053
|
// lib/dom/ssr/errors.ts
|
|
6114
6054
|
function deserializeErrors(errors) {
|
|
6115
6055
|
if (!errors) return null;
|
|
@@ -6147,6 +6087,32 @@ function deserializeErrors(errors) {
|
|
|
6147
6087
|
return serialized;
|
|
6148
6088
|
}
|
|
6149
6089
|
|
|
6090
|
+
// lib/dom/ssr/hydration.tsx
|
|
6091
|
+
function getHydrationData(state, routes, getRouteInfo, location, basename, isSpaMode) {
|
|
6092
|
+
let hydrationData = {
|
|
6093
|
+
...state,
|
|
6094
|
+
loaderData: { ...state.loaderData }
|
|
6095
|
+
};
|
|
6096
|
+
let initialMatches = matchRoutes(routes, location, basename);
|
|
6097
|
+
if (initialMatches) {
|
|
6098
|
+
for (let match of initialMatches) {
|
|
6099
|
+
let routeId = match.route.id;
|
|
6100
|
+
let routeInfo = getRouteInfo(routeId);
|
|
6101
|
+
if (shouldHydrateRouteLoader(
|
|
6102
|
+
routeId,
|
|
6103
|
+
routeInfo.clientLoader,
|
|
6104
|
+
routeInfo.hasLoader,
|
|
6105
|
+
isSpaMode
|
|
6106
|
+
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
|
6107
|
+
delete hydrationData.loaderData[routeId];
|
|
6108
|
+
} else if (!routeInfo.hasLoader) {
|
|
6109
|
+
hydrationData.loaderData[routeId] = null;
|
|
6110
|
+
}
|
|
6111
|
+
}
|
|
6112
|
+
}
|
|
6113
|
+
return hydrationData;
|
|
6114
|
+
}
|
|
6115
|
+
|
|
6150
6116
|
// lib/dom-export/dom-router-provider.tsx
|
|
6151
6117
|
function RouterProvider2(props) {
|
|
6152
6118
|
return /* @__PURE__ */ React10.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-1d760f6a6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
invariant,
|
|
26
26
|
mapRouteProperties,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-QBMD7MNB.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -1,83 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type SerializedError = {
|
|
5
|
-
message: string;
|
|
6
|
-
stack?: string;
|
|
7
|
-
};
|
|
8
|
-
interface FrameworkContextObject {
|
|
9
|
-
manifest: AssetsManifest;
|
|
10
|
-
routeModules: RouteModules;
|
|
11
|
-
criticalCss?: CriticalCss;
|
|
12
|
-
serverHandoffString?: string;
|
|
13
|
-
future: FutureConfig;
|
|
14
|
-
ssr: boolean;
|
|
15
|
-
isSpaMode: boolean;
|
|
16
|
-
serializeError?(error: Error): SerializedError;
|
|
17
|
-
renderMeta?: {
|
|
18
|
-
didRenderScripts?: boolean;
|
|
19
|
-
streamCache?: Record<number, Promise<void> & {
|
|
20
|
-
result?: {
|
|
21
|
-
done: boolean;
|
|
22
|
-
value: string;
|
|
23
|
-
};
|
|
24
|
-
error?: unknown;
|
|
25
|
-
}>;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
interface EntryContext extends FrameworkContextObject {
|
|
29
|
-
staticHandlerContext: StaticHandlerContext;
|
|
30
|
-
serverHandoffStream?: ReadableStream<Uint8Array>;
|
|
31
|
-
}
|
|
32
|
-
interface FutureConfig {
|
|
33
|
-
unstable_subResourceIntegrity: boolean;
|
|
34
|
-
unstable_middleware: boolean;
|
|
35
|
-
}
|
|
36
|
-
type CriticalCss = string | {
|
|
37
|
-
rel: "stylesheet";
|
|
38
|
-
href: string;
|
|
39
|
-
};
|
|
40
|
-
interface AssetsManifest {
|
|
41
|
-
entry: {
|
|
42
|
-
imports: string[];
|
|
43
|
-
module: string;
|
|
44
|
-
};
|
|
45
|
-
routes: RouteManifest<EntryRoute>;
|
|
46
|
-
url: string;
|
|
47
|
-
version: string;
|
|
48
|
-
hmr?: {
|
|
49
|
-
timestamp?: number;
|
|
50
|
-
runtime: string;
|
|
51
|
-
};
|
|
52
|
-
sri?: Record<string, string> | true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface Route$1 {
|
|
56
|
-
index?: boolean;
|
|
57
|
-
caseSensitive?: boolean;
|
|
58
|
-
id: string;
|
|
59
|
-
parentId?: string;
|
|
60
|
-
path?: string;
|
|
61
|
-
}
|
|
62
|
-
interface EntryRoute extends Route$1 {
|
|
63
|
-
hasAction: boolean;
|
|
64
|
-
hasLoader: boolean;
|
|
65
|
-
hasClientAction: boolean;
|
|
66
|
-
hasClientLoader: boolean;
|
|
67
|
-
hasClientMiddleware: boolean;
|
|
68
|
-
hasErrorBoundary: boolean;
|
|
69
|
-
imports?: string[];
|
|
70
|
-
css?: string[];
|
|
71
|
-
module: string;
|
|
72
|
-
clientActionModule: string | undefined;
|
|
73
|
-
clientLoaderModule: string | undefined;
|
|
74
|
-
clientMiddlewareModule: string | undefined;
|
|
75
|
-
hydrateFallbackModule: string | undefined;
|
|
76
|
-
parentId?: string;
|
|
77
|
-
}
|
|
78
|
-
declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
|
|
79
|
-
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[];
|
|
80
|
-
declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
|
|
2
|
+
import { k as RouteObject, R as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, at as PatchRoutesOnNavigationFunction, a as Router$1, T as To, d as RelativeRoutingType, y as NonIndexRouteObject, a5 as LazyRouteFunction, s as IndexRouteObject, e as Location, f as Action, as as Navigator, av as RouteMatch, p as StaticHandlerContext, c as RouteManifest, b as RouteModules, G as DataRouteObject, J as ClientLoaderFunction, a4 as HTMLFormMethod, a2 as FormEncType, aD as PageLinkDescriptor, aT as History, O as GetScrollRestorationKeyFunction, N as NavigateOptions, Q as Fetcher, n as SerializeFrom, B as BlockerFunction } from './route-data-C12CLHiN.js';
|
|
81
3
|
|
|
82
4
|
/**
|
|
83
5
|
* @private
|
|
@@ -271,7 +193,7 @@ type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
|
|
|
271
193
|
*
|
|
272
194
|
* @category Components
|
|
273
195
|
*/
|
|
274
|
-
declare function Route(_props: RouteProps): React.ReactElement | null;
|
|
196
|
+
declare function Route$1(_props: RouteProps): React.ReactElement | null;
|
|
275
197
|
/**
|
|
276
198
|
* @category Types
|
|
277
199
|
*/
|
|
@@ -471,15 +393,6 @@ function Book() {
|
|
|
471
393
|
|
|
472
394
|
*/
|
|
473
395
|
declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element;
|
|
474
|
-
declare function WithRouteComponentProps({ children, }: {
|
|
475
|
-
children: React.ReactElement;
|
|
476
|
-
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
477
|
-
declare function WithHydrateFallbackProps({ children, }: {
|
|
478
|
-
children: React.ReactElement;
|
|
479
|
-
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
480
|
-
declare function WithErrorBoundaryProps({ children, }: {
|
|
481
|
-
children: React.ReactElement;
|
|
482
|
-
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
483
396
|
/**
|
|
484
397
|
* Creates a route config from a React "children" object, which is usually
|
|
485
398
|
* either a `<Route>` element or an array of them. Used internally by
|
|
@@ -499,6 +412,84 @@ declare let createRoutesFromElements: typeof createRoutesFromChildren;
|
|
|
499
412
|
*/
|
|
500
413
|
declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null;
|
|
501
414
|
|
|
415
|
+
type SerializedError = {
|
|
416
|
+
message: string;
|
|
417
|
+
stack?: string;
|
|
418
|
+
};
|
|
419
|
+
interface FrameworkContextObject {
|
|
420
|
+
manifest: AssetsManifest;
|
|
421
|
+
routeModules: RouteModules;
|
|
422
|
+
criticalCss?: CriticalCss;
|
|
423
|
+
serverHandoffString?: string;
|
|
424
|
+
future: FutureConfig;
|
|
425
|
+
ssr: boolean;
|
|
426
|
+
isSpaMode: boolean;
|
|
427
|
+
serializeError?(error: Error): SerializedError;
|
|
428
|
+
renderMeta?: {
|
|
429
|
+
didRenderScripts?: boolean;
|
|
430
|
+
streamCache?: Record<number, Promise<void> & {
|
|
431
|
+
result?: {
|
|
432
|
+
done: boolean;
|
|
433
|
+
value: string;
|
|
434
|
+
};
|
|
435
|
+
error?: unknown;
|
|
436
|
+
}>;
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
interface EntryContext extends FrameworkContextObject {
|
|
440
|
+
staticHandlerContext: StaticHandlerContext;
|
|
441
|
+
serverHandoffStream?: ReadableStream<Uint8Array>;
|
|
442
|
+
}
|
|
443
|
+
interface FutureConfig {
|
|
444
|
+
unstable_subResourceIntegrity: boolean;
|
|
445
|
+
unstable_middleware: boolean;
|
|
446
|
+
}
|
|
447
|
+
type CriticalCss = string | {
|
|
448
|
+
rel: "stylesheet";
|
|
449
|
+
href: string;
|
|
450
|
+
};
|
|
451
|
+
interface AssetsManifest {
|
|
452
|
+
entry: {
|
|
453
|
+
imports: string[];
|
|
454
|
+
module: string;
|
|
455
|
+
};
|
|
456
|
+
routes: RouteManifest<EntryRoute>;
|
|
457
|
+
url: string;
|
|
458
|
+
version: string;
|
|
459
|
+
hmr?: {
|
|
460
|
+
timestamp?: number;
|
|
461
|
+
runtime: string;
|
|
462
|
+
};
|
|
463
|
+
sri?: Record<string, string> | true;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
interface Route {
|
|
467
|
+
index?: boolean;
|
|
468
|
+
caseSensitive?: boolean;
|
|
469
|
+
id: string;
|
|
470
|
+
parentId?: string;
|
|
471
|
+
path?: string;
|
|
472
|
+
}
|
|
473
|
+
interface EntryRoute extends Route {
|
|
474
|
+
hasAction: boolean;
|
|
475
|
+
hasLoader: boolean;
|
|
476
|
+
hasClientAction: boolean;
|
|
477
|
+
hasClientLoader: boolean;
|
|
478
|
+
hasClientMiddleware: boolean;
|
|
479
|
+
hasErrorBoundary: boolean;
|
|
480
|
+
imports?: string[];
|
|
481
|
+
css?: string[];
|
|
482
|
+
module: string;
|
|
483
|
+
clientActionModule: string | undefined;
|
|
484
|
+
clientLoaderModule: string | undefined;
|
|
485
|
+
clientMiddlewareModule: string | undefined;
|
|
486
|
+
hydrateFallbackModule: string | undefined;
|
|
487
|
+
parentId?: string;
|
|
488
|
+
}
|
|
489
|
+
declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
|
|
490
|
+
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[];
|
|
491
|
+
declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
|
|
492
|
+
|
|
502
493
|
type ParamKeyValuePair = [string, string];
|
|
503
494
|
type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
|
|
504
495
|
/**
|
|
@@ -1687,84 +1678,6 @@ declare function useViewTransitionState(to: To, opts?: {
|
|
|
1687
1678
|
relative?: RelativeRoutingType;
|
|
1688
1679
|
}): boolean;
|
|
1689
1680
|
|
|
1690
|
-
type RenderedRoute = {
|
|
1691
|
-
clientAction?: ClientActionFunction;
|
|
1692
|
-
clientLoader?: ClientLoaderFunction;
|
|
1693
|
-
element?: React.ReactElement | false;
|
|
1694
|
-
errorElement?: React.ReactElement;
|
|
1695
|
-
handle?: any;
|
|
1696
|
-
hasAction: boolean;
|
|
1697
|
-
hasErrorBoundary: boolean;
|
|
1698
|
-
hasLoader: boolean;
|
|
1699
|
-
hydrateFallbackElement?: React.ReactElement;
|
|
1700
|
-
id: string;
|
|
1701
|
-
index?: boolean;
|
|
1702
|
-
links?: LinksFunction;
|
|
1703
|
-
meta?: MetaFunction;
|
|
1704
|
-
parentId?: string;
|
|
1705
|
-
path?: string;
|
|
1706
|
-
shouldRevalidate?: ShouldRevalidateFunction;
|
|
1707
|
-
};
|
|
1708
|
-
type ServerRouteMatch = RenderedRoute & {
|
|
1709
|
-
params: Params;
|
|
1710
|
-
pathname: string;
|
|
1711
|
-
pathnameBase: string;
|
|
1712
|
-
};
|
|
1713
|
-
type ServerRenderPayload = {
|
|
1714
|
-
type: "render";
|
|
1715
|
-
actionData: Record<string, any> | null;
|
|
1716
|
-
basename?: string;
|
|
1717
|
-
errors: Record<string, any> | null;
|
|
1718
|
-
loaderData: Record<string, any>;
|
|
1719
|
-
location: Location;
|
|
1720
|
-
matches: ServerRouteMatch[];
|
|
1721
|
-
patches?: RenderedRoute[];
|
|
1722
|
-
nonce?: string;
|
|
1723
|
-
};
|
|
1724
|
-
type ServerManifestPayload = {
|
|
1725
|
-
type: "manifest";
|
|
1726
|
-
matches: RenderedRoute[];
|
|
1727
|
-
patches: RenderedRoute[];
|
|
1728
|
-
};
|
|
1729
|
-
type ServerActionPayload = {
|
|
1730
|
-
type: "action";
|
|
1731
|
-
actionResult: Promise<unknown>;
|
|
1732
|
-
rerender?: Promise<ServerRenderPayload | ServerRedirectPayload>;
|
|
1733
|
-
};
|
|
1734
|
-
type ServerRedirectPayload = {
|
|
1735
|
-
type: "redirect";
|
|
1736
|
-
status: number;
|
|
1737
|
-
location: string;
|
|
1738
|
-
replace: boolean;
|
|
1739
|
-
reload: boolean;
|
|
1740
|
-
};
|
|
1741
|
-
type ServerPayload = ServerRenderPayload | ServerManifestPayload | ServerActionPayload | ServerRedirectPayload;
|
|
1742
|
-
|
|
1743
|
-
type DecodeServerResponseFunction = (body: ReadableStream<Uint8Array>) => Promise<ServerPayload>;
|
|
1744
|
-
type EncodeActionFunction = (args: unknown[]) => Promise<BodyInit>;
|
|
1745
|
-
declare global {
|
|
1746
|
-
interface Window {
|
|
1747
|
-
__router: Router$1;
|
|
1748
|
-
__routerInitialized: boolean;
|
|
1749
|
-
__routerActionID: number;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
declare function createCallServer({ decode, encodeAction, }: {
|
|
1753
|
-
decode: DecodeServerResponseFunction;
|
|
1754
|
-
encodeAction: EncodeActionFunction;
|
|
1755
|
-
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
1756
|
-
declare function RSCHydratedRouter({ decode, payload, }: {
|
|
1757
|
-
decode: DecodeServerResponseFunction;
|
|
1758
|
-
payload: ServerPayload;
|
|
1759
|
-
}): React.JSX.Element;
|
|
1760
|
-
|
|
1761
|
-
declare global {
|
|
1762
|
-
interface Window {
|
|
1763
|
-
__FLIGHT_DATA: any[];
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
declare function getServerStream(): ReadableStream<any>;
|
|
1767
|
-
|
|
1768
1681
|
declare global {
|
|
1769
1682
|
interface Navigator {
|
|
1770
1683
|
connection?: {
|
|
@@ -1775,4 +1688,4 @@ declare global {
|
|
|
1775
1688
|
declare function getPatchRoutesOnNavigationFunction(manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, isSpaMode: boolean, basename: string | undefined): PatchRoutesOnNavigationFunction | undefined;
|
|
1776
1689
|
declare function useFogOFWarDiscovery(router: Router$1, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, isSpaMode: boolean): void;
|
|
1777
1690
|
|
|
1778
|
-
export {
|
|
1691
|
+
export { useSearchParams as $, type AssetsManifest as A, type BrowserRouterProps as B, type CriticalCss as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type FetcherSubmitFunction as G, type HashRouterProps as H, type IndexRouteProps as I, type FetcherWithComponents as J, createBrowserRouter as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, createHashRouter as Q, type RouterProviderProps as R, type ScrollRestorationProps as S, BrowserRouter as T, HashRouter as U, Link as V, HistoryRouter as W, NavLink as X, Form as Y, ScrollRestoration as Z, useLinkClickHandler as _, type Route as a, useSubmit as a0, useFormAction as a1, useFetcher as a2, useFetchers as a3, useBeforeUnload as a4, usePrompt as a5, useViewTransitionState as a6, type FetcherSubmitOptions as a7, type ParamKeyValuePair as a8, type SubmitOptions as a9, type URLSearchParamsInit as aa, type SubmitTarget as ab, createSearchParams as ac, Meta as ad, Links as ae, Scripts as af, PrefetchPageLinks as ag, type ScriptsProps as ah, hydrationRouteProperties as ai, mapRouteProperties as aj, FrameworkContext as ak, getPatchRoutesOnNavigationFunction as al, useFogOFWarDiscovery as am, createClientRoutes as an, createClientRoutesWithHMRRevalidationOptOut as ao, shouldHydrateRouteLoader as ap, useScrollRestoration as aq, type AwaitProps as b, type MemoryRouterProps as c, type RouteProps as d, type RouterProps as e, type RoutesProps as f, Await as g, MemoryRouter as h, Navigate as i, Outlet as j, Route$1 as k, Router as l, RouterProvider as m, Routes as n, createMemoryRouter as o, createRoutesFromChildren as p, createRoutesFromElements as q, renderMatches as r, type HistoryRouterProps as s, type LinkProps as t, type NavLinkProps as u, type NavLinkRenderProps as v, type FetcherFormProps as w, type FormProps as x, type SetURLSearchParams as y, type SubmitFunction as z };
|