react-router 0.0.0-experimental-c19b79d → 0.0.0-experimental-31a822c5f
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 +105 -0
- package/dist/development/browser-B4aBBnx8.d.ts +310 -0
- package/dist/development/browser-CN2w9Cbu.d.mts +310 -0
- package/dist/development/{chunk-LUB73E44.js → chunk-CZ7KRWQZ.js} +827 -64
- package/dist/development/{chunk-AGOH44BE.mjs → chunk-FXUONXY4.mjs} +132 -808
- package/dist/development/chunk-SE36CWVW.js +1308 -0
- package/dist/development/chunk-T5RKBXBV.js +188 -0
- package/dist/development/{chunk-IMKEG5CI.mjs → chunk-WTUOISGV.mjs} +2 -2
- package/dist/development/dom-export.d.mts +48 -3
- package/dist/development/dom-export.d.ts +48 -1
- package/dist/development/dom-export.js +703 -18
- package/dist/development/dom-export.mjs +687 -9
- package/dist/development/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BOJoTiaG.d.ts} +134 -134
- package/dist/{production/index-react-server-client-2EDmGlsZ.d.mts → development/index-react-server-client-CuQLmpku.d.mts} +1 -2
- package/dist/development/index-react-server-client.d.mts +2 -3
- package/dist/development/index-react-server-client.d.ts +2 -2
- 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.js +1 -1
- package/dist/development/index-react-server.mjs +1 -1
- package/dist/development/index.d.mts +9 -316
- package/dist/development/index.d.ts +9 -358
- package/dist/development/index.js +82 -914
- package/dist/development/index.mjs +3 -9
- package/dist/development/lib/types/internal.d.mts +2 -3
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/register-BrVEYTED.d.mts → development/register-BblEgJPm.d.mts} +1 -1
- package/dist/development/{register-D8NQoPsO.d.ts → register-D18raRVf.d.ts} +1 -1
- package/dist/development/{context-BqL5Eckq.d.mts → route-data-nQS6GSUI.d.mts} +472 -2
- package/dist/development/{routeModules-BmVo7q9e.d.ts → routeModules-9wlxglVk.d.ts} +12 -12
- package/dist/production/browser-B4aBBnx8.d.ts +310 -0
- package/dist/production/browser-CN2w9Cbu.d.mts +310 -0
- package/dist/production/{chunk-2L5AG5Y5.js → chunk-DRKUM6HW.js} +827 -64
- package/dist/production/{chunk-AODJW4D3.mjs → chunk-IGF74WUC.mjs} +132 -808
- package/dist/production/{chunk-UOQCOPF6.mjs → chunk-RUSRTUHT.mjs} +2 -2
- package/dist/production/chunk-UU3LJMU6.js +188 -0
- package/dist/production/chunk-YVVCGSEG.js +1308 -0
- package/dist/production/dom-export.d.mts +48 -3
- package/dist/production/dom-export.d.ts +48 -1
- package/dist/production/dom-export.js +703 -18
- package/dist/production/dom-export.mjs +687 -9
- package/dist/production/{index-react-server-client-DKvU8YRr.d.ts → index-react-server-client-BOJoTiaG.d.ts} +134 -134
- package/dist/{development/index-react-server-client-2EDmGlsZ.d.mts → production/index-react-server-client-CuQLmpku.d.mts} +1 -2
- package/dist/production/index-react-server-client.d.mts +2 -3
- package/dist/production/index-react-server-client.d.ts +2 -2
- 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.js +1 -1
- package/dist/production/index-react-server.mjs +1 -1
- package/dist/production/index.d.mts +9 -316
- package/dist/production/index.d.ts +9 -358
- package/dist/production/index.js +82 -914
- package/dist/production/index.mjs +3 -9
- package/dist/production/lib/types/internal.d.mts +2 -3
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-BrVEYTED.d.mts → production/register-BblEgJPm.d.mts} +1 -1
- package/dist/production/{register-D8NQoPsO.d.ts → register-D18raRVf.d.ts} +1 -1
- package/dist/production/{context-BqL5Eckq.d.mts → route-data-nQS6GSUI.d.mts} +472 -2
- package/dist/production/{routeModules-BmVo7q9e.d.ts → routeModules-9wlxglVk.d.ts} +12 -12
- package/package.json +1 -1
- package/dist/development/browser-z32v5KVN.d.mts +0 -46
- package/dist/development/chunk-2G2U5HGB.js +0 -2089
- package/dist/development/route-data-CDwqkzPE.d.mts +0 -473
- package/dist/production/browser-z32v5KVN.d.mts +0 -46
- package/dist/production/chunk-FGRCWJDI.js +0 -2089
- package/dist/production/route-data-CDwqkzPE.d.mts +0 -473
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-31a822c5f
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -9126,7 +9126,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
9126
9126
|
try {
|
|
9127
9127
|
if (isBrowser) {
|
|
9128
9128
|
window.__reactRouterVersion = // @ts-expect-error
|
|
9129
|
-
"0.0.0-experimental-
|
|
9129
|
+
"0.0.0-experimental-31a822c5f";
|
|
9130
9130
|
}
|
|
9131
9131
|
} catch (e) {
|
|
9132
9132
|
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
+
* react-router v0.0.0-experimental-31a822c5f
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkDRKUM6HWjs = require('./chunk-DRKUM6HW.js');
|
|
18
|
+
|
|
19
|
+
// lib/dom/ssr/hydration.tsx
|
|
20
|
+
function getHydrationData({
|
|
21
|
+
state,
|
|
22
|
+
routes,
|
|
23
|
+
getRouteInfo,
|
|
24
|
+
location,
|
|
25
|
+
basename,
|
|
26
|
+
isSpaMode
|
|
27
|
+
}) {
|
|
28
|
+
let hydrationData = {
|
|
29
|
+
...state,
|
|
30
|
+
loaderData: { ...state.loaderData }
|
|
31
|
+
};
|
|
32
|
+
let initialMatches = _chunkDRKUM6HWjs.matchRoutes.call(void 0, routes, location, basename);
|
|
33
|
+
if (initialMatches) {
|
|
34
|
+
for (let match of initialMatches) {
|
|
35
|
+
let routeId = match.route.id;
|
|
36
|
+
let routeInfo = getRouteInfo(routeId);
|
|
37
|
+
if (_chunkDRKUM6HWjs.shouldHydrateRouteLoader.call(void 0,
|
|
38
|
+
routeId,
|
|
39
|
+
routeInfo.clientLoader,
|
|
40
|
+
routeInfo.hasLoader,
|
|
41
|
+
isSpaMode
|
|
42
|
+
) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
|
|
43
|
+
delete hydrationData.loaderData[routeId];
|
|
44
|
+
} else if (!routeInfo.hasLoader) {
|
|
45
|
+
hydrationData.loaderData[routeId] = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return hydrationData;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// lib/rsc/errorBoundaries.tsx
|
|
53
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
54
|
+
var RSCRouterGlobalErrorBoundary = class extends _react2.default.Component {
|
|
55
|
+
constructor(props) {
|
|
56
|
+
super(props);
|
|
57
|
+
this.state = { error: null, location: props.location };
|
|
58
|
+
}
|
|
59
|
+
static getDerivedStateFromError(error) {
|
|
60
|
+
return { error };
|
|
61
|
+
}
|
|
62
|
+
static getDerivedStateFromProps(props, state) {
|
|
63
|
+
if (state.location !== props.location) {
|
|
64
|
+
return { error: null, location: props.location };
|
|
65
|
+
}
|
|
66
|
+
return { error: state.error, location: state.location };
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
if (this.state.error) {
|
|
70
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
71
|
+
RSCDefaultRootErrorBoundaryImpl,
|
|
72
|
+
{
|
|
73
|
+
error: this.state.error,
|
|
74
|
+
renderAppShell: true
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
} else {
|
|
78
|
+
return this.props.children;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function ErrorWrapper({
|
|
83
|
+
renderAppShell,
|
|
84
|
+
title,
|
|
85
|
+
children
|
|
86
|
+
}) {
|
|
87
|
+
if (!renderAppShell) {
|
|
88
|
+
return children;
|
|
89
|
+
}
|
|
90
|
+
return /* @__PURE__ */ _react2.default.createElement("html", { lang: "en" }, /* @__PURE__ */ _react2.default.createElement("head", null, /* @__PURE__ */ _react2.default.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ _react2.default.createElement(
|
|
91
|
+
"meta",
|
|
92
|
+
{
|
|
93
|
+
name: "viewport",
|
|
94
|
+
content: "width=device-width,initial-scale=1,viewport-fit=cover"
|
|
95
|
+
}
|
|
96
|
+
), /* @__PURE__ */ _react2.default.createElement("title", null, title)), /* @__PURE__ */ _react2.default.createElement("body", null, /* @__PURE__ */ _react2.default.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children)));
|
|
97
|
+
}
|
|
98
|
+
function RSCDefaultRootErrorBoundaryImpl({
|
|
99
|
+
error,
|
|
100
|
+
renderAppShell
|
|
101
|
+
}) {
|
|
102
|
+
console.error(error);
|
|
103
|
+
let heyDeveloper = /* @__PURE__ */ _react2.default.createElement(
|
|
104
|
+
"script",
|
|
105
|
+
{
|
|
106
|
+
dangerouslySetInnerHTML: {
|
|
107
|
+
__html: `
|
|
108
|
+
console.log(
|
|
109
|
+
"\u{1F4BF} Hey developer \u{1F44B}. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
|
|
110
|
+
);
|
|
111
|
+
`
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
if (_chunkDRKUM6HWjs.isRouteErrorResponse.call(void 0, error)) {
|
|
116
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
|
+
ErrorWrapper,
|
|
118
|
+
{
|
|
119
|
+
renderAppShell,
|
|
120
|
+
title: "Unhandled Thrown Response!"
|
|
121
|
+
},
|
|
122
|
+
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
+
_chunkDRKUM6HWjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
let errorInstance;
|
|
127
|
+
if (error instanceof Error) {
|
|
128
|
+
errorInstance = error;
|
|
129
|
+
} else {
|
|
130
|
+
let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
|
|
131
|
+
errorInstance = new Error(errorString);
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ _react2.default.createElement(ErrorWrapper, { renderAppShell, title: "Application Error!" }, /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"), /* @__PURE__ */ _react2.default.createElement(
|
|
134
|
+
"pre",
|
|
135
|
+
{
|
|
136
|
+
style: {
|
|
137
|
+
padding: "2rem",
|
|
138
|
+
background: "hsla(10, 50%, 50%, 0.1)",
|
|
139
|
+
color: "red",
|
|
140
|
+
overflow: "auto"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
errorInstance.stack
|
|
144
|
+
), heyDeveloper);
|
|
145
|
+
}
|
|
146
|
+
function RSCDefaultRootErrorBoundary({
|
|
147
|
+
hasRootLayout
|
|
148
|
+
}) {
|
|
149
|
+
let error = _chunkDRKUM6HWjs.useRouteError.call(void 0, );
|
|
150
|
+
if (hasRootLayout === void 0) {
|
|
151
|
+
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
|
+
}
|
|
153
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
154
|
+
RSCDefaultRootErrorBoundaryImpl,
|
|
155
|
+
{
|
|
156
|
+
renderAppShell: !hasRootLayout,
|
|
157
|
+
error
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// lib/rsc/route-modules.ts
|
|
163
|
+
function createRSCRouteModules(payload) {
|
|
164
|
+
const routeModules = {};
|
|
165
|
+
for (const match of payload.matches) {
|
|
166
|
+
populateRSCRouteModules(routeModules, match);
|
|
167
|
+
}
|
|
168
|
+
return routeModules;
|
|
169
|
+
}
|
|
170
|
+
function populateRSCRouteModules(routeModules, matches) {
|
|
171
|
+
matches = Array.isArray(matches) ? matches : [matches];
|
|
172
|
+
for (const match of matches) {
|
|
173
|
+
routeModules[match.id] = {
|
|
174
|
+
links: match.links,
|
|
175
|
+
meta: match.meta,
|
|
176
|
+
default: noopComponent
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
var noopComponent = () => null;
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
exports.getHydrationData = getHydrationData; exports.RSCRouterGlobalErrorBoundary = RSCRouterGlobalErrorBoundary; exports.RSCDefaultRootErrorBoundary = RSCDefaultRootErrorBoundary; exports.createRSCRouteModules = createRSCRouteModules; exports.populateRSCRouteModules = populateRSCRouteModules;
|