react-router 0.0.0-experimental-19ee16c3e → 0.0.0-experimental-3f68c7c20
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-6KBWYHGQ.mjs → chunk-APN7PBP2.mjs} +19 -26
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +2 -2
- package/dist/development/index.js +19 -26
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/rsc-export.js +18 -25
- package/dist/development/rsc-export.mjs +18 -25
- package/dist/production/{chunk-XK2DTS6N.mjs → chunk-SAZGQ73S.mjs} +19 -26
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +2 -2
- package/dist/production/index.js +19 -26
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/rsc-export.js +18 -25
- package/dist/production/rsc-export.mjs +18 -25
- 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-3f68c7c20
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2727,6 +2727,12 @@ function createStaticHandler(routes, opts) {
|
|
|
2727
2727
|
let location2 = createLocation("", createPath(url), null, "default");
|
|
2728
2728
|
let matches = matchRoutes(dataRoutes, location2, basename);
|
|
2729
2729
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
2730
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
2731
|
+
return stream ? stream(
|
|
2732
|
+
requestContext,
|
|
2733
|
+
() => Promise.resolve(ctx)
|
|
2734
|
+
) : respond ? respond(ctx) : void 0;
|
|
2735
|
+
};
|
|
2730
2736
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
2731
2737
|
let error = getInternalRouterError(405, { method });
|
|
2732
2738
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2743,10 +2749,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2743
2749
|
loaderHeaders: {},
|
|
2744
2750
|
actionHeaders: {}
|
|
2745
2751
|
};
|
|
2746
|
-
return
|
|
2747
|
-
requestContext,
|
|
2748
|
-
() => Promise.resolve(staticContext)
|
|
2749
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2752
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2750
2753
|
} else if (!matches) {
|
|
2751
2754
|
let error = getInternalRouterError(404, { pathname: location2.pathname });
|
|
2752
2755
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2763,10 +2766,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2763
2766
|
loaderHeaders: {},
|
|
2764
2767
|
actionHeaders: {}
|
|
2765
2768
|
};
|
|
2766
|
-
return
|
|
2767
|
-
requestContext,
|
|
2768
|
-
() => Promise.resolve(staticContext)
|
|
2769
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2769
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2770
2770
|
}
|
|
2771
2771
|
if (stream || respond && matches.some(
|
|
2772
2772
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -2833,13 +2833,6 @@ function createStaticHandler(routes, opts) {
|
|
|
2833
2833
|
return res;
|
|
2834
2834
|
},
|
|
2835
2835
|
async (error, routeId) => {
|
|
2836
|
-
if (stream) {
|
|
2837
|
-
invariant(
|
|
2838
|
-
false,
|
|
2839
|
-
"stream() Not implemented for middleware errors yet"
|
|
2840
|
-
);
|
|
2841
|
-
}
|
|
2842
|
-
invariant(respond, "Expected respond to be defined");
|
|
2843
2836
|
if (isResponse(error)) {
|
|
2844
2837
|
return error;
|
|
2845
2838
|
}
|
|
@@ -2847,14 +2840,13 @@ function createStaticHandler(routes, opts) {
|
|
|
2847
2840
|
if (routeId in renderedStaticContext.loaderData) {
|
|
2848
2841
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
2849
2842
|
}
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2856
|
-
)
|
|
2843
|
+
let staticContext = getStaticContextFromError(
|
|
2844
|
+
dataRoutes,
|
|
2845
|
+
renderedStaticContext,
|
|
2846
|
+
error,
|
|
2847
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2857
2848
|
);
|
|
2849
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2858
2850
|
} else {
|
|
2859
2851
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2860
2852
|
matches,
|
|
@@ -2862,7 +2854,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2862
2854
|
(m) => m.route.id === routeId || m.route.loader
|
|
2863
2855
|
)?.route.id || routeId
|
|
2864
2856
|
).route.id;
|
|
2865
|
-
|
|
2857
|
+
let staticContext = {
|
|
2866
2858
|
matches,
|
|
2867
2859
|
location: location2,
|
|
2868
2860
|
basename,
|
|
@@ -2874,7 +2866,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2874
2866
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
2875
2867
|
actionHeaders: {},
|
|
2876
2868
|
loaderHeaders: {}
|
|
2877
|
-
}
|
|
2869
|
+
};
|
|
2870
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2878
2871
|
}
|
|
2879
2872
|
}
|
|
2880
2873
|
);
|
|
@@ -8768,7 +8761,7 @@ function mergeRefs(...refs) {
|
|
|
8768
8761
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8769
8762
|
try {
|
|
8770
8763
|
if (isBrowser) {
|
|
8771
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8764
|
+
window.__reactRouterVersion = "0.0.0-experimental-3f68c7c20";
|
|
8772
8765
|
}
|
|
8773
8766
|
} catch (e) {
|
|
8774
8767
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
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-APN7PBP2.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2883,6 +2883,12 @@ function createStaticHandler(routes, opts) {
|
|
|
2883
2883
|
let location2 = createLocation("", createPath(url), null, "default");
|
|
2884
2884
|
let matches = matchRoutes(dataRoutes, location2, basename);
|
|
2885
2885
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
2886
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
2887
|
+
return stream ? stream(
|
|
2888
|
+
requestContext,
|
|
2889
|
+
() => Promise.resolve(ctx)
|
|
2890
|
+
) : respond ? respond(ctx) : void 0;
|
|
2891
|
+
};
|
|
2886
2892
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
2887
2893
|
let error = getInternalRouterError(405, { method });
|
|
2888
2894
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2899,10 +2905,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2899
2905
|
loaderHeaders: {},
|
|
2900
2906
|
actionHeaders: {}
|
|
2901
2907
|
};
|
|
2902
|
-
return
|
|
2903
|
-
requestContext,
|
|
2904
|
-
() => Promise.resolve(staticContext)
|
|
2905
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2908
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2906
2909
|
} else if (!matches) {
|
|
2907
2910
|
let error = getInternalRouterError(404, { pathname: location2.pathname });
|
|
2908
2911
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2919,10 +2922,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2919
2922
|
loaderHeaders: {},
|
|
2920
2923
|
actionHeaders: {}
|
|
2921
2924
|
};
|
|
2922
|
-
return
|
|
2923
|
-
requestContext,
|
|
2924
|
-
() => Promise.resolve(staticContext)
|
|
2925
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2925
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2926
2926
|
}
|
|
2927
2927
|
if (stream || respond && matches.some(
|
|
2928
2928
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -2989,13 +2989,6 @@ function createStaticHandler(routes, opts) {
|
|
|
2989
2989
|
return res;
|
|
2990
2990
|
},
|
|
2991
2991
|
async (error, routeId) => {
|
|
2992
|
-
if (stream) {
|
|
2993
|
-
invariant(
|
|
2994
|
-
false,
|
|
2995
|
-
"stream() Not implemented for middleware errors yet"
|
|
2996
|
-
);
|
|
2997
|
-
}
|
|
2998
|
-
invariant(respond, "Expected respond to be defined");
|
|
2999
2992
|
if (isResponse(error)) {
|
|
3000
2993
|
return error;
|
|
3001
2994
|
}
|
|
@@ -3003,14 +2996,13 @@ function createStaticHandler(routes, opts) {
|
|
|
3003
2996
|
if (routeId in renderedStaticContext.loaderData) {
|
|
3004
2997
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
3005
2998
|
}
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
3012
|
-
)
|
|
2999
|
+
let staticContext = getStaticContextFromError(
|
|
3000
|
+
dataRoutes,
|
|
3001
|
+
renderedStaticContext,
|
|
3002
|
+
error,
|
|
3003
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
3013
3004
|
);
|
|
3005
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
3014
3006
|
} else {
|
|
3015
3007
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
3016
3008
|
matches,
|
|
@@ -3018,7 +3010,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3018
3010
|
(m) => m.route.id === routeId || m.route.loader
|
|
3019
3011
|
)?.route.id || routeId
|
|
3020
3012
|
).route.id;
|
|
3021
|
-
|
|
3013
|
+
let staticContext = {
|
|
3022
3014
|
matches,
|
|
3023
3015
|
location: location2,
|
|
3024
3016
|
basename,
|
|
@@ -3030,7 +3022,8 @@ function createStaticHandler(routes, opts) {
|
|
|
3030
3022
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
3031
3023
|
actionHeaders: {},
|
|
3032
3024
|
loaderHeaders: {}
|
|
3033
|
-
}
|
|
3025
|
+
};
|
|
3026
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
3034
3027
|
}
|
|
3035
3028
|
}
|
|
3036
3029
|
);
|
|
@@ -8924,7 +8917,7 @@ function mergeRefs(...refs) {
|
|
|
8924
8917
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8925
8918
|
try {
|
|
8926
8919
|
if (isBrowser) {
|
|
8927
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8920
|
+
window.__reactRouterVersion = "0.0.0-experimental-3f68c7c20";
|
|
8928
8921
|
}
|
|
8929
8922
|
} catch (e) {
|
|
8930
8923
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
useSearchParams,
|
|
132
132
|
useSubmit,
|
|
133
133
|
useViewTransitionState
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-APN7PBP2.mjs";
|
|
135
135
|
export {
|
|
136
136
|
Await,
|
|
137
137
|
BrowserRouter,
|
|
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* react-router v0.0.0-experimental-
|
|
28
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
29
29
|
*
|
|
30
30
|
* Copyright (c) Remix Software Inc.
|
|
31
31
|
*
|
|
@@ -661,6 +661,12 @@ function createStaticHandler(routes, opts) {
|
|
|
661
661
|
let location = createLocation("", createPath(url), null, "default");
|
|
662
662
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
663
663
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
664
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
665
|
+
return stream ? stream(
|
|
666
|
+
requestContext,
|
|
667
|
+
() => Promise.resolve(ctx)
|
|
668
|
+
) : respond ? respond(ctx) : void 0;
|
|
669
|
+
};
|
|
664
670
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
665
671
|
let error = getInternalRouterError(405, { method });
|
|
666
672
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -677,10 +683,7 @@ function createStaticHandler(routes, opts) {
|
|
|
677
683
|
loaderHeaders: {},
|
|
678
684
|
actionHeaders: {}
|
|
679
685
|
};
|
|
680
|
-
return
|
|
681
|
-
requestContext,
|
|
682
|
-
() => Promise.resolve(staticContext)
|
|
683
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
686
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
684
687
|
} else if (!matches) {
|
|
685
688
|
let error = getInternalRouterError(404, { pathname: location.pathname });
|
|
686
689
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -697,10 +700,7 @@ function createStaticHandler(routes, opts) {
|
|
|
697
700
|
loaderHeaders: {},
|
|
698
701
|
actionHeaders: {}
|
|
699
702
|
};
|
|
700
|
-
return
|
|
701
|
-
requestContext,
|
|
702
|
-
() => Promise.resolve(staticContext)
|
|
703
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
703
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
704
704
|
}
|
|
705
705
|
if (stream || respond && matches.some(
|
|
706
706
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -767,13 +767,6 @@ function createStaticHandler(routes, opts) {
|
|
|
767
767
|
return res;
|
|
768
768
|
},
|
|
769
769
|
async (error, routeId) => {
|
|
770
|
-
if (stream) {
|
|
771
|
-
invariant(
|
|
772
|
-
false,
|
|
773
|
-
"stream() Not implemented for middleware errors yet"
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
invariant(respond, "Expected respond to be defined");
|
|
777
770
|
if (isResponse(error)) {
|
|
778
771
|
return error;
|
|
779
772
|
}
|
|
@@ -781,14 +774,13 @@ function createStaticHandler(routes, opts) {
|
|
|
781
774
|
if (routeId in renderedStaticContext.loaderData) {
|
|
782
775
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
783
776
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
790
|
-
)
|
|
777
|
+
let staticContext = getStaticContextFromError(
|
|
778
|
+
dataRoutes,
|
|
779
|
+
renderedStaticContext,
|
|
780
|
+
error,
|
|
781
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
791
782
|
);
|
|
783
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
792
784
|
} else {
|
|
793
785
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
794
786
|
matches,
|
|
@@ -796,7 +788,7 @@ function createStaticHandler(routes, opts) {
|
|
|
796
788
|
(m) => m.route.id === routeId || m.route.loader
|
|
797
789
|
)?.route.id || routeId
|
|
798
790
|
).route.id;
|
|
799
|
-
|
|
791
|
+
let staticContext = {
|
|
800
792
|
matches,
|
|
801
793
|
location,
|
|
802
794
|
basename,
|
|
@@ -808,7 +800,8 @@ function createStaticHandler(routes, opts) {
|
|
|
808
800
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
809
801
|
actionHeaders: {},
|
|
810
802
|
loaderHeaders: {}
|
|
811
|
-
}
|
|
803
|
+
};
|
|
804
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
812
805
|
}
|
|
813
806
|
}
|
|
814
807
|
);
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { splitCookiesString } from 'set-cookie-parser';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* react-router v0.0.0-experimental-
|
|
6
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) Remix Software Inc.
|
|
9
9
|
*
|
|
@@ -639,6 +639,12 @@ function createStaticHandler(routes, opts) {
|
|
|
639
639
|
let location = createLocation("", createPath(url), null, "default");
|
|
640
640
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
641
641
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
642
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
643
|
+
return stream ? stream(
|
|
644
|
+
requestContext,
|
|
645
|
+
() => Promise.resolve(ctx)
|
|
646
|
+
) : respond ? respond(ctx) : void 0;
|
|
647
|
+
};
|
|
642
648
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
643
649
|
let error = getInternalRouterError(405, { method });
|
|
644
650
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -655,10 +661,7 @@ function createStaticHandler(routes, opts) {
|
|
|
655
661
|
loaderHeaders: {},
|
|
656
662
|
actionHeaders: {}
|
|
657
663
|
};
|
|
658
|
-
return
|
|
659
|
-
requestContext,
|
|
660
|
-
() => Promise.resolve(staticContext)
|
|
661
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
664
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
662
665
|
} else if (!matches) {
|
|
663
666
|
let error = getInternalRouterError(404, { pathname: location.pathname });
|
|
664
667
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -675,10 +678,7 @@ function createStaticHandler(routes, opts) {
|
|
|
675
678
|
loaderHeaders: {},
|
|
676
679
|
actionHeaders: {}
|
|
677
680
|
};
|
|
678
|
-
return
|
|
679
|
-
requestContext,
|
|
680
|
-
() => Promise.resolve(staticContext)
|
|
681
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
681
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
682
682
|
}
|
|
683
683
|
if (stream || respond && matches.some(
|
|
684
684
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -745,13 +745,6 @@ function createStaticHandler(routes, opts) {
|
|
|
745
745
|
return res;
|
|
746
746
|
},
|
|
747
747
|
async (error, routeId) => {
|
|
748
|
-
if (stream) {
|
|
749
|
-
invariant(
|
|
750
|
-
false,
|
|
751
|
-
"stream() Not implemented for middleware errors yet"
|
|
752
|
-
);
|
|
753
|
-
}
|
|
754
|
-
invariant(respond, "Expected respond to be defined");
|
|
755
748
|
if (isResponse(error)) {
|
|
756
749
|
return error;
|
|
757
750
|
}
|
|
@@ -759,14 +752,13 @@ function createStaticHandler(routes, opts) {
|
|
|
759
752
|
if (routeId in renderedStaticContext.loaderData) {
|
|
760
753
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
761
754
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
768
|
-
)
|
|
755
|
+
let staticContext = getStaticContextFromError(
|
|
756
|
+
dataRoutes,
|
|
757
|
+
renderedStaticContext,
|
|
758
|
+
error,
|
|
759
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
769
760
|
);
|
|
761
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
770
762
|
} else {
|
|
771
763
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
772
764
|
matches,
|
|
@@ -774,7 +766,7 @@ function createStaticHandler(routes, opts) {
|
|
|
774
766
|
(m) => m.route.id === routeId || m.route.loader
|
|
775
767
|
)?.route.id || routeId
|
|
776
768
|
).route.id;
|
|
777
|
-
|
|
769
|
+
let staticContext = {
|
|
778
770
|
matches,
|
|
779
771
|
location,
|
|
780
772
|
basename,
|
|
@@ -786,7 +778,8 @@ function createStaticHandler(routes, opts) {
|
|
|
786
778
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
787
779
|
actionHeaders: {},
|
|
788
780
|
loaderHeaders: {}
|
|
789
|
-
}
|
|
781
|
+
};
|
|
782
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
790
783
|
}
|
|
791
784
|
}
|
|
792
785
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2727,6 +2727,12 @@ function createStaticHandler(routes, opts) {
|
|
|
2727
2727
|
let location2 = createLocation("", createPath(url), null, "default");
|
|
2728
2728
|
let matches = matchRoutes(dataRoutes, location2, basename);
|
|
2729
2729
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
2730
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
2731
|
+
return stream ? stream(
|
|
2732
|
+
requestContext,
|
|
2733
|
+
() => Promise.resolve(ctx)
|
|
2734
|
+
) : respond ? respond(ctx) : void 0;
|
|
2735
|
+
};
|
|
2730
2736
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
2731
2737
|
let error = getInternalRouterError(405, { method });
|
|
2732
2738
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2743,10 +2749,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2743
2749
|
loaderHeaders: {},
|
|
2744
2750
|
actionHeaders: {}
|
|
2745
2751
|
};
|
|
2746
|
-
return
|
|
2747
|
-
requestContext,
|
|
2748
|
-
() => Promise.resolve(staticContext)
|
|
2749
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2752
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2750
2753
|
} else if (!matches) {
|
|
2751
2754
|
let error = getInternalRouterError(404, { pathname: location2.pathname });
|
|
2752
2755
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2763,10 +2766,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2763
2766
|
loaderHeaders: {},
|
|
2764
2767
|
actionHeaders: {}
|
|
2765
2768
|
};
|
|
2766
|
-
return
|
|
2767
|
-
requestContext,
|
|
2768
|
-
() => Promise.resolve(staticContext)
|
|
2769
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2769
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2770
2770
|
}
|
|
2771
2771
|
if (stream || respond && matches.some(
|
|
2772
2772
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -2833,13 +2833,6 @@ function createStaticHandler(routes, opts) {
|
|
|
2833
2833
|
return res;
|
|
2834
2834
|
},
|
|
2835
2835
|
async (error, routeId) => {
|
|
2836
|
-
if (stream) {
|
|
2837
|
-
invariant(
|
|
2838
|
-
false,
|
|
2839
|
-
"stream() Not implemented for middleware errors yet"
|
|
2840
|
-
);
|
|
2841
|
-
}
|
|
2842
|
-
invariant(respond, "Expected respond to be defined");
|
|
2843
2836
|
if (isResponse(error)) {
|
|
2844
2837
|
return error;
|
|
2845
2838
|
}
|
|
@@ -2847,14 +2840,13 @@ function createStaticHandler(routes, opts) {
|
|
|
2847
2840
|
if (routeId in renderedStaticContext.loaderData) {
|
|
2848
2841
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
2849
2842
|
}
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2856
|
-
)
|
|
2843
|
+
let staticContext = getStaticContextFromError(
|
|
2844
|
+
dataRoutes,
|
|
2845
|
+
renderedStaticContext,
|
|
2846
|
+
error,
|
|
2847
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
2857
2848
|
);
|
|
2849
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2858
2850
|
} else {
|
|
2859
2851
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
2860
2852
|
matches,
|
|
@@ -2862,7 +2854,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2862
2854
|
(m) => m.route.id === routeId || m.route.loader
|
|
2863
2855
|
)?.route.id || routeId
|
|
2864
2856
|
).route.id;
|
|
2865
|
-
|
|
2857
|
+
let staticContext = {
|
|
2866
2858
|
matches,
|
|
2867
2859
|
location: location2,
|
|
2868
2860
|
basename,
|
|
@@ -2874,7 +2866,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2874
2866
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
2875
2867
|
actionHeaders: {},
|
|
2876
2868
|
loaderHeaders: {}
|
|
2877
|
-
}
|
|
2869
|
+
};
|
|
2870
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2878
2871
|
}
|
|
2879
2872
|
}
|
|
2880
2873
|
);
|
|
@@ -8768,7 +8761,7 @@ function mergeRefs(...refs) {
|
|
|
8768
8761
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8769
8762
|
try {
|
|
8770
8763
|
if (isBrowser) {
|
|
8771
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8764
|
+
window.__reactRouterVersion = "0.0.0-experimental-3f68c7c20";
|
|
8772
8765
|
}
|
|
8773
8766
|
} catch (e) {
|
|
8774
8767
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
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-SAZGQ73S.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|
package/dist/production/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2883,6 +2883,12 @@ function createStaticHandler(routes, opts) {
|
|
|
2883
2883
|
let location2 = createLocation("", createPath(url), null, "default");
|
|
2884
2884
|
let matches = matchRoutes(dataRoutes, location2, basename);
|
|
2885
2885
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
2886
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
2887
|
+
return stream ? stream(
|
|
2888
|
+
requestContext,
|
|
2889
|
+
() => Promise.resolve(ctx)
|
|
2890
|
+
) : respond ? respond(ctx) : void 0;
|
|
2891
|
+
};
|
|
2886
2892
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
2887
2893
|
let error = getInternalRouterError(405, { method });
|
|
2888
2894
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2899,10 +2905,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2899
2905
|
loaderHeaders: {},
|
|
2900
2906
|
actionHeaders: {}
|
|
2901
2907
|
};
|
|
2902
|
-
return
|
|
2903
|
-
requestContext,
|
|
2904
|
-
() => Promise.resolve(staticContext)
|
|
2905
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2908
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2906
2909
|
} else if (!matches) {
|
|
2907
2910
|
let error = getInternalRouterError(404, { pathname: location2.pathname });
|
|
2908
2911
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2919,10 +2922,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2919
2922
|
loaderHeaders: {},
|
|
2920
2923
|
actionHeaders: {}
|
|
2921
2924
|
};
|
|
2922
|
-
return
|
|
2923
|
-
requestContext,
|
|
2924
|
-
() => Promise.resolve(staticContext)
|
|
2925
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
2925
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
2926
2926
|
}
|
|
2927
2927
|
if (stream || respond && matches.some(
|
|
2928
2928
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -2989,13 +2989,6 @@ function createStaticHandler(routes, opts) {
|
|
|
2989
2989
|
return res;
|
|
2990
2990
|
},
|
|
2991
2991
|
async (error, routeId) => {
|
|
2992
|
-
if (stream) {
|
|
2993
|
-
invariant(
|
|
2994
|
-
false,
|
|
2995
|
-
"stream() Not implemented for middleware errors yet"
|
|
2996
|
-
);
|
|
2997
|
-
}
|
|
2998
|
-
invariant(respond, "Expected respond to be defined");
|
|
2999
2992
|
if (isResponse(error)) {
|
|
3000
2993
|
return error;
|
|
3001
2994
|
}
|
|
@@ -3003,14 +2996,13 @@ function createStaticHandler(routes, opts) {
|
|
|
3003
2996
|
if (routeId in renderedStaticContext.loaderData) {
|
|
3004
2997
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
3005
2998
|
}
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
3012
|
-
)
|
|
2999
|
+
let staticContext = getStaticContextFromError(
|
|
3000
|
+
dataRoutes,
|
|
3001
|
+
renderedStaticContext,
|
|
3002
|
+
error,
|
|
3003
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
3013
3004
|
);
|
|
3005
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
3014
3006
|
} else {
|
|
3015
3007
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
3016
3008
|
matches,
|
|
@@ -3018,7 +3010,7 @@ function createStaticHandler(routes, opts) {
|
|
|
3018
3010
|
(m) => m.route.id === routeId || m.route.loader
|
|
3019
3011
|
)?.route.id || routeId
|
|
3020
3012
|
).route.id;
|
|
3021
|
-
|
|
3013
|
+
let staticContext = {
|
|
3022
3014
|
matches,
|
|
3023
3015
|
location: location2,
|
|
3024
3016
|
basename,
|
|
@@ -3030,7 +3022,8 @@ function createStaticHandler(routes, opts) {
|
|
|
3030
3022
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
3031
3023
|
actionHeaders: {},
|
|
3032
3024
|
loaderHeaders: {}
|
|
3033
|
-
}
|
|
3025
|
+
};
|
|
3026
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
3034
3027
|
}
|
|
3035
3028
|
}
|
|
3036
3029
|
);
|
|
@@ -8924,7 +8917,7 @@ function mergeRefs(...refs) {
|
|
|
8924
8917
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
8925
8918
|
try {
|
|
8926
8919
|
if (isBrowser) {
|
|
8927
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
8920
|
+
window.__reactRouterVersion = "0.0.0-experimental-3f68c7c20";
|
|
8928
8921
|
}
|
|
8929
8922
|
} catch (e) {
|
|
8930
8923
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
useSearchParams,
|
|
132
132
|
useSubmit,
|
|
133
133
|
useViewTransitionState
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-SAZGQ73S.mjs";
|
|
135
135
|
export {
|
|
136
136
|
Await,
|
|
137
137
|
BrowserRouter,
|
|
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* react-router v0.0.0-experimental-
|
|
28
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
29
29
|
*
|
|
30
30
|
* Copyright (c) Remix Software Inc.
|
|
31
31
|
*
|
|
@@ -661,6 +661,12 @@ function createStaticHandler(routes, opts) {
|
|
|
661
661
|
let location = createLocation("", createPath(url), null, "default");
|
|
662
662
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
663
663
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
664
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
665
|
+
return stream ? stream(
|
|
666
|
+
requestContext,
|
|
667
|
+
() => Promise.resolve(ctx)
|
|
668
|
+
) : respond ? respond(ctx) : void 0;
|
|
669
|
+
};
|
|
664
670
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
665
671
|
let error = getInternalRouterError(405, { method });
|
|
666
672
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -677,10 +683,7 @@ function createStaticHandler(routes, opts) {
|
|
|
677
683
|
loaderHeaders: {},
|
|
678
684
|
actionHeaders: {}
|
|
679
685
|
};
|
|
680
|
-
return
|
|
681
|
-
requestContext,
|
|
682
|
-
() => Promise.resolve(staticContext)
|
|
683
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
686
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
684
687
|
} else if (!matches) {
|
|
685
688
|
let error = getInternalRouterError(404, { pathname: location.pathname });
|
|
686
689
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -697,10 +700,7 @@ function createStaticHandler(routes, opts) {
|
|
|
697
700
|
loaderHeaders: {},
|
|
698
701
|
actionHeaders: {}
|
|
699
702
|
};
|
|
700
|
-
return
|
|
701
|
-
requestContext,
|
|
702
|
-
() => Promise.resolve(staticContext)
|
|
703
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
703
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
704
704
|
}
|
|
705
705
|
if (stream || respond && matches.some(
|
|
706
706
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -767,13 +767,6 @@ function createStaticHandler(routes, opts) {
|
|
|
767
767
|
return res;
|
|
768
768
|
},
|
|
769
769
|
async (error, routeId) => {
|
|
770
|
-
if (stream) {
|
|
771
|
-
invariant(
|
|
772
|
-
false,
|
|
773
|
-
"stream() Not implemented for middleware errors yet"
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
invariant(respond, "Expected respond to be defined");
|
|
777
770
|
if (isResponse(error)) {
|
|
778
771
|
return error;
|
|
779
772
|
}
|
|
@@ -781,14 +774,13 @@ function createStaticHandler(routes, opts) {
|
|
|
781
774
|
if (routeId in renderedStaticContext.loaderData) {
|
|
782
775
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
783
776
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
790
|
-
)
|
|
777
|
+
let staticContext = getStaticContextFromError(
|
|
778
|
+
dataRoutes,
|
|
779
|
+
renderedStaticContext,
|
|
780
|
+
error,
|
|
781
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
791
782
|
);
|
|
783
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
792
784
|
} else {
|
|
793
785
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
794
786
|
matches,
|
|
@@ -796,7 +788,7 @@ function createStaticHandler(routes, opts) {
|
|
|
796
788
|
(m) => m.route.id === routeId || m.route.loader
|
|
797
789
|
)?.route.id || routeId
|
|
798
790
|
).route.id;
|
|
799
|
-
|
|
791
|
+
let staticContext = {
|
|
800
792
|
matches,
|
|
801
793
|
location,
|
|
802
794
|
basename,
|
|
@@ -808,7 +800,8 @@ function createStaticHandler(routes, opts) {
|
|
|
808
800
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
809
801
|
actionHeaders: {},
|
|
810
802
|
loaderHeaders: {}
|
|
811
|
-
}
|
|
803
|
+
};
|
|
804
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
812
805
|
}
|
|
813
806
|
}
|
|
814
807
|
);
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { splitCookiesString } from 'set-cookie-parser';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* react-router v0.0.0-experimental-
|
|
6
|
+
* react-router v0.0.0-experimental-3f68c7c20
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) Remix Software Inc.
|
|
9
9
|
*
|
|
@@ -639,6 +639,12 @@ function createStaticHandler(routes, opts) {
|
|
|
639
639
|
let location = createLocation("", createPath(url), null, "default");
|
|
640
640
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
641
641
|
requestContext = requestContext != null ? requestContext : new unstable_RouterContextProvider();
|
|
642
|
+
let respondOrStreamStaticContext = (ctx) => {
|
|
643
|
+
return stream ? stream(
|
|
644
|
+
requestContext,
|
|
645
|
+
() => Promise.resolve(ctx)
|
|
646
|
+
) : respond ? respond(ctx) : void 0;
|
|
647
|
+
};
|
|
642
648
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
643
649
|
let error = getInternalRouterError(405, { method });
|
|
644
650
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -655,10 +661,7 @@ function createStaticHandler(routes, opts) {
|
|
|
655
661
|
loaderHeaders: {},
|
|
656
662
|
actionHeaders: {}
|
|
657
663
|
};
|
|
658
|
-
return
|
|
659
|
-
requestContext,
|
|
660
|
-
() => Promise.resolve(staticContext)
|
|
661
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
664
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
662
665
|
} else if (!matches) {
|
|
663
666
|
let error = getInternalRouterError(404, { pathname: location.pathname });
|
|
664
667
|
let { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -675,10 +678,7 @@ function createStaticHandler(routes, opts) {
|
|
|
675
678
|
loaderHeaders: {},
|
|
676
679
|
actionHeaders: {}
|
|
677
680
|
};
|
|
678
|
-
return
|
|
679
|
-
requestContext,
|
|
680
|
-
() => Promise.resolve(staticContext)
|
|
681
|
-
) : respond ? respond(staticContext) : staticContext;
|
|
681
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
682
682
|
}
|
|
683
683
|
if (stream || respond && matches.some(
|
|
684
684
|
(m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
|
|
@@ -745,13 +745,6 @@ function createStaticHandler(routes, opts) {
|
|
|
745
745
|
return res;
|
|
746
746
|
},
|
|
747
747
|
async (error, routeId) => {
|
|
748
|
-
if (stream) {
|
|
749
|
-
invariant(
|
|
750
|
-
false,
|
|
751
|
-
"stream() Not implemented for middleware errors yet"
|
|
752
|
-
);
|
|
753
|
-
}
|
|
754
|
-
invariant(respond, "Expected respond to be defined");
|
|
755
748
|
if (isResponse(error)) {
|
|
756
749
|
return error;
|
|
757
750
|
}
|
|
@@ -759,14 +752,13 @@ function createStaticHandler(routes, opts) {
|
|
|
759
752
|
if (routeId in renderedStaticContext.loaderData) {
|
|
760
753
|
renderedStaticContext.loaderData[routeId] = void 0;
|
|
761
754
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
768
|
-
)
|
|
755
|
+
let staticContext = getStaticContextFromError(
|
|
756
|
+
dataRoutes,
|
|
757
|
+
renderedStaticContext,
|
|
758
|
+
error,
|
|
759
|
+
skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id
|
|
769
760
|
);
|
|
761
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
770
762
|
} else {
|
|
771
763
|
let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
|
|
772
764
|
matches,
|
|
@@ -774,7 +766,7 @@ function createStaticHandler(routes, opts) {
|
|
|
774
766
|
(m) => m.route.id === routeId || m.route.loader
|
|
775
767
|
)?.route.id || routeId
|
|
776
768
|
).route.id;
|
|
777
|
-
|
|
769
|
+
let staticContext = {
|
|
778
770
|
matches,
|
|
779
771
|
location,
|
|
780
772
|
basename,
|
|
@@ -786,7 +778,8 @@ function createStaticHandler(routes, opts) {
|
|
|
786
778
|
statusCode: isRouteErrorResponse(error) ? error.status : 500,
|
|
787
779
|
actionHeaders: {},
|
|
788
780
|
loaderHeaders: {}
|
|
789
|
-
}
|
|
781
|
+
};
|
|
782
|
+
return respondOrStreamStaticContext(staticContext) || staticContext;
|
|
790
783
|
}
|
|
791
784
|
}
|
|
792
785
|
);
|