react-router 0.0.0-experimental-3f68c7c20 → 0.0.0-experimental-e87ed2fd4
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/{browser-BenyQgT4.d.mts → browser-C9OqCpRB.d.mts} +537 -136
- package/dist/development/{chunk-APN7PBP2.mjs → chunk-PVJCBITV.mjs} +65 -53
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/index.d.mts +10 -390
- package/dist/development/index.d.ts +729 -708
- package/dist/development/index.js +68 -53
- package/dist/development/index.mjs +9 -3
- package/dist/development/lib/types/internal.d.mts +1 -1
- package/dist/development/lib/types/internal.d.ts +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/register-D3Ithcl4.d.ts → development/register-zy84znbA.d.ts} +1 -1
- package/dist/{production/route-data-CBHO1x2o.d.mts → development/route-data-C-cmsWVs.d.mts} +1 -1
- package/dist/development/rsc-export.d.mts +12 -1
- package/dist/development/rsc-export.d.ts +12 -1
- package/dist/development/rsc-export.js +209 -173
- package/dist/development/rsc-export.mjs +209 -174
- package/dist/production/{browser-BenyQgT4.d.mts → browser-C9OqCpRB.d.mts} +537 -136
- package/dist/production/{chunk-SAZGQ73S.mjs → chunk-FJS6IVQF.mjs} +65 -53
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/index.d.mts +10 -390
- package/dist/production/index.d.ts +729 -708
- package/dist/production/index.js +68 -53
- package/dist/production/index.mjs +9 -3
- package/dist/production/lib/types/internal.d.mts +1 -1
- package/dist/production/lib/types/internal.d.ts +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-D3Ithcl4.d.ts → production/register-zy84znbA.d.ts} +1 -1
- package/dist/{development/route-data-CBHO1x2o.d.mts → production/route-data-C-cmsWVs.d.mts} +1 -1
- package/dist/production/rsc-export.d.mts +12 -1
- package/dist/production/rsc-export.d.ts +12 -1
- package/dist/production/rsc-export.js +209 -173
- package/dist/production/rsc-export.mjs +209 -174
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-e87ed2fd4
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -5030,7 +5030,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
|
5030
5030
|
// router loaded. We can help them understand how to avoid that.
|
|
5031
5031
|
`useRoutes() may be used only in the context of a <Router> component.`
|
|
5032
5032
|
);
|
|
5033
|
-
let { navigator
|
|
5033
|
+
let { navigator } = React2.useContext(NavigationContext);
|
|
5034
5034
|
let { matches: parentMatches } = React2.useContext(RouteContext);
|
|
5035
5035
|
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
5036
5036
|
let parentParams = routeMatch ? routeMatch.params : {};
|
|
@@ -5066,7 +5066,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
5066
5066
|
let segments = pathname.replace(/^\//, "").split("/");
|
|
5067
5067
|
remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
|
|
5068
5068
|
}
|
|
5069
|
-
let matches =
|
|
5069
|
+
let matches = matchRoutes(routes, { pathname: remainingPathname });
|
|
5070
5070
|
if (ENABLE_DEV_WARNINGS) {
|
|
5071
5071
|
warning(
|
|
5072
5072
|
parentRoute || matches != null,
|
|
@@ -5996,6 +5996,38 @@ var createRoutesFromElements = createRoutesFromChildren;
|
|
|
5996
5996
|
function renderMatches(matches) {
|
|
5997
5997
|
return _renderMatches(matches);
|
|
5998
5998
|
}
|
|
5999
|
+
function withComponentProps(Component4) {
|
|
6000
|
+
return function WithComponentProps() {
|
|
6001
|
+
const props = {
|
|
6002
|
+
params: useParams(),
|
|
6003
|
+
loaderData: useLoaderData(),
|
|
6004
|
+
actionData: useActionData(),
|
|
6005
|
+
matches: useMatches()
|
|
6006
|
+
};
|
|
6007
|
+
return React3.createElement(Component4, props);
|
|
6008
|
+
};
|
|
6009
|
+
}
|
|
6010
|
+
function withHydrateFallbackProps(HydrateFallback) {
|
|
6011
|
+
return function WithHydrateFallbackProps() {
|
|
6012
|
+
const props = {
|
|
6013
|
+
params: useParams(),
|
|
6014
|
+
loaderData: useLoaderData(),
|
|
6015
|
+
actionData: useActionData()
|
|
6016
|
+
};
|
|
6017
|
+
return React3.createElement(HydrateFallback, props);
|
|
6018
|
+
};
|
|
6019
|
+
}
|
|
6020
|
+
function withErrorBoundaryProps(ErrorBoundary) {
|
|
6021
|
+
return function WithErrorBoundaryProps() {
|
|
6022
|
+
const props = {
|
|
6023
|
+
params: useParams(),
|
|
6024
|
+
loaderData: useLoaderData(),
|
|
6025
|
+
actionData: useActionData(),
|
|
6026
|
+
error: useRouteError()
|
|
6027
|
+
};
|
|
6028
|
+
return React3.createElement(ErrorBoundary, props);
|
|
6029
|
+
};
|
|
6030
|
+
}
|
|
5999
6031
|
|
|
6000
6032
|
// lib/dom/lib.tsx
|
|
6001
6033
|
import * as React10 from "react";
|
|
@@ -8761,7 +8793,7 @@ function mergeRefs(...refs) {
|
|
|
8761
8793
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8762
8794
|
try {
|
|
8763
8795
|
if (isBrowser) {
|
|
8764
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8796
|
+
window.__reactRouterVersion = "0.0.0-experimental-e87ed2fd4";
|
|
8765
8797
|
}
|
|
8766
8798
|
} catch (e) {
|
|
8767
8799
|
}
|
|
@@ -9958,37 +9990,6 @@ function createRoutesStub(routes, unstable_getContext) {
|
|
|
9958
9990
|
return /* @__PURE__ */ React13.createElement(FrameworkContext.Provider, { value: remixContextRef.current }, /* @__PURE__ */ React13.createElement(RouterProvider, { router: routerRef.current }));
|
|
9959
9991
|
};
|
|
9960
9992
|
}
|
|
9961
|
-
function withComponentProps(Component4) {
|
|
9962
|
-
return function Wrapped() {
|
|
9963
|
-
return React13.createElement(Component4, {
|
|
9964
|
-
params: useParams(),
|
|
9965
|
-
loaderData: useLoaderData(),
|
|
9966
|
-
actionData: useActionData(),
|
|
9967
|
-
matches: useMatches()
|
|
9968
|
-
});
|
|
9969
|
-
};
|
|
9970
|
-
}
|
|
9971
|
-
function withHydrateFallbackProps(HydrateFallback) {
|
|
9972
|
-
return function Wrapped() {
|
|
9973
|
-
const props = {
|
|
9974
|
-
params: useParams(),
|
|
9975
|
-
loaderData: useLoaderData(),
|
|
9976
|
-
actionData: useActionData()
|
|
9977
|
-
};
|
|
9978
|
-
return React13.createElement(HydrateFallback, props);
|
|
9979
|
-
};
|
|
9980
|
-
}
|
|
9981
|
-
function withErrorBoundaryProps(ErrorBoundary) {
|
|
9982
|
-
return function Wrapped() {
|
|
9983
|
-
const props = {
|
|
9984
|
-
params: useParams(),
|
|
9985
|
-
loaderData: useLoaderData(),
|
|
9986
|
-
actionData: useActionData(),
|
|
9987
|
-
error: useRouteError()
|
|
9988
|
-
};
|
|
9989
|
-
return React13.createElement(ErrorBoundary, props);
|
|
9990
|
-
};
|
|
9991
|
-
}
|
|
9992
9993
|
function processRoutes(routes, manifest, routeModules, parentId) {
|
|
9993
9994
|
return routes.map((route) => {
|
|
9994
9995
|
if (!route.id) {
|
|
@@ -10506,7 +10507,14 @@ function createServerHandoffString(serverHandoff) {
|
|
|
10506
10507
|
|
|
10507
10508
|
// lib/server-runtime/headers.ts
|
|
10508
10509
|
import { splitCookiesString } from "set-cookie-parser";
|
|
10509
|
-
function getDocumentHeaders(context,
|
|
10510
|
+
function getDocumentHeaders(context, build) {
|
|
10511
|
+
return getDocumentHeadersImpl(context, (m) => {
|
|
10512
|
+
let route = build.routes[m.route.id];
|
|
10513
|
+
invariant3(route, `Route with id "${m.route.id}" not found in build`);
|
|
10514
|
+
return route.module.headers;
|
|
10515
|
+
});
|
|
10516
|
+
}
|
|
10517
|
+
function getDocumentHeadersImpl(context, getRouteHeadersFn) {
|
|
10510
10518
|
let boundaryIdx = context.errors ? context.matches.findIndex((m) => context.errors[m.route.id]) : -1;
|
|
10511
10519
|
let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches;
|
|
10512
10520
|
let errorHeaders;
|
|
@@ -10576,10 +10584,7 @@ var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
|
10576
10584
|
async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
10577
10585
|
try {
|
|
10578
10586
|
let respond2 = function(context) {
|
|
10579
|
-
let headers = getDocumentHeaders(
|
|
10580
|
-
context,
|
|
10581
|
-
(m) => build.routes[m.route.id]?.module.headers
|
|
10582
|
-
);
|
|
10587
|
+
let headers = getDocumentHeaders(context, build);
|
|
10583
10588
|
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
|
|
10584
10589
|
return generateSingleFetchResponse(request, build, serverMode, {
|
|
10585
10590
|
result: getSingleFetchRedirect(
|
|
@@ -10654,10 +10659,7 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
10654
10659
|
async function singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
|
|
10655
10660
|
try {
|
|
10656
10661
|
let respond2 = function(context) {
|
|
10657
|
-
let headers = getDocumentHeaders(
|
|
10658
|
-
context,
|
|
10659
|
-
(m) => build.routes[m.route.id]?.module.headers
|
|
10660
|
-
);
|
|
10662
|
+
let headers = getDocumentHeaders(context, build);
|
|
10661
10663
|
if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
|
|
10662
10664
|
return generateSingleFetchResponse(request, build, serverMode, {
|
|
10663
10665
|
result: {
|
|
@@ -11124,10 +11126,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
11124
11126
|
if (isResponse(context)) {
|
|
11125
11127
|
return context;
|
|
11126
11128
|
}
|
|
11127
|
-
let headers = getDocumentHeaders(
|
|
11128
|
-
context,
|
|
11129
|
-
(m) => build.routes[m.route.id]?.module.headers
|
|
11130
|
-
);
|
|
11129
|
+
let headers = getDocumentHeaders(context, build);
|
|
11131
11130
|
if (SERVER_NO_BODY_STATUS_CODES.has(context.statusCode)) {
|
|
11132
11131
|
return new Response(null, { status: context.statusCode, headers });
|
|
11133
11132
|
}
|
|
@@ -11974,7 +11973,8 @@ async function routeRSCServerRequest({
|
|
|
11974
11973
|
request,
|
|
11975
11974
|
callServer,
|
|
11976
11975
|
decode: decode2,
|
|
11977
|
-
renderHTML
|
|
11976
|
+
renderHTML,
|
|
11977
|
+
hydrate: hydrate2 = true
|
|
11978
11978
|
}) {
|
|
11979
11979
|
const url = new URL(request.url);
|
|
11980
11980
|
let serverRequest = request;
|
|
@@ -12000,9 +12000,9 @@ async function routeRSCServerRequest({
|
|
|
12000
12000
|
if (!serverResponse.body) {
|
|
12001
12001
|
throw new Error("Missing body in server response");
|
|
12002
12002
|
}
|
|
12003
|
-
|
|
12004
|
-
if (
|
|
12005
|
-
|
|
12003
|
+
let serverResponseB = null;
|
|
12004
|
+
if (hydrate2) {
|
|
12005
|
+
serverResponseB = serverResponse.clone();
|
|
12006
12006
|
}
|
|
12007
12007
|
const body = serverResponse.body;
|
|
12008
12008
|
let payloadPromise;
|
|
@@ -12013,9 +12013,18 @@ async function routeRSCServerRequest({
|
|
|
12013
12013
|
};
|
|
12014
12014
|
try {
|
|
12015
12015
|
const html = await renderHTML(getPayload);
|
|
12016
|
-
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
12017
12016
|
const headers = new Headers(serverResponse.headers);
|
|
12018
12017
|
headers.set("Content-Type", "text/html");
|
|
12018
|
+
if (!hydrate2) {
|
|
12019
|
+
return new Response(html, {
|
|
12020
|
+
status: serverResponse.status,
|
|
12021
|
+
headers
|
|
12022
|
+
});
|
|
12023
|
+
}
|
|
12024
|
+
if (!serverResponseB?.body) {
|
|
12025
|
+
throw new Error("Failed to clone server response");
|
|
12026
|
+
}
|
|
12027
|
+
const body2 = html.pipeThrough(injectRSCPayload(serverResponseB.body));
|
|
12019
12028
|
return new Response(body2, {
|
|
12020
12029
|
status: serverResponse.status,
|
|
12021
12030
|
headers
|
|
@@ -12262,6 +12271,9 @@ export {
|
|
|
12262
12271
|
createRoutesFromChildren,
|
|
12263
12272
|
createRoutesFromElements,
|
|
12264
12273
|
renderMatches,
|
|
12274
|
+
withComponentProps,
|
|
12275
|
+
withHydrateFallbackProps,
|
|
12276
|
+
withErrorBoundaryProps,
|
|
12265
12277
|
createSearchParams,
|
|
12266
12278
|
SingleFetchRedirectSymbol,
|
|
12267
12279
|
getTurboStreamSingleFetchDataStrategy,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './browser-
|
|
3
|
-
import { R as RouterInit } from './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './browser-C9OqCpRB.mjs';
|
|
3
|
+
import { R as RouterInit } from './route-data-C-cmsWVs.mjs';
|
|
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-e87ed2fd4
|
|
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-FJS6IVQF.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|