react-router 0.0.0-experimental-bcda00aaf → 0.0.0-experimental-a26b992a1

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +0 -7
  2. package/README.md +1 -10
  3. package/dist/dom-export.d.ts +3 -0
  4. package/dist/dom-export.mjs +205 -0
  5. package/dist/dom-export.mjs.map +1 -0
  6. package/dist/index.d.ts +79 -29
  7. package/dist/index.mjs +11702 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/dist/lib/components.d.ts +249 -34
  10. package/dist/lib/context.d.ts +18 -5
  11. package/dist/lib/dom/dom.d.ts +123 -0
  12. package/dist/lib/dom/global.d.ts +40 -0
  13. package/dist/lib/dom/lib.d.ts +940 -0
  14. package/dist/lib/dom/server.d.ts +41 -0
  15. package/dist/lib/dom/ssr/components.d.ts +123 -0
  16. package/dist/lib/dom/ssr/data.d.ts +7 -0
  17. package/dist/lib/dom/ssr/entry.d.ts +47 -0
  18. package/dist/lib/dom/ssr/errorBoundaries.d.ts +36 -0
  19. package/dist/lib/dom/ssr/errors.d.ts +2 -0
  20. package/dist/lib/dom/ssr/fallback.d.ts +2 -0
  21. package/dist/lib/dom/ssr/fog-of-war.d.ts +28 -0
  22. package/dist/lib/dom/ssr/invariant.d.ts +2 -0
  23. package/dist/lib/dom/ssr/links.d.ts +25 -0
  24. package/dist/lib/dom/ssr/markup.d.ts +5 -0
  25. package/dist/lib/dom/ssr/routeModules.d.ts +141 -0
  26. package/dist/lib/dom/ssr/routes-test-stub.d.ts +59 -0
  27. package/dist/lib/dom/ssr/routes.d.ts +32 -0
  28. package/dist/lib/dom/ssr/server.d.ts +16 -0
  29. package/dist/lib/dom/ssr/single-fetch.d.ts +37 -0
  30. package/dist/lib/dom-export/dom-router-provider.d.ts +5 -0
  31. package/dist/lib/dom-export/hydrated-router.d.ts +5 -0
  32. package/dist/lib/hooks.d.ts +284 -55
  33. package/dist/lib/router/history.d.ts +253 -0
  34. package/dist/lib/router/links.d.ts +104 -0
  35. package/dist/lib/router/router.d.ts +540 -0
  36. package/dist/lib/router/utils.d.ts +505 -0
  37. package/dist/lib/server-runtime/build.d.ts +38 -0
  38. package/dist/lib/server-runtime/cookies.d.ts +62 -0
  39. package/dist/lib/server-runtime/crypto.d.ts +2 -0
  40. package/dist/lib/server-runtime/data.d.ts +28 -0
  41. package/dist/lib/server-runtime/dev.d.ts +8 -0
  42. package/dist/lib/server-runtime/entry.d.ts +3 -0
  43. package/dist/lib/server-runtime/errors.d.ts +51 -0
  44. package/dist/lib/server-runtime/formData.d.ts +15 -0
  45. package/dist/lib/server-runtime/headers.d.ts +3 -0
  46. package/dist/lib/server-runtime/invariant.d.ts +2 -0
  47. package/dist/lib/server-runtime/jsonify.d.ts +33 -0
  48. package/dist/lib/server-runtime/markup.d.ts +1 -0
  49. package/dist/lib/server-runtime/mode.d.ts +9 -0
  50. package/dist/lib/server-runtime/responses.d.ts +37 -0
  51. package/dist/lib/server-runtime/routeMatching.d.ts +8 -0
  52. package/dist/lib/server-runtime/routeModules.d.ts +212 -0
  53. package/dist/lib/server-runtime/routes.d.ts +31 -0
  54. package/dist/lib/server-runtime/server.d.ts +5 -0
  55. package/dist/lib/server-runtime/serverHandoff.d.ts +11 -0
  56. package/dist/lib/server-runtime/sessions/cookieStorage.d.ts +19 -0
  57. package/dist/lib/server-runtime/sessions/memoryStorage.d.ts +17 -0
  58. package/dist/lib/server-runtime/sessions.d.ts +140 -0
  59. package/dist/lib/server-runtime/single-fetch.d.ts +30 -0
  60. package/dist/lib/server-runtime/typecheck.d.ts +4 -0
  61. package/dist/lib/server-runtime/upload/errors.d.ts +5 -0
  62. package/dist/lib/server-runtime/upload/memoryUploadHandler.d.ts +21 -0
  63. package/dist/lib/server-runtime/warnings.d.ts +1 -0
  64. package/dist/main-dom-export.js +19 -0
  65. package/dist/main.js +1 -1
  66. package/dist/react-router-dom.development.js +199 -0
  67. package/dist/react-router-dom.development.js.map +1 -0
  68. package/dist/react-router-dom.production.min.js +12 -0
  69. package/dist/react-router-dom.production.min.js.map +1 -0
  70. package/dist/react-router.development.js +12343 -1134
  71. package/dist/react-router.development.js.map +1 -1
  72. package/dist/react-router.production.min.js +2 -2
  73. package/dist/react-router.production.min.js.map +1 -1
  74. package/dist/umd/react-router-dom.development.js +241 -0
  75. package/dist/umd/react-router-dom.development.js.map +1 -0
  76. package/dist/umd/react-router-dom.production.min.js +12 -0
  77. package/dist/umd/react-router-dom.production.min.js.map +1 -0
  78. package/dist/umd/react-router.development.js +12667 -1284
  79. package/dist/umd/react-router.development.js.map +1 -1
  80. package/dist/umd/react-router.production.min.js +2 -2
  81. package/dist/umd/react-router.production.min.js.map +1 -1
  82. package/package.json +32 -6
  83. package/dist/index.js +0 -1471
  84. package/dist/index.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,5 @@
1
1
  # `react-router`
2
2
 
3
- ## 6.26.2
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies:
8
- - `@remix-run/router@1.19.2`
9
-
10
3
  ## 6.26.1
11
4
 
12
5
  ### Patch Changes
package/README.md CHANGED
@@ -1,15 +1,6 @@
1
1
  # React Router
2
2
 
3
- The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all
4
- the core functionality for both
5
- [`react-router-dom`](https://github.com/remix-run/react-router/tree/main/packages/react-router-dom)
6
- and
7
- [`react-router-native`](https://github.com/remix-run/react-router/tree/main/packages/react-router-native).
8
-
9
- If you're using React Router, you should never `import` anything directly from
10
- the `react-router` package, but you should have everything you need in either
11
- `react-router-dom` or `react-router-native`. Both of those packages re-export
12
- everything from `react-router`.
3
+ The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all the core functionality.
13
4
 
14
5
  If you'd like to extend React Router and you know what you're doing, you should
15
6
  add `react-router` **as a peer dependency, not a regular dependency** in your
@@ -0,0 +1,3 @@
1
+ export type { RouterProviderProps } from "./lib/dom-export/dom-router-provider";
2
+ export { RouterProvider } from "./lib/dom-export/dom-router-provider";
3
+ export { HydratedRouter } from "./lib/dom-export/hydrated-router";
@@ -0,0 +1,205 @@
1
+ /**
2
+ * React Router v0.0.0-experimental-a26b992a1
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
+ import * as React from 'react';
12
+ import * as ReactDOM from 'react-dom';
13
+ import { UNSAFE_invariant, UNSAFE_useFogOFWarDiscovery, UNSAFE_FrameworkContext, UNSAFE_RemixErrorBoundary, UNSAFE_decodeViaTurboStream, UNSAFE_createClientRoutes, matchRoutes, UNSAFE_shouldHydrateRouteLoader, UNSAFE_deserializeErrors, UNSAFE_createRouter, UNSAFE_createBrowserHistory, UNSAFE_mapRouteProperties, UNSAFE_getSingleFetchDataStrategy, UNSAFE_getPatchRoutesOnNavigationFunction, UNSAFE_createClientRoutesWithHMRRevalidationOptOut, RouterProvider as RouterProvider$1 } from 'react-router';
14
+
15
+ function _extends() {
16
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
17
+ for (var i = 1; i < arguments.length; i++) {
18
+ var source = arguments[i];
19
+ for (var key in source) {
20
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21
+ target[key] = source[key];
22
+ }
23
+ }
24
+ }
25
+ return target;
26
+ };
27
+ return _extends.apply(this, arguments);
28
+ }
29
+
30
+ let ssrInfo = null;
31
+ let router = null;
32
+ function initSsrInfo() {
33
+ if (!ssrInfo && window.__remixContext && window.__remixManifest && window.__remixRouteModules) {
34
+ ssrInfo = {
35
+ context: window.__remixContext,
36
+ manifest: window.__remixManifest,
37
+ routeModules: window.__remixRouteModules,
38
+ stateDecodingPromise: undefined,
39
+ router: undefined,
40
+ routerInitialized: false
41
+ };
42
+ }
43
+ }
44
+ function createHydratedRouter() {
45
+ initSsrInfo();
46
+ if (!ssrInfo) {
47
+ throw new Error("You must be using the SSR features of React Router in order to skip " + "passing a `router` prop to `<RouterProvider>`");
48
+ }
49
+ // We need to suspend until the initial state snapshot is decoded into
50
+ // window.__remixContext.state
51
+ let localSsrInfo = ssrInfo;
52
+ // Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this
53
+ // code potentially many times waiting for our state to arrive, but we'll
54
+ // then only get past here and create the `router` one time
55
+ if (!ssrInfo.stateDecodingPromise) {
56
+ let stream = ssrInfo.context.stream;
57
+ !stream ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "No stream found for single fetch decoding") : UNSAFE_invariant(false) : void 0;
58
+ ssrInfo.context.stream = undefined;
59
+ ssrInfo.stateDecodingPromise = UNSAFE_decodeViaTurboStream(stream, window).then(value => {
60
+ ssrInfo.context.state = value.value;
61
+ localSsrInfo.stateDecodingPromise.value = true;
62
+ }).catch(e => {
63
+ localSsrInfo.stateDecodingPromise.error = e;
64
+ });
65
+ }
66
+ if (ssrInfo.stateDecodingPromise.error) {
67
+ throw ssrInfo.stateDecodingPromise.error;
68
+ }
69
+ if (!ssrInfo.stateDecodingPromise.value) {
70
+ throw ssrInfo.stateDecodingPromise;
71
+ }
72
+ let routes = UNSAFE_createClientRoutes(ssrInfo.manifest.routes, ssrInfo.routeModules, ssrInfo.context.state, ssrInfo.context.isSpaMode);
73
+ let hydrationData = undefined;
74
+ if (!ssrInfo.context.isSpaMode) {
75
+ var _window$__remixContex;
76
+ // Create a shallow clone of `loaderData` we can mutate for partial hydration.
77
+ // When a route exports a `clientLoader` and a `HydrateFallback`, the SSR will
78
+ // render the fallback so we need the client to do the same for hydration.
79
+ // The server loader data has already been exposed to these route `clientLoader`'s
80
+ // in `createClientRoutes` above, so we need to clear out the version we pass to
81
+ // `createBrowserRouter` so it initializes and runs the client loaders.
82
+ hydrationData = _extends({}, ssrInfo.context.state, {
83
+ loaderData: _extends({}, ssrInfo.context.state.loaderData)
84
+ });
85
+ let initialMatches = matchRoutes(routes, window.location, (_window$__remixContex = window.__remixContext) == null ? void 0 : _window$__remixContex.basename);
86
+ if (initialMatches) {
87
+ for (let match of initialMatches) {
88
+ let routeId = match.route.id;
89
+ let route = ssrInfo.routeModules[routeId];
90
+ let manifestRoute = ssrInfo.manifest.routes[routeId];
91
+ // Clear out the loaderData to avoid rendering the route component when the
92
+ // route opted into clientLoader hydration and either:
93
+ // * gave us a HydrateFallback
94
+ // * or doesn't have a server loader and we have no data to render
95
+ if (route && UNSAFE_shouldHydrateRouteLoader(manifestRoute, route, ssrInfo.context.isSpaMode) && (route.HydrateFallback || !manifestRoute.hasLoader)) {
96
+ hydrationData.loaderData[routeId] = undefined;
97
+ } else if (manifestRoute && !manifestRoute.hasLoader) {
98
+ // Since every Remix route gets a `loader` on the client side to load
99
+ // the route JS module, we need to add a `null` value to `loaderData`
100
+ // for any routes that don't have server loaders so our partial
101
+ // hydration logic doesn't kick off the route module loaders during
102
+ // hydration
103
+ hydrationData.loaderData[routeId] = null;
104
+ }
105
+ }
106
+ }
107
+ if (hydrationData && hydrationData.errors) {
108
+ // TODO: De-dup this or remove entirely in v7 where single fetch is the
109
+ // only approach and we have already serialized or deserialized on the server
110
+ hydrationData.errors = UNSAFE_deserializeErrors(hydrationData.errors);
111
+ }
112
+ }
113
+ // We don't use createBrowserRouter here because we need fine-grained control
114
+ // over initialization to support synchronous `clientLoader` flows.
115
+ let router = UNSAFE_createRouter({
116
+ routes,
117
+ history: UNSAFE_createBrowserHistory(),
118
+ basename: ssrInfo.context.basename,
119
+ hydrationData,
120
+ mapRouteProperties: UNSAFE_mapRouteProperties,
121
+ dataStrategy: UNSAFE_getSingleFetchDataStrategy(ssrInfo.manifest, ssrInfo.routeModules, () => router),
122
+ patchRoutesOnNavigation: UNSAFE_getPatchRoutesOnNavigationFunction(ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.isSpaMode, ssrInfo.context.basename)
123
+ });
124
+ ssrInfo.router = router;
125
+ // We can call initialize() immediately if the router doesn't have any
126
+ // loaders to run on hydration
127
+ if (router.state.initialized) {
128
+ ssrInfo.routerInitialized = true;
129
+ router.initialize();
130
+ }
131
+ // @ts-ignore
132
+ router.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
133
+ UNSAFE_createClientRoutesWithHMRRevalidationOptOut;
134
+ window.__remixRouter = router;
135
+ return router;
136
+ }
137
+ /**
138
+ * @category Router Components
139
+ */
140
+ function HydratedRouter() {
141
+ var _ssrInfo;
142
+ if (!router) {
143
+ router = createHydratedRouter();
144
+ }
145
+ // Critical CSS can become stale after code changes, e.g. styles might be
146
+ // removed from a component, but the styles will still be present in the
147
+ // server HTML. This allows our HMR logic to clear the critical CSS state.
148
+ let [criticalCss, setCriticalCss] = React.useState(process.env.NODE_ENV === "development" ? (_ssrInfo = ssrInfo) == null ? void 0 : _ssrInfo.context.criticalCss : undefined);
149
+ if (process.env.NODE_ENV === "development") {
150
+ if (ssrInfo) {
151
+ window.__remixClearCriticalCss = () => setCriticalCss(undefined);
152
+ }
153
+ }
154
+ let [location, setLocation] = React.useState(router.state.location);
155
+ React.useLayoutEffect(() => {
156
+ // If we had to run clientLoaders on hydration, we delay initialization until
157
+ // after we've hydrated to avoid hydration issues from synchronous client loaders
158
+ if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
159
+ ssrInfo.routerInitialized = true;
160
+ ssrInfo.router.initialize();
161
+ }
162
+ }, []);
163
+ React.useLayoutEffect(() => {
164
+ if (ssrInfo && ssrInfo.router) {
165
+ return ssrInfo.router.subscribe(newState => {
166
+ if (newState.location !== location) {
167
+ setLocation(newState.location);
168
+ }
169
+ });
170
+ }
171
+ }, [location]);
172
+ !ssrInfo ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "ssrInfo unavailable for HydratedRouter") : UNSAFE_invariant(false) : void 0;
173
+ UNSAFE_useFogOFWarDiscovery(router, ssrInfo.manifest, ssrInfo.routeModules, ssrInfo.context.isSpaMode);
174
+ // We need to include a wrapper RemixErrorBoundary here in case the root error
175
+ // boundary also throws and we need to bubble up outside of the router entirely.
176
+ // Then we need a stateful location here so the user can back-button navigate
177
+ // out of there
178
+ return (
179
+ /*#__PURE__*/
180
+ // This fragment is important to ensure we match the <ServerRouter> JSX
181
+ // structure so that useId values hydrate correctly
182
+ React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UNSAFE_FrameworkContext.Provider, {
183
+ value: {
184
+ manifest: ssrInfo.manifest,
185
+ routeModules: ssrInfo.routeModules,
186
+ future: ssrInfo.context.future,
187
+ criticalCss,
188
+ isSpaMode: ssrInfo.context.isSpaMode
189
+ }
190
+ }, /*#__PURE__*/React.createElement(UNSAFE_RemixErrorBoundary, {
191
+ location: location
192
+ }, /*#__PURE__*/React.createElement(RouterProvider, {
193
+ router: router
194
+ }))), /*#__PURE__*/React.createElement(React.Fragment, null))
195
+ );
196
+ }
197
+
198
+ function RouterProvider(props) {
199
+ return /*#__PURE__*/React.createElement(RouterProvider$1, _extends({
200
+ flushSync: ReactDOM.flushSync
201
+ }, props));
202
+ }
203
+
204
+ export { HydratedRouter, RouterProvider };
205
+ //# sourceMappingURL=dom-export.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-export.mjs","sources":["../../lib/dom-export/hydrated-router.tsx","../../lib/dom-export/dom-router-provider.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n UNSAFE_AssetsManifest as AssetsManifest,\n UNSAFE_RouteModules as RouteModules,\n createBrowserRouter,\n HydrationState,\n} from \"react-router\";\nimport {\n UNSAFE_invariant as invariant,\n UNSAFE_FrameworkContext as FrameworkContext,\n UNSAFE_decodeViaTurboStream as decodeViaTurboStream,\n UNSAFE_RemixErrorBoundary as RemixErrorBoundary,\n UNSAFE_createBrowserHistory as createBrowserHistory,\n UNSAFE_createClientRoutes as createClientRoutes,\n UNSAFE_createRouter as createRouter,\n UNSAFE_deserializeErrors as deserializeErrors,\n UNSAFE_getSingleFetchDataStrategy as getSingleFetchDataStrategy,\n UNSAFE_getPatchRoutesOnNavigationFunction as getPatchRoutesOnNavigationFunction,\n UNSAFE_shouldHydrateRouteLoader as shouldHydrateRouteLoader,\n UNSAFE_useFogOFWarDiscovery as useFogOFWarDiscovery,\n UNSAFE_mapRouteProperties as mapRouteProperties,\n UNSAFE_createClientRoutesWithHMRRevalidationOptOut as createClientRoutesWithHMRRevalidationOptOut,\n matchRoutes,\n} from \"react-router\";\nimport { RouterProvider } from \"./dom-router-provider\";\n\ntype RemixRouter = ReturnType<typeof createBrowserRouter>;\n\ntype SSRInfo = {\n context: NonNullable<(typeof window)[\"__remixContext\"]>;\n routeModules: RouteModules;\n manifest: AssetsManifest;\n stateDecodingPromise:\n | (Promise<void> & {\n value?: unknown;\n error?: unknown;\n })\n | undefined;\n router: RemixRouter | undefined;\n routerInitialized: boolean;\n};\n\nlet ssrInfo: SSRInfo | null = null;\nlet router: RemixRouter | null = null;\n\nfunction initSsrInfo(): void {\n if (\n !ssrInfo &&\n window.__remixContext &&\n window.__remixManifest &&\n window.__remixRouteModules\n ) {\n ssrInfo = {\n context: window.__remixContext,\n manifest: window.__remixManifest,\n routeModules: window.__remixRouteModules,\n stateDecodingPromise: undefined,\n router: undefined,\n routerInitialized: false,\n };\n }\n}\n\nfunction createHydratedRouter(): RemixRouter {\n initSsrInfo();\n\n if (!ssrInfo) {\n throw new Error(\n \"You must be using the SSR features of React Router in order to skip \" +\n \"passing a `router` prop to `<RouterProvider>`\"\n );\n }\n\n // We need to suspend until the initial state snapshot is decoded into\n // window.__remixContext.state\n\n let localSsrInfo = ssrInfo;\n // Note: `stateDecodingPromise` is not coupled to `router` - we'll reach this\n // code potentially many times waiting for our state to arrive, but we'll\n // then only get past here and create the `router` one time\n if (!ssrInfo.stateDecodingPromise) {\n let stream = ssrInfo.context.stream;\n invariant(stream, \"No stream found for single fetch decoding\");\n ssrInfo.context.stream = undefined;\n ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window)\n .then((value) => {\n ssrInfo!.context.state =\n value.value as typeof localSsrInfo.context.state;\n localSsrInfo.stateDecodingPromise!.value = true;\n })\n .catch((e) => {\n localSsrInfo.stateDecodingPromise!.error = e;\n });\n }\n if (ssrInfo.stateDecodingPromise.error) {\n throw ssrInfo.stateDecodingPromise.error;\n }\n if (!ssrInfo.stateDecodingPromise.value) {\n throw ssrInfo.stateDecodingPromise;\n }\n\n let routes = createClientRoutes(\n ssrInfo.manifest.routes,\n ssrInfo.routeModules,\n ssrInfo.context.state,\n ssrInfo.context.isSpaMode\n );\n\n let hydrationData: HydrationState | undefined = undefined;\n if (!ssrInfo.context.isSpaMode) {\n // Create a shallow clone of `loaderData` we can mutate for partial hydration.\n // When a route exports a `clientLoader` and a `HydrateFallback`, the SSR will\n // render the fallback so we need the client to do the same for hydration.\n // The server loader data has already been exposed to these route `clientLoader`'s\n // in `createClientRoutes` above, so we need to clear out the version we pass to\n // `createBrowserRouter` so it initializes and runs the client loaders.\n hydrationData = {\n ...ssrInfo.context.state,\n loaderData: { ...ssrInfo.context.state.loaderData },\n };\n let initialMatches = matchRoutes(\n routes,\n window.location,\n window.__remixContext?.basename\n );\n if (initialMatches) {\n for (let match of initialMatches) {\n let routeId = match.route.id;\n let route = ssrInfo.routeModules[routeId];\n let manifestRoute = ssrInfo.manifest.routes[routeId];\n // Clear out the loaderData to avoid rendering the route component when the\n // route opted into clientLoader hydration and either:\n // * gave us a HydrateFallback\n // * or doesn't have a server loader and we have no data to render\n if (\n route &&\n shouldHydrateRouteLoader(\n manifestRoute,\n route,\n ssrInfo.context.isSpaMode\n ) &&\n (route.HydrateFallback || !manifestRoute.hasLoader)\n ) {\n hydrationData.loaderData![routeId] = undefined;\n } else if (manifestRoute && !manifestRoute.hasLoader) {\n // Since every Remix route gets a `loader` on the client side to load\n // the route JS module, we need to add a `null` value to `loaderData`\n // for any routes that don't have server loaders so our partial\n // hydration logic doesn't kick off the route module loaders during\n // hydration\n hydrationData.loaderData![routeId] = null;\n }\n }\n }\n\n if (hydrationData && hydrationData.errors) {\n // TODO: De-dup this or remove entirely in v7 where single fetch is the\n // only approach and we have already serialized or deserialized on the server\n hydrationData.errors = deserializeErrors(hydrationData.errors);\n }\n }\n\n // We don't use createBrowserRouter here because we need fine-grained control\n // over initialization to support synchronous `clientLoader` flows.\n let router = createRouter({\n routes,\n history: createBrowserHistory(),\n basename: ssrInfo.context.basename,\n hydrationData,\n mapRouteProperties,\n dataStrategy: getSingleFetchDataStrategy(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n () => router\n ),\n patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode,\n ssrInfo.context.basename\n ),\n });\n ssrInfo.router = router;\n\n // We can call initialize() immediately if the router doesn't have any\n // loaders to run on hydration\n if (router.state.initialized) {\n ssrInfo.routerInitialized = true;\n router.initialize();\n }\n\n // @ts-ignore\n router.createRoutesForHMR =\n /* spacer so ts-ignore does not affect the right hand of the assignment */\n createClientRoutesWithHMRRevalidationOptOut;\n window.__remixRouter = router;\n\n return router;\n}\n\n/**\n * @category Router Components\n */\nexport function HydratedRouter() {\n if (!router) {\n router = createHydratedRouter();\n }\n\n // Critical CSS can become stale after code changes, e.g. styles might be\n // removed from a component, but the styles will still be present in the\n // server HTML. This allows our HMR logic to clear the critical CSS state.\n let [criticalCss, setCriticalCss] = React.useState(\n process.env.NODE_ENV === \"development\"\n ? ssrInfo?.context.criticalCss\n : undefined\n );\n if (process.env.NODE_ENV === \"development\") {\n if (ssrInfo) {\n window.__remixClearCriticalCss = () => setCriticalCss(undefined);\n }\n }\n\n let [location, setLocation] = React.useState(router.state.location);\n\n React.useLayoutEffect(() => {\n // If we had to run clientLoaders on hydration, we delay initialization until\n // after we've hydrated to avoid hydration issues from synchronous client loaders\n if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {\n ssrInfo.routerInitialized = true;\n ssrInfo.router.initialize();\n }\n }, []);\n\n React.useLayoutEffect(() => {\n if (ssrInfo && ssrInfo.router) {\n return ssrInfo.router.subscribe((newState) => {\n if (newState.location !== location) {\n setLocation(newState.location);\n }\n });\n }\n }, [location]);\n\n invariant(ssrInfo, \"ssrInfo unavailable for HydratedRouter\");\n\n useFogOFWarDiscovery(\n router,\n ssrInfo.manifest,\n ssrInfo.routeModules,\n ssrInfo.context.isSpaMode\n );\n\n // We need to include a wrapper RemixErrorBoundary here in case the root error\n // boundary also throws and we need to bubble up outside of the router entirely.\n // Then we need a stateful location here so the user can back-button navigate\n // out of there\n return (\n // This fragment is important to ensure we match the <ServerRouter> JSX\n // structure so that useId values hydrate correctly\n <>\n <FrameworkContext.Provider\n value={{\n manifest: ssrInfo.manifest,\n routeModules: ssrInfo.routeModules,\n future: ssrInfo.context.future,\n criticalCss,\n isSpaMode: ssrInfo.context.isSpaMode,\n }}\n >\n <RemixErrorBoundary location={location}>\n <RouterProvider router={router} />\n </RemixErrorBoundary>\n </FrameworkContext.Provider>\n {/*\n This fragment is important to ensure we match the <ServerRouter> JSX\n structure so that useId values hydrate correctly\n */}\n <></>\n </>\n );\n}\n","import * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\n\nimport type { RouterProviderProps as BaseRouterProviderProps } from \"react-router\";\nimport { RouterProvider as BaseRouterProvider } from \"react-router\";\n\nexport { HydratedRouter } from \"./hydrated-router\";\n\nexport type RouterProviderProps = Omit<BaseRouterProviderProps, \"flushSync\">;\n\nexport function RouterProvider(props: Omit<RouterProviderProps, \"flushSync\">) {\n return <BaseRouterProvider flushSync={ReactDOM.flushSync} {...props} />;\n}\n"],"names":["ssrInfo","router","initSsrInfo","window","__remixContext","__remixManifest","__remixRouteModules","context","manifest","routeModules","stateDecodingPromise","undefined","routerInitialized","createHydratedRouter","Error","localSsrInfo","stream","process","env","NODE_ENV","invariant","decodeViaTurboStream","then","value","state","catch","e","error","routes","createClientRoutes","isSpaMode","hydrationData","_window$__remixContex","_extends","loaderData","initialMatches","matchRoutes","location","basename","match","routeId","route","id","manifestRoute","shouldHydrateRouteLoader","HydrateFallback","hasLoader","errors","deserializeErrors","createRouter","history","createBrowserHistory","mapRouteProperties","dataStrategy","getSingleFetchDataStrategy","patchRoutesOnNavigation","getPatchRoutesOnNavigationFunction","initialized","initialize","createRoutesForHMR","createClientRoutesWithHMRRevalidationOptOut","__remixRouter","HydratedRouter","_ssrInfo","criticalCss","setCriticalCss","React","useState","__remixClearCriticalCss","setLocation","useLayoutEffect","subscribe","newState","useFogOFWarDiscovery","createElement","Fragment","FrameworkContext","Provider","future","RemixErrorBoundary","RouterProvider","props","BaseRouterProvider","flushSync","ReactDOM"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAIA,OAAO,GAAmB,IAAI,CAAA;AAClC,IAAIC,MAAM,GAAuB,IAAI,CAAA;AAErC,SAASC,WAAWA,GAAA;AAClB,EAAA,IACE,CAACF,OAAO,IACRG,MAAM,CAACC,cAAc,IACrBD,MAAM,CAACE,eAAe,IACtBF,MAAM,CAACG,mBAAmB,EAC1B;AACAN,IAAAA,OAAO,GAAG;MACRO,OAAO,EAAEJ,MAAM,CAACC,cAAc;MAC9BI,QAAQ,EAAEL,MAAM,CAACE,eAAe;MAChCI,YAAY,EAAEN,MAAM,CAACG,mBAAmB;AACxCI,MAAAA,oBAAoB,EAAEC,SAAS;AAC/BV,MAAAA,MAAM,EAAEU,SAAS;AACjBC,MAAAA,iBAAiB,EAAE,KAAA;KACpB,CAAA;AACH,GAAA;AACF,CAAA;AAEA,SAASC,oBAAoBA,GAAA;AAC3BX,EAAAA,WAAW,EAAE,CAAA;EAEb,IAAI,CAACF,OAAO,EAAE;AACZ,IAAA,MAAM,IAAIc,KAAK,CACb,sEAAsE,GACpE,+CAA+C,CAClD,CAAA;AACH,GAAA;AAEA;AACA;EAEA,IAAIC,YAAY,GAAGf,OAAO,CAAA;AAC1B;AACA;AACA;AACA,EAAA,IAAI,CAACA,OAAO,CAACU,oBAAoB,EAAE;AACjC,IAAA,IAAIM,MAAM,GAAGhB,OAAO,CAACO,OAAO,CA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AAI,CAAA;AACzE;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,29 +1,79 @@
1
- import type { ActionFunction, ActionFunctionArgs, AgnosticPatchRoutesOnNavigationFunction, AgnosticPatchRoutesOnNavigationFunctionArgs, Blocker, BlockerFunction, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, ErrorResponse, Fetcher, HydrationState, InitialEntry, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, FutureConfig as RouterFutureConfig, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch } from "@remix-run/router";
2
- import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from "@remix-run/router";
3
- import type { AwaitProps, FutureConfig, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps } from "./lib/components";
4
- import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createRoutesFromChildren, renderMatches } from "./lib/components";
5
- import type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, RouteMatch, RouteObject } from "./lib/context";
6
- import { DataRouterContext, DataRouterStateContext, LocationContext, NavigationContext, RouteContext } from "./lib/context";
7
- import type { NavigateFunction } from "./lib/hooks";
8
- import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteId, useRouteLoaderData, useRoutes, useRoutesImpl } from "./lib/hooks";
9
- type Hash = string;
10
- type Pathname = string;
11
- type Search = string;
12
- export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker, BlockerFunction, };
13
- export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, renderMatches, resolvePath, useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
14
- export type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>;
15
- export type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>;
16
- declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
17
- hasErrorBoundary: boolean;
18
- };
19
- export declare function createMemoryRouter(routes: RouteObject[], opts?: {
20
- basename?: string;
21
- future?: Partial<Omit<RouterFutureConfig, "v7_prependBasename">>;
22
- hydrationData?: HydrationState;
23
- initialEntries?: InitialEntry[];
24
- initialIndex?: number;
25
- dataStrategy?: DataStrategyFunction;
26
- patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
27
- }): RemixRouter;
28
- /** @internal */
29
- export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, };
1
+ export type { InitialEntry, Location, Path, To } from "./lib/router/history";
2
+ export type { HydrationState, StaticHandler, GetScrollPositionFunction, GetScrollRestorationKeyFunction, StaticHandlerContext, Fetcher, Navigation, NavigationStates, RelativeRoutingType, Blocker, BlockerFunction, Router as RemixRouter, RouterState, RouterInit, RouterSubscriber, RouterNavigateOptions, RouterFetchOptions, RevalidationState, } from "./lib/router/router";
3
+ export type { ActionFunction, ActionFunctionArgs, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, } from "./lib/router/utils";
4
+ export { Action as NavigationType, createPath, parsePath, } from "./lib/router/history";
5
+ export { IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER, } from "./lib/router/router";
6
+ export { data, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath, } from "./lib/router/utils";
7
+ export type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, RouteMatch, RouteObject, } from "./lib/context";
8
+ export type { AwaitProps, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps, } from "./lib/components";
9
+ export type { NavigateFunction } from "./lib/hooks";
10
+ export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, } from "./lib/components";
11
+ export { useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "./lib/hooks";
12
+ export type { BrowserRouterProps, HashRouterProps, HistoryRouterProps, LinkProps, NavLinkProps, NavLinkRenderProps, FetcherFormProps, FormProps, ScrollRestorationProps, SetURLSearchParams, SubmitFunction, FetcherSubmitFunction, FetcherWithComponents, } from "./lib/dom/lib";
13
+ export { createBrowserRouter, createHashRouter, BrowserRouter, HashRouter, Link, HistoryRouter as unstable_HistoryRouter, NavLink, Form, ScrollRestoration, useLinkClickHandler, useSearchParams, useSubmit, useFormAction, useFetcher, useFetchers, useBeforeUnload, usePrompt as unstable_usePrompt, useViewTransitionState as useViewTransitionState, } from "./lib/dom/lib";
14
+ export type { FetcherSubmitOptions, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, SubmitTarget, } from "./lib/dom/dom";
15
+ export { createSearchParams } from "./lib/dom/dom";
16
+ export type { StaticRouterProps, StaticRouterProviderProps, } from "./lib/dom/server";
17
+ export { createStaticHandler, createStaticRouter, StaticRouter, StaticRouterProvider, } from "./lib/dom/server";
18
+ export { Meta, Links, Scripts, PrefetchPageLinks, } from "./lib/dom/ssr/components";
19
+ export type { ScriptsProps } from "./lib/dom/ssr/components";
20
+ export type { EntryContext } from "./lib/dom/ssr/entry";
21
+ export type { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, MetaArgs, MetaDescriptor, MetaFunction, LinksFunction, } from "./lib/dom/ssr/routeModules";
22
+ export type { ServerRouterProps } from "./lib/dom/ssr/server";
23
+ export { ServerRouter } from "./lib/dom/ssr/server";
24
+ export type { RoutesTestStubProps } from "./lib/dom/ssr/routes-test-stub";
25
+ export { createRoutesStub } from "./lib/dom/ssr/routes-test-stub";
26
+ export { createCookie, isCookie } from "./lib/server-runtime/cookies";
27
+ export { composeUploadHandlers as unstable_composeUploadHandlers, parseMultipartFormData as unstable_parseMultipartFormData, } from "./lib/server-runtime/formData";
28
+ export { createRequestHandler } from "./lib/server-runtime/server";
29
+ export { createSession, createSessionStorage, isSession, } from "./lib/server-runtime/sessions";
30
+ export { createCookieSessionStorage } from "./lib/server-runtime/sessions/cookieStorage";
31
+ export { createMemorySessionStorage } from "./lib/server-runtime/sessions/memoryStorage";
32
+ export { createMemoryUploadHandler as unstable_createMemoryUploadHandler } from "./lib/server-runtime/upload/memoryUploadHandler";
33
+ export { MaxPartSizeExceededError } from "./lib/server-runtime/upload/errors";
34
+ export { setDevServerHooks as unstable_setDevServerHooks } from "./lib/server-runtime/dev";
35
+ export type { IsCookieFunction } from "./lib/server-runtime/cookies";
36
+ export type { CreateRequestHandlerFunction } from "./lib/server-runtime/server";
37
+ export type { IsSessionFunction } from "./lib/server-runtime/sessions";
38
+ export type { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule, } from "./lib/server-runtime/build";
39
+ export type { UploadHandlerPart, UploadHandler, } from "./lib/server-runtime/formData";
40
+ export type { MemoryUploadHandlerOptions, MemoryUploadHandlerFilterArgs, } from "./lib/server-runtime/upload/memoryUploadHandler";
41
+ export type { Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, } from "./lib/server-runtime/cookies";
42
+ export type { AppLoadContext } from "./lib/server-runtime/data";
43
+ export type { PageLinkDescriptor, HtmlLinkDescriptor, LinkDescriptor, } from "./lib/router/links";
44
+ export type { TypedResponse } from "./lib/server-runtime/responses";
45
+ export type { DataFunctionArgs, HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules";
46
+ export type { RequestHandler } from "./lib/server-runtime/server";
47
+ export type { Session, SessionData, SessionIdStorageStrategy, SessionStorage, FlashSessionData, } from "./lib/server-runtime/sessions";
48
+ /** @internal */
49
+ export { createBrowserHistory as UNSAFE_createBrowserHistory, invariant as UNSAFE_invariant, } from "./lib/router/history";
50
+ /** @internal */
51
+ export { createRouter as UNSAFE_createRouter } from "./lib/router/router";
52
+ /** @internal */
53
+ export { ErrorResponseImpl as UNSAFE_ErrorResponseImpl } from "./lib/router/utils";
54
+ /** @internal */
55
+ export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, FetchersContext as UNSAFE_FetchersContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, ViewTransitionContext as UNSAFE_ViewTransitionContext, } from "./lib/context";
56
+ /** @internal */
57
+ export { mapRouteProperties as UNSAFE_mapRouteProperties } from "./lib/components";
58
+ /** @internal */
59
+ export { FrameworkContext as UNSAFE_FrameworkContext } from "./lib/dom/ssr/components";
60
+ /** @internal */
61
+ export type { AssetsManifest as UNSAFE_AssetsManifest } from "./lib/dom/ssr/entry";
62
+ /** @internal */
63
+ export { deserializeErrors as UNSAFE_deserializeErrors } from "./lib/dom/ssr/errors";
64
+ /** @internal */
65
+ export { RemixErrorBoundary as UNSAFE_RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries";
66
+ /** @internal */
67
+ export { getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, } from "./lib/dom/ssr/fog-of-war";
68
+ /** @internal */
69
+ export type { RouteModules as UNSAFE_RouteModules } from "./lib/dom/ssr/routeModules";
70
+ /** @internal */
71
+ export { createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, } from "./lib/dom/ssr/routes";
72
+ /** @internal */
73
+ export { getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch";
74
+ /** @internal */
75
+ export { decodeViaTurboStream as UNSAFE_decodeViaTurboStream, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, } from "./lib/dom/ssr/single-fetch";
76
+ /** @internal */
77
+ export { ServerMode as UNSAFE_ServerMode } from "./lib/server-runtime/mode";
78
+ /** @internal */
79
+ export { useScrollRestoration as UNSAFE_useScrollRestoration } from "./lib/dom/lib";